Jersey 1.18 in weblogic 12.2 - web-services

I have a web service in a weblogic 12.1 server (where it works) that I now have to transfer in a new weblogic 12.2 server. In my WEB-INF/lib jars I have jersey 1.18 files. However when I deploy it, it seems that Jersey 1.18 gets overridden by Jersey 2.21 and by calling the web service I get a "404 not found error". Application.wadl now has <ns0:doc ns1:generatedBy="Jersey: 2.21.1 2015-09-16..."/> so I guess that's where the problem is.
I tried putting a weblogic.xml file in WEB-INF with:
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
but nothing changed. How can I force using Jersey 1.18 ?

weblogic 12.2.x does not support jersey 1.x server api any more. It is better to use jersey 2.x api. For the 404 issue, I think you can use this link to change your app .
http://docs.oracle.com/middleware/1221/wls/RESTF/jersey-back-comp.htm#RESTF385

You may resolve the issue by changing your web.xml:
Before:
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
After:
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>

A safer way to enforce the library version you need is to use shared-libs and reference then in the weblogic.xml file. Here's a sample so you can take a look:
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app
http://xmlns.oracle.com/weblogic/weblogic-web-app/1.7/weblogic-web-app.xsd">
<wls:library-ref>
<library-name>jax-rs</library-name>
<specification-version>2.0</specification-version>
<exact-match>false</exact-match>
</wls:library-ref>
</wls:weblogic-web-app>
I invite you to access this link to get the detailed process on how to register your jersey lib as shared libs on weblogic instances.

Related

Assembling a WebLogic Web Service Manually

I implemented webservice as described in this guide by simply creating "web-services.xml" with the following content (and offcourse i create the 'com.example.WorkFlowEntry' handler class ) :
<web-services>
<handler-chains>
<handler-chain name="enterWorkflowChain">
<handler class-name="com.example.WorkFlowEntry">
<init-params>
<init-param name="workflow-eng-jndi-name"
value="workflow.entry" />
</init-params>
</handler>
</handler-chain>
</handler-chains>
<web-service targetNamespace="http://example.com"
name="myworkflow" uri="myWorkflowService">
<operations xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
<operation name="enterWorkflow"
handler-chain="enterWorkflowChain"
invocation-style="one-way" />
</operations>
</web-service>
My issue is that when i deploy the EAR file in weblogic 11g the '' webservice is deployed successfully and i can access the WSDL of the webservice. When i deploy the same EAR in weblogic 12c it got deployed successfully but the WSDL is not accessible i am getting 404!
Manually assembling weblogic web service is valid if you are using the
Webservice 8.1 environment. The last Weblogic version for which this
approach can be used is Weblogic 12.1.1, from Weblogic 12.1.2 release,
the 8.1 WebLogic Web services run time has been removed.
that means using the 'web-services.xml' to build your webservice is valid till weblogic 12.1.1 version. for the newer version you have to upgrade your webservice implementation as mentioned in this link which mainly go through (Upgrading a 10.x WebLogic Web Service (JAX-WS or JAX-RPC) to 12.1.x). But this solution may affect the current running clients.
In my case i cannot ask the client to change their code. So my workaround for this case is to take the current WSDL and generate the webservice manually by ant as described in this link which is describes using wsdlc Ant task to generate the following artifacts:
JWS service endpoint interface (SEI) that implements the Web service described
by the WSDL file.
JWS implementation file that contains a partial (stubbed-out) implementation of
the generated JWS SEI. This file must be customized by the developer.
JAXB data binding artifacts.
Optional Javadocs for the generated JWS SEI.

Need IBM Websphere jax ws webservices.xml and web.xml file

I don't have the sample webservices.xml and web.xml file. Can some one help by providing a complete example? I'm using Web Sphere JAX-WS implementation. WAS 7.x version. JDK 1.6.
I tried setting "UseWSFEP61ScanPolicy: true" in MANIFEST.MF file, for automated annotation scanning (instead of webservices.xml and web.xml file usage), but it is working first time, and after deploying a dynamic patch it doesn' works. The services listed under "services" category of IBM Console is having question mark instead of green arrow. Also some times the services even not listed in "services" category.
I'm using web module version 2.3, so i've to enable automated scanning. I'm not using EJB for web service.
I've decided to use webservices.xml and web.xml due to not much help in annotation scanning. I hope for webservices.xml and web.xml not need to install and reinstall the application EAR in WebSphere. In the case of annotation scanning reinstall is needed.
PLEASE IBM WEB SITE DOESN'T HELP MUCH!!!
Here's a web.xml I've used. Since it's "empty", the default rules for mapping annotated webservice classes to URL's apply, approximately, URL = name of class + "Service".
webservices.xml is not needed.
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.5" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd">
<display-name>wsfp_hello_svc</display-name>
</web-app>
Check SystemOut.log to find the URL of your service, look for something like this:
WSWS7037I: The /HelloService URL pattern was configured for the example.HelloDelegate servlet
If you don't like the default mappings, then you can map your webservice class to a different URL in web.xml just like you would do with a servlet.

How to access CXF jars from Wildfly (Jboss) for ws endpoints

I've tried to deploy my war file in Wildfly 8.2. My application uses org.apache.cxf for web service. But Wildfly (Jboss) comes by default with its own cxf jars which can be provide full Java EE support. I could eliminate jboss cxf and utilise my own cxf jars for web services by
jboss-deployment-structure.xml
<jboss-deployment-structure>
<deployment>
<exclude-subsystems>
<subsystem name="webservices" />
</exclude-subsystems>
</deployment>
</jboss-deployment-structure>
But it'll disable ws support by jboss which means I can't even find ws endpoints in Jboss admin console. But my client needs to utilise jboss's build in ws features so that he can disable or enable any ws calls at any time. Does anyone know on how to configure my application to utilise jboss's cxf jars so that I can tune my ws in Jboss admin console at any time. The following link explains exactly the same which I've mentioned so far. I'm successfull with the first option, but I need it to work with second option.
http://cxf.apache.org/docs/application-server-specific-configuration-guide.html
Note: See the first topic ( JBoss Application Server )
I can't seem to figure out how I can configure my application to utilise jboss's cxf jars..!
If I remove all the org.apache.cxf dependencies from my build.gradle file, it give ClassNotFoundException error which infact tells me that it can find the cxf-transport jar.
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: java.lang.ClassNotFoundException: org.apache.cxf.transport.servlet.CXFServlet
If I include org.apache.cxf dependenices in build.gradle file, it shows that it's conflicting with the cxf jar which is also present in Jboss. The whole problem is I need to utilise the cxf which is present in jboss for full Java EE support by eliminating the user defined cxf jars.
This is probably overlap with some other dependency what implies different version.
I had the same situation and had to test and remove all un-nesesery ones from org.apache.cxf, especially deprecated ones like:
cxf-rt-rs-extension-providers,
cxf-distribution-manifest,
cxf-bundle-jaxrs and
cxf-rt-frontend-jaxrs.
It is important for keeping compatibility to use ${cxf.version} for all
org.apache.cxf, especialy for later versions and check the dependency hierarchy if other dependencies are bringing in older cxf libraries.

WebService EndPoint Not accessible in Jboss Fuse 6

I developed Simple WebService OSGI Bundle with Eclipse Libra, Apache CXF and deployed it in JBoss Fuse 6. But when i tried to access it with http://x.x.x.x:8181/cxf/TestWs?wsdl it shows nothing.
I also tried following URL http://x.x.x.x:8181/cxf and it says no services.
I check status of this with karaf shell osgi:list and it shows me its Active.
Please let me know if i am doing any wrong?
Following is my Manifest.Mf
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: TestWs
Bundle-SymbolicName: TestWs
Bundle-Version: 1.0.0.qualifier
Bundle-ClassPath: WEB-INF/classes/
Export-Package: com.irk.ws,
com.irk.ws.jaxws
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: javax.el,
javax.servlet,
javax.servlet.http,
javax.servlet.jsp,
javax.servlet.jsp.el,
javax.servlet.jsp.tagext
Web-ContextPath: /TestWs
Regards,
did you try adding camel-cxf feature ?

Axis2 webservice client weblogic webservice client jar confilct

My application is a war deployed in weblogic 10. In one of my class, I need to make 2 webservice calls A and W. A is based on AXIS2 using wstx-asl-3.2.4.jar, W is based on weblogic webservice using jars in weblogic. I guess due to the conflict between wstx-asl and weblogic stax implementation, they can not be made at the same time.
Here is the detail of the problem:
1. If I remove wstx-asl-3.2.4.jar from web-inf/lib folder,
B is OK but A is faild due to exception: ClassCastException:weblogic.xml.stax.XMLStreamInputFactory
2. If I keep wstx-asl-3.2.4.jar in web-inf/lib folder,
A is OK but B is faild due to the exception:
[java.lang.ExceptionInInitializerError at com.bea.staxb.runtime.internal.BindingContextImpl.createMarshaller(BindingContextImpl.java:65) at weblogic.wsee.bind.runtime.internal.LiteralSerializerContext.(LiteralSerializerContext.java:54) at weblogic.wsee.bind.runtime.internal.RuntimeBindingsImpl.createSerializerContext(RuntimeBindingsImpl.java:152) at weblogic.wsee.bind.runtime.internal.RuntimeBindingsImpl.createSerializerContext(RuntimeBindingsImpl.java:168) at weblogic.wsee.codec.soap11.SerializationContextUtil.createSerializerContext(SerializationContextUtil.java:26) at weblogic.wsee.codec.soap11.SoapEncoder.encodeParts(SoapEncoder.java:179) at weblogic.wsee.codec.soap11.SoapEncoder.encode(SoapEncoder.java:119) at weblogic.wsee.codec.soap11.SoapCodec.encode(SoapCodec.java:128) at weblogic.wsee.ws.dispatch.client.CodecHandler.encode(CodecHandler.java:52) at weblogic.wsee.ws.dispatch.client.CodecHandler.handleRequest(CodecHandler.java:41) at weblogic.wsee.handler.HandlerIterator.handleRequest(HandlerIterator.java:123) at weblogic.wsee.handler.HandlerIterator.handleRequest(HandlerIterator.java:99) at weblogic.wsee.ws.dispatch.client.ClientDispatcher.dispatch(ClientDispatcher.java:101) at weblogic.wsee.ws.WsStub.invoke(WsStub.java:89) at weblogic.wsee.jaxrpc.StubImpl._invoke(StubImpl.java:331) at
.........................
Please advise how to make them successful together. Thanks.
in your deployment weblogic.xml file, use the <prefer-web-inf-classes> tag and set it to true for the axis2 call. And set it to false for the weblogic web service.
http://download.oracle.com/docs/cd/E13222_01/wls/docs90/programming/classloading.html#1082452