Axis2 deployment issue - java

I used axis2 1.7.3 version for my web service requirement. when i deploy the aar files, it shows the below exception. I used the java 8 features (eg. streams, filter etc ) in web service implementation files. Does axis2 support to deploy the web services implemented with java 8 features.
org.apache.axis2.deployment.DeploymentException: The following error occurred during schema generation: Error looking for paramter names in bytecode: unexpected bytes in file
at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:441)
at org.apache.axis2.deployment.repository.util.ArchiveReader.buildServiceGroup(ArchiveReader.java:109)
at org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup(ArchiveReader.java:232)
at org.apache.axis2.deployment.ServiceDeployer.deploy(ServiceDeployer.java:154)
at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:149)
at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:585)
at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:164)
at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:377)
at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:254)
at org.apache.axis2.deployment.RepositoryListener.startListener(RepositoryListener.java:371)
at org.apache.axis2.deployment.scheduler.SchedulerTask.checkRepository(SchedulerTask.java:73)
at org.apache.axis2.deployment.scheduler.SchedulerTask.run(SchedulerTask.java:94)
at org.apache.axis2.deployment.scheduler.Scheduler$SchedulerTimerTask.run(Scheduler.java:93)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)
Caused by: org.apache.axis2.deployment.DeploymentException: The following error occurred during schema generation: Error looking for paramter names in bytecode: unexpected bytes in file
at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:404)
... 14 more
Caused by: java.lang.IllegalStateException: Error looking for paramter names in bytecode: unexpected bytes in file
at org.apache.axis2.description.java2wsdl.bytecode.ClassReader.readCpool(ClassReader.java:354)
at org.apache.axis2.description.java2wsdl.bytecode.ParamReader.(ParamReader.java:78)
at org.apache.axis2.description.java2wsdl.bytecode.ParamReader.(ParamReader.java:57)
at org.apache.axis2.description.java2wsdl.bytecode.ChainedParamReader.(ChainedParamReader.java:52)
at org.apache.axis2.description.java2wsdl.bytecode.MethodTable.(MethodTable.java:31)
at org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator.(DefaultSchemaGenerator.java:177)
at org.apache.axis2.deployment.util.Utils.fillAxisService(Utils.java:454)
at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:396)
... 14 more

No, Axis2 (I use 1.7.4) does not work when using Java 8 features in the implementation class, because axis somehow has a problem analyzing that bytecode.
As a workaround, removing Java 8 features (e.g. streams) in the skeleton implementation solved it in my case. You can use those features anywhere except in the web service implementation class (when using Axis2).

Had a quick look at the Axis source code (https://svn.apache.org/repos/asf/axis/axis2/java/core/tags/v1.0/modules/java2wsdl/src/org/apache/ws/java2wsdl/bytecode/ClassReader.java), looks like you've got some problem with your class file ('corrupted class file', line 354).

Related

Docker container running one computer and not another

I'm trying to deploy a WebSphere Liberty Application via Docker. I'm also using Apache Struts for the UI. When deploying on my local machine I have no problems, but when put on seemingly any other machine, it throws an error saying the struts2 filter cannot be loaded. Classes do not seem to be missing.
Why would this container work on one machine and not another?
Stack Trace:
[ERROR ] SRVE0321E: The [struts2] filter did not load during start up.
Filter [struts2]: could not be initialized
[ERROR ] SRVE0315E: An exception occurred: java.lang.Throwable: javax.servlet.ServletException: Filter [struts2]: could not be initialized
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:5027)
at [internal classes]
Caused by: javax.servlet.ServletException: Filter [struts2]: could not be initialized
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:163)
... 1 more
Caused by: Unable to create SAX parser - Class: com.icl.saxon.aelfred.SAXParserFactoryImpl
File: SAXParserFactoryImpl.java
Method: newSAXParser
Line: 34 - com/icl/saxon/aelfred/SAXParserFactoryImpl.java:34:-1
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:835)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:131)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:100)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:130)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452)
at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:201)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:149)
... 1 more
Caused by: Unable to create SAX parser - Class: com.icl.saxon.aelfred.SAXParserFactoryImpl
File: SAXParserFactoryImpl.java
Method: newSAXParser
Line: 34 - com/icl/saxon/aelfred/SAXParserFactoryImpl.java:34:-1
at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:111)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:830)
... 9 more
Caused by: javax.xml.parsers.ParserConfigurationException: AElfred parser is non-validating
at com.icl.saxon.aelfred.SAXParserFactoryImpl.newSAXParser(SAXParserFactoryImpl.java:34)
at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:109)
... 10 more
Caused by: javax.xml.parsers.ParserConfigurationException: AElfred parser is non-validating
The struts2 requires to have a validating parser. Since this parser is non-validating it should be removed from the classpath.
The affected parser could be found in saxon.jar.
Thanks to Roman I was able to diagnose this problem more correctly as a saxon XML parser issue. I tried just replacing my JAR and this actually worked for a few tests but later broke.
This forum post ultimately solved the problem: http://grokbase.com/t/tomcat/users/031xc9jye7/i-cant-use-saxon-xml-parser-in-my-web-app-please-help
My web server (WebSphere Liberty) was trying to use Saxon as the XML parser, however Saxon is non-validating and thus this was failing, particularly in Docker where I was trying this.
To fix this I had to remove the file javax.xml.parsers.SAXParserFactory from the JAR and then the server ran correctly.

ClassCastException b/w IBMorb and jacorb jars in WAS 8.5.5

I have an application which is using jacorb.jar (org.omg.orb.ORB.class). When i deploying my war file in WAS 8.5.5, I am getting classcast exceptions with ibmorb located at openJdk/jre/lib/ibmorb.jar file. Could anyone help me in using jacorb.jar and resolving errors.
Error:
[3/3/15 5:30:51:863 PST] 00000001 ActivityServi E WACT0001E: The method pre_init(ORBInitInfo) in class com.ibm.ws.activity.remote.cos.ActivityServiceClientInterceptor received an unexpected exception;
the exception stack trace follows: java.lang.ClassCastException: org.jacorb.orb.portableInterceptor.ORBInitInfoImpl incompatible with com.ibm.CORBA.iiop.ExtendedORBInitInfo
at com.ibm.ws.activity.remote.cos.ActivityServiceClientInterceptor.pre_init(ActivityServiceClientInterceptor.java:219)
at org.jacorb.orb.ORB.interceptorPreInit(Unknown Source)
at org.jacorb.orb.ORB.internalInit(Unknown Source)
at org.jacorb.orb.ORB.set_parameters(Unknown Source)
at org.omg.CORBA.ORB.init(ORB.java:371)
Caused by: java.lang.ClassCastException: org.jacorb.orb.ORB incompatible with com.ibm.CORBA.iiop.ORB
at com.ibm.ws.orb.GlobalORBFactory.init(GlobalORBFactory.java:92)
at com.ibm.ejs.oa.EJSORBImpl.initializeORB(EJSORBImpl.java:179)
at com.ibm.ejs.oa.EJSClientORBImpl.<init>(EJSClientORBImpl.java:83)
at com.ibm.ejs.oa.EJSClientORBImpl.<init>(EJSClientORBImpl.java:59)
at com.ibm.ejs.oa.EJSORB.init(EJSORB.java:102)
IBM doesn't support third party ORB as it provides its own ORB. You can find the orb.properties with default properties in IBM JAVA jre folder. If you want to add anything related to ORB that need to inform JRE , we can add an entry in this property folder.
I have completely removed the JacORB from my code and used IBM ORB. They wont be any problem if you compile your code with JacORB and to use the same in IBM websphere as the package structure and method signature wont change. I have tested this practically.
Refer to this thread for more information in creating a corba name space and using it in code. If you follow those, you wont need to add jacorb jars in IBM websphere.
Corba NameService configuration in Websphere 8.5.5

Target namespace java util cxf and code generation package java.util.xsd

I have propieratary schema using target namespace
xmlns:ax216="http://util.java/xsd"
This gives me a problem with generating prohibited (by Java Security Manager) packages in starting with java (java.util.xsd).Refactoring classes is not enough. I still get an error from security manager. Service authors use axis2 but mixing this two libraries is not allowed in eclipse. Do you have any idea how to consume this service with CXF?
Event though I map them to different package I still have an exception:
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Prohibited package name: java.util.logging.xsd
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:156)
at $Proxy34.getBandwidthInformation(Unknown Source)
at com.adva.internal.measurement.gen.MeasurementModuleInterfaceImpl.main(FancyModuleInterfaceImpl.java:64)
Caused by: org.apache.cxf.binding.soap.SoapFault: Prohibited package name: java.util.logging.xsd
The wsdl2java tool has a -p flag to map namespaces.
wsdl2java -p http://util.java/xsd=com.foo.blah mywsdl.wsdl
should do it.

CFX wadl2java problem generating java

Hi I'm trying to generate the Java classes that are defined in the following WADL
http://www.epo.org/searching/free/ops.html
I'm trying to do it by command line. I've download the WADL and the XSD and also the apache-cfx-2.4.2.
I've tried to run the following command:
wadl2java" -verbose ops.wadl
I'm getting this error:
org.apache.cxf.tools.common.ToolException: java.lang.NullPointerException
at org.apache.cxf.tools.wadlto.jaxrs.JAXRSContainer.execute(JAXRSContainer.java:75)
at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
at org.apache.cxf.tools.wadlto.WADLToJava.run(WADLToJava.java:65)
at org.apache.cxf.tools.wadlto.WADLToJava.run(WADLToJava.java:57)
at org.apache.cxf.tools.wadlto.WADLToJava.main(WADLToJava.java:99)
Caused by: java.lang.NullPointerException
at org.apache.cxf.jaxrs.ext.codegen.SourceGenerator.createCodeModel(SourceGenerator.java:914)
at org.apache.cxf.jaxrs.ext.codegen.SourceGenerator.generateSchemaCodeAndInfo(SourceGenerator.java:182)
Does anyone know how to generate Java Classes from WADL without using Maven (I haven't got the permission to use it)?
I ended up using the XSD's and generating the code from there.
I used the JAXB xcj command.

Configuring JAX-WS over SSL through CXF

hey, I am having somewhat related issue only. Recently the external SOAP interface which were generating client for changed to https one. and I had an old code base at hand which was generating the java files through cxf and unsecured, http:// based wsdl. I chnaged the uri and on maven side everything works fine even the test pass. but when i use this jar in the main project of mine I get this:
Caused by: java.lang.NoSuchMethodError: javax.net.ssl.HttpsURLConnection.getSSLSocketFactory()Ljavax/net/ssl/SSLSocketFactory;
at sun.net.www.protocol.https.DelegateHttpsURLConnection.getSSLSocketFactory(DelegateHttpsURLConnection.java:50)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:172)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:801)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:158)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1049)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)
at java.net.URL.openStream(URL.java:1010)
at org.apache.cxf.resource.URIResolver.tryFileSystem(URIResolver.java:169)
at org.apache.cxf.resource.URIResolver.resolve(URIResolver.java:119)
at org.apache.cxf.resource.ExtendedURIResolver.resolve(ExtendedURIResolver.java:41)
at org.apache.cxf.transport.TransportURIResolver.resolve(TransportURIResolver.java:134)
at org.apache.cxf.catalog.CatalogWSDLLocator.getBaseInputSource(CatalogWSDLLocator.java:72)
at org.apache.cxf.wsdl11.AbstractWrapperWSDLLocator.getBaseInputSource(AbstractWrapperWSDLLocator.java:57)
at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:214)
at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:179)
at org.apache.cxf.wsdl11.WSDLServiceFactory.(WSDLServiceFactory.java:91)
at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:207)
at org.apache.cxf.jaxws.ServiceImpl.(ServiceImpl.java:150)
at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:63)
at javax.xml.ws.Service.(Service.java:56)
at generated.webservices.com.gbm.sso.ssoclient.AuthenticationServiceInternal.(AuthenticationServiceInternal.java:49)
at com.gbm.caprice.sso.client.CachingSSOClient.init(CachingSSOClient.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1536)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
... 45 more
Can you please help?
Since you're getting a NoSuchMethodError (which is caught/thrown by the compiler), My suggestion is that you are using a version of Java class (in this case, javax.net.ssl.HttpsURLConnection) which doesn't have the following method signature:
javax.net.ssl.HttpsURLConnection.getSSLSocketFactory()
This class can be found in the JRE/lib jsse.jar (as from time of writing, JDK 1.6.0_21). Make sure that your java libraries and your Apache CXF libaries are declared in the java CLASSPATH.
That's what I can help you based on your caused exception.

Categories

Resources