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

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.

Related

Axis2 deployment issue

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).

Running Groovy Script with Highscale lib causes SecurityException

While running a groovy script I get this exception:
Caught: java.lang.ExceptionInInitializerError
java.lang.ExceptionInInitializerError
Caused by: java.lang.SecurityException: Prohibited package name: java.util.concurrent
I noticed a library in my classpath high-scale-lib-1.0.6.jar which has a class java.util.concurrent.ConcurrentHashMap.class in the library.
I need this library so what can I do to get groovy scripts running? I read something about whitelists for such cases.
Any ideas on how I could solve this issue ?

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

Error in executing JAX-RPC

Help me on this exception , Occurs during calling wcf webservice
Log by netbeans
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:107)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)
at $Proxy32.logon(Unknown Source)
at newtestclient.NewTestClient.main(NewTestClient.java:92)
Caused by: java.lang.ClassCastException: com.sun.xml.bind.v2.runtime.JAXBContextImpl cannot be cast to com.sun.xml.internal.bind.api.JAXBRIContext
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.<clinit>(SOAPFaultBuilder.java:533)
... 5 more
Java Result: 1
The exception says :
java.lang.ClassCastException: com.sun.xml.bind.v2.runtime.JAXBContextImpl cannot be cast to com.sun.xml.internal.bind.api.JAXBRIContext.
It's a common error that appears when there is a conflict between libraries and its dependencies. You should try to execute your code in a test project with only the libraries from JAX-RPC, and then add one by one the rest of your app libraries.
Also, you should check your server libraries to discard any kind of conflict for having the same library (or its dependencies) in your app and in your server with different versions.

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.

Categories

Resources