Web service is not working on GlassFish - java

I am generating web service client in Eclipse Helios by Axis 1.4 version. The client stubs are working fine as per the expectation by using local main programs, but when I deploy the stub and application on GlassFish server, I am getting the following exception:
Edited : Now it gives exception like this ..
java.lang.IllegalStateException: WEB9031: WebappClassLoader unable to load resource [META-INF/services/org.apache.axis.EngineConfigurationFactory], because it has not yet been started, or was already stopped
at org.glassfish.web.loader.WebappClassLoader.findResourceInternal(WebappClassLoader.java:2074)
at org.glassfish.web.loader.WebappClassLoader.findResource(WebappClassLoader.java:1034)
at org.glassfish.web.loader.WebappClassLoader.getResource(WebappClassLoader.java:1169)
Can anyone tell me why it is happening?
Its happening only when I deploy the application on GlassFish server.
Thanks,
Gunjan.

This refers to the similar problem you have. So as I mention in my comment, remove all Axis related stuff from global glassfish classpath, add them into your application and it should all be fine.
It is not a very good practice to keep framework specific libraries in the server global libraries. In the global classpath should go libs like JDBC, logging frameworks, but not WS stack specific libraries.

Related

JAX WS using CXF and Webphere 8.5 (org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler incompatible with org.apache.cxf.frontend.ClientProxy)

I had an application running in Webphere 6 and JDK 1.6. Now I'm trying to migrate it to Whephere Application Server 8.5. I get a problem related to libraries used to consume SOAP Services (Im using CXF). The problem is that Webphere in this version, has its own libraries to do this (AXIS2). I followed IBM recomendations
'Using a third-party JAX-WS web services engine'
-https://www.ibm.com/support/knowledgecenter/SSEQTP_8.5.5/com.ibm.websphere.nd.doc/ae/twbs_thirdparty.html-
IT DOESN'T WORK FOR ME
However, I found that someone solved it removing a file from the META-INF AXIS2 library in Websphere. (javax.xml.ws.spi.Provider) =====IT WORKED===== But now I'm having other derived problems
org.springframework.web.util.NestedServletException: Handler processing failed;
nested exception is java.lang.NoSuchMethodError
org/apache/ws/commons/schema/XmlSchemaCollection.read(Lorg/w3c/dom/Document;Ljava/lang/String;)Lorg/apache/ws/commons/schema/XmlSchema;
(loaded from file:/usr/IBM/WebSphere/AppServer/plugins/org.apache.axis2.jar by org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader#41aaaf6e)
called from class org.apache.cxf.common.xmlschema.SchemaCollection (
loaded
from file:/usr/IBM/WebSphere/AppServer/profiles/AppServer01/installedApps/CLDC462Cell01/MyApp.ear/myapp.war/WEB-INF/lib/cxf-core-3.1.5.jar
by
com.ibm.ws.classloader.CompoundClassLoader#5344aede
Your app is picking up some Apache classes from the WebSphere libraries rather than from your application, and the version in WebSphere is incompatible with the app's version of CXF. This means that you're going to need to add a jar containing an appropriate version of org.apache.ws.commons.schema.XmlSchemaCollection to your application. I presume that you're running with PARENT_LAST delegation in your web module already, given that you're using your own web services implementation, but if not, that will be necessary as well.

CMIS java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/apache/chemistry/opencmis/client/api/SessionFactory

java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/apache/chemistry/opencmis/client/api/SessionFactory
I keep on getting this error when I deploy an instance of CMIS. I know that there are other questions on here with the same error message but all those questions use Alfresco. My code does not use Alfresco, I am using the CMIS libraries natively. When I run my CMIS code on a local development instance, it works just fine, no errors. When I deploy it to a production server, it generates the error. My local web server is Liberty and the production server is WAS.
I have already verified that my ECM instance is working just fine and so is the CMIS gateway. I am able to make changes with CMIS Workbench just fine.
Can someone point me in the right direction to try and debug this?
I think what Gagravarr was referring to was putting the jar files into your application EAR file you are deploying to WAS.

First steps on liferay web services

I followed this tutorial -documentation about Liferay Web service.
I runned Lifaray on tomcat
If I use http://localhost:8080/api/axis/Portal_UserService?wsdl by browser I have a response.
When I create a webService Client on Eclipse and I put this url http://localhost:8080/api/axis/Portal_UserService?wsdl in the Service Definition...
but I have this error message:
No server can be found and WebServiceProject does not exist. Choose an existing project or use the preferences to configure a server runtime.
Why?
create dynamic web project and configure a server then add wsdl .
This does not mean that the server (e.g. Liferay) can't be found but notifies you that Eclipse doesn't know where to put/how to configure the resulting WebService: It needs a server runtime and a WebServiceProject - e.g. you can create a WebServiceClient inside a project - if no suitable project exists, eclipse will complain.
So: Everything is fine on the Liferay side. You'll need infrastructure in your IDE to be able to go forward with this operation
I could not find any solution to this, for some reason Eclipse didn't recognize a valid wsdl. I downloaded a trial version of IntelliJ IDEA 13 Ultimate and setup the Web Service Client through there. Everything worked properly.

How to debug EJB which is deployed on Weblogic

I have application running on Weblogic. And I have another application which connects to one deployed on Weblogic and uses EJB of it. I am successfully connecting to EJB using JNDI, even my debugger shows that this class is currently launched (but the name is changed - WL added something to end of class name(like if class was AEjb, it shows that launched class is AEjb_krtm_pfff ...)). But I can't see nor variables, nor lines executed. So are there any ways to see what's happening with this EJB class?
It's no different than the way you are debugging the client side application. Add your EJB source code also in the debugger path and add a break point on EJB source code which you want to debug.
If your EJB is deployed on different Weblogic server, then you may want to use remote debugging option.
Looks like you need to debug the EJB code deployed on the WebLogic server, you can do the debugging using any of the following options:
Use remote debugging as suggested by Yogendra
If you can control the deployment of the Application containing EJB, then deploy it in exploded directory mode on Administration Server and use JDeveloper Integrated WebLogic Server to debug the source whenever client pings the EJB code deployed on the server.
If you are using standalone client to call EJB, and have been facing an issue on client side, the same can be debugged using system property on client side.
-Dweblogic.ejb.enhancement.debug=true (post WLS 10.3.1.0)
-Dweblogic.ejb.proxy.debug=true (src branch)

How can I embed Weblogic server in java?

I am searching any way for embedding Weblogic server in Java , I know its possible because we have maven plugins for Weblogic which embeds Weblogic in maven, But googling for it did'nt gave me useful output, Does anybody know how can we embed wemlogic in java program ?
WebLogic doesn't provide an embedded API so, even if it's a pure Java Server and if you can thus call weblogic.Server from Java code, you will have to handle everything yourself (starting the container, waiting until it's started, deploying things, waiting until they are deployed, etc). In other words, this will require some work.
Maybe have a look at the sources of Cargo, although Cargo isn't really starting an embedded Weblogic (i.e. running weblogic.Server in the same JVM). This will give you an idea of what has to be done. Or, depending on your needs, use Cargo Java API.
But if you need a full Java EE server and if this is an option, I would use GlassFish v3 in embedded mode instead of WebLogic, it will be much simpler. Check the following links and see yourself:
Embedding Glassfish V3 in Unit Test - Two Jars, Three Lines Of Code And Five Seconds Start With Deployment
Embedding EJB 3.1 Container Into Your Unit Tests - Boot Time: 5 Seconds
Using the EJBContainer API with or without Maven (but with GlassFish v3)
TOTD #128: EJBContainer.createEJBContainer: Embedded EJB using GlassFish v3
Do you need WLS specifically, of any servlet container would do? If the latter is OK, then use Jetty.
WLS is not designed to be embeddable. But you can do it. After all, WLS is just a class named weblogic.Server. Setup classpath correctly, setup PATH and other environment variables (see setDomainEnv.sh and startWeblogic.sh), start that class from Java, and you have an "embedded" WLS.
There is probably a way, but I don't know it. My experience from writing maven plugins tells me that the most likely way that the plugin works is that it starts up a new command line process just like you would normally start up the server. So in a sense, not really embedded it.
The best way to see is to track down the source of the plugin and see how they did it.
WebLogic doesn't support embedded mode like Glassfish but you can have control over your Weblogic using "WebLogic Maven Plugin", this provide several maven goals for managing and working with Weblogic instance.
See this link for further information.

Categories