I've got two Liferay portlets.
The first one manages persistence, I've created some entities and run service builder. After that, I've created a couple of methods in MyEntityLocalServiceImpl and run service builder again to get all the related methods.
I generate the jar and the war of this portlet, install the war in my Liferay instance and copy the jar at tomcat's /lib/ext
From my second portlet, I call MyEntityServiceUtil.myMethod(myParams) and, at execution time, it throws:
10:51:59,458 ERROR [http-bio-8080-exec-8][PortletServlet:116] javax.portlet.PortletException: java.lang.NoClassDefFoundError: com/liferay/portal/service/BaseService
javax.portlet.PortletException: java.lang.NoClassDefFoundError: com/liferay/portal/service/BaseService
at com.liferay.portal.kernel.portlet.LiferayPortlet.callActionMethod(LiferayPortlet.java:181)
at com.liferay.util.bridges.mvc.MVCPortlet.callActionMethod(MVCPortlet.java:249)
at com.liferay.portal.kernel.portlet.LiferayPortlet.processAction(LiferayPortlet.java:90)
at com.liferay.util.bridges.mvc.MVCPortlet.processAction(MVCPortlet.java:212)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:71)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:48)
at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:112)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
...
I can see portal-service.jar at tomcat's /lib/ext, containing BaseService.class
Any idea why is it not being found at execution time? Thanks!
Related
Eclipse: Luna 4.4.2
Tomcate 8.0
Attaching my POM.xml
I want to call taleo webservice and trying to create a dynamic web application.
I tried following scenarios:
Scenario 1: wsdl is working fine in SOAP UI.
Scenario 2:
Created a maven project and generate the source for wsdl and write the code for client.Able to call the webservice without any error And create java UI (Frame) and show the result on UI.
Scenario 3:
Created a maven project, add the wsdl into it and generate source for wsdl. Then trying to convert it into web application Getting below error:
cannot nest '31JanTest/target/generated-sources/cxf/schemaorg_apache_xmlbeans' inside '31JanTest/target/generated-sources/cxf'. To enable the nesting exclude 'schemaorg_apache_xmlbeans/' from '31JanTest/target/generated-sources/cxf'.
Scenarion 4:
Step 1:
(First created dynamic web application then convert it to a maven project). As soon as i added wsdl to this project getting below error in wsdl:
src-resolve.4.2: Error resolving component 'ns2:Entity'. It was detected that 'ns2:Entity' is in namespace 'http://www.taleo.com/
ws/tee800/2009/01', but components from this namespace are not referenceable from schema document 'file:///C:/Users/
deepak_gupta22/WorkSpace1/test123/src/taleoWebservice.wsdl'. If this is the incorrect namespace, perhaps the prefix of
'ns2:Entity' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'file:///C:/
Users/deepak_gupta22/WorkSpace1/test123/src/taleoWebservice.wsdl'.
Step 2:
Ignore this error in wsdl and build the application and wrote the client code and run the application. I got below error:
SEVERE: Servlet.service() for servlet [main.MyTestServlet] in context with path [/test123] threw exception [Servlet execution threw an exception] with root cause
java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlObject
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2496)
at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:860)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1302)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetPublicMethods(Class.java:2902)
at java.lang.Class.getMethods(Class.java:1615)
at com.sun.xml.internal.ws.model.RuntimeModeler.processClass(RuntimeModeler.java:462)
at com.sun.xml.internal.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:305)
at com.sun.xml.internal.ws.db.DatabindingImpl.<init>(DatabindingImpl.java:85)
at com.sun.xml.internal.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:59)
at com.sun.xml.internal.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:43)
at com.sun.xml.internal.ws.db.DatabindingFactoryImpl.createRuntime(DatabindingFactoryImpl.java:105)
at com.sun.xml.internal.ws.client.WSServiceDelegate.buildRuntimeModel(WSServiceDelegate.java:875)
at com.sun.xml.internal.ws.client.WSServiceDelegate.createSEIPortInfo(WSServiceDelegate.java:892)
at com.sun.xml.internal.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:855)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:435)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:404)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:386)
at javax.xml.ws.Service.getPort(Service.java:119)
at com.taleo.ws.tee800._2009._01.find.FindService.getFindServiceHttpPort(FindService.java:72)
at main.ClientService.getEntities(ClientService.java:202)
at main.MyTestServlet.doGet(MyTestServlet.java:42)
What am I missing in web application or what i have to add in web application to work it properly?
I can see in java project below two folders are created automatically:
1. target/generated-sources/cxf
2. target/generated-sources/cxf/schemaorg_apache_xmlbeans
But in web project only one folder is created:
1. target/generated-sources/cxf
target/generated-sources/cxf/schemaorg_apache_xmlbeans forlder is not created in web project. Please help me what is wrong in my project?
Experts please help me to resolve the issue.
Pleaase let me know if more information needed from my side.
Thanks and Regards,
Deepak
In the marker tab. i was getting "Classpath entry org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER will not be exported or published. Runtime ClassNotFoundExceptions may result" warning.
I Resolved it by doing following steps:
1. Right click on this warning and click on quick fix option
2. Select Mark the associated raw classpath entry as a publish/export dependency. And click on finish
I am trying a simple example of creating a RESTful API. I used the Maven jersey-quickstart-webapp archtype to create a Jersey web app. In a separate project I created a simple class: SimpleClass, which only has one method that returns "hello". I am trying to create an instance of that class in my method in the web app (I am using the default MyResource class) and call its method to get "Hello". I exported the project with the SimpleClass to a JAR file, and added that file to the build path for my Jersey project, and imported the relevant package.
When I run the web app on a local server, and call the MyResource method, I get an error with the root cause (just the top few rows):
java.lang.NoClassDefFoundError: Lorg/test/simple/SimpleClass;
java.lang.Class.getDeclaredFields0(Native Method)
java.lang.Class.privateGetDeclaredFields(Class.java:2583)
java.lang.Class.getDeclaredFields(Class.java:1916)
So, it can't find the SimpleClass class.
What am I doing wrong here? I'd really appreciate any help!
Thanks,
Yariv.
New info: I tried to create a RESTful web service without Maven. I successfully created the project with a simple "Hello World" example, and then I tried to add my own class from another project: I imported the .jar, added it to the build path, and created a class in the web service that creates an instance of my class when a GET is made to the server. My class happens to include (as members) instances of other classes, one of which connects to a MongoDB database, and when I run the service, I again get a HTTP 500 error as follows:
A MultiException has 2 exceptions. They are:
1. java.lang.NoClassDefFoundError: com/mongodb/DBObject
2. java.lang.IllegalStateException: Unable to perform operation: create on org.notes.server.NotesServer
Adding the MongoDB jar to the web project did not help. I must be missing something big here. What should I do to call code I created in another project (with a set of dependencies there) in my web service?
I'll appreciate any help I can get, I am getting nowhere with this...
I was able to resolve all these issues by adding all the relevant JARs to the deployment assembly (right-click on the project, click Properties, then select Deployment Assembly and add all the JARs that my class depends on, as well as its own JAR).
Thanks for your help, radai!
I've got into a scenario where I have to get an Axis2 based ws consumer working within WebMethods as a java service. I've implemented the ws consumer first in netbeans just to see if it works and thus i found that the minimal amount of jars I'll require are the following:
[ xmlschema-1.4.7.jar, apache-mime4j-core-0.7.2.jar,
axiom-api-1.2.13.jar, axiom-impl-1.2.13.jar, axis2-adb-1.6.2.jar,
axis2-kernel-1.6.2.jar, axis2-transport-http-1.6.2.jar,
axis2-transport-local-1.6.2.jar, commons-codec-1.3.jar,
commons-httpclient-3.1.jar, commons-logging-1.1.1.jar,
httpcore-4.0.jar, mail-1.4.jar, neethi-3.0.2.jar, wsdl4j-1.6.2.jar ]
I've uploaded these jar files under the IS/packages/{package_name}/code/jars folder. Whenever I try to execute the java service that would send the request and process the response I get the following exception:
java.lang.reflect.InvocationTargetException:
org.apache.axiom.om.OMFactory.getMetaFactory()Lorg/apache/axiom/om/OMMetaFactory;
From the IS error log file I found that the actual error message is as follows:
org.apache.axiom.om.OMFactory.getMetaFactory()Lorg/apache/axiom/om/OMMetaFactory;
Caused by: java.lang.reflect.InvocationTargetException: null Caused
by:
java.lang.NoSuchMethodError:org.apache.axiom.om.OMFactory.getMetaFactory()Lorg/apache/axiom/om/OMMetaFactory;
The platform is WebMethods 8.2 under Linux environment. The JDK version is 1.6.0_32 and the application server under WebMethods is Jetty.
Actually the solve of this problem was a bit more tricky. First of all I manually had to configure the manifest file of the package on the IS server to use the jars provided in the package abnd thus it wouldn't get in conflict with the Axis used by the IS itself. On the other hand I had to manually add the ClassLoader because WebMethods can't use META-INF based information from jar files as it seems. To solve this problem simply use:
System.setProperty("org.apache.axiom.om.OMMetaFactory", "org.apache.axiom.om.impl.llom.factory.OMLinkedListMetaFactory");
That solves all the problems.
I am working on some migration project, involves moving around quite a few stuff from Ant/CVS/Jboss4/Java5 to Maven/SVN/Jboss7/Java6 - this gets nasty.
First step, I am working on moving the ant build to maven - that it in iteslf involve a lot of complication. Now that I get the ear file built, and I compared it with the ear from ant build, I think I got it good with the maven build.
Now, deploying on Jboss4 first, I encouter
[ejb.EJBDeployer.verifier] EJB spec violation:
Warning: The message driven bean must declare one onMessage() method.
2011-11-08 15:25:03,079 ERROR (Thread: main) [jboss.deployment.MainDeployer] Could not create deployment: file:/opt/jboss-4.0.3SP1/server/default/tmp/deploy/tmp46514Billing-EAR-1.0.ear-contents/processsubscriptionbean-1.0.jar
org.jboss.deployment.DeploymentException: Verification of Enterprise Beans failed, see above for error messages.
at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:575)
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:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:80)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
at $Proxy24.create(Unknown Source)
at org.jboss.deployment.MainDeployer.create(MainDeployer.java:935)
at org.jboss.deployment.MainDeployer.create(MainDeployer.java:925)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:789)
I came across this thread jBoss deployment of message-driven bean spec violation - so I figured I was using the wrong library on my new maven build, I replaced it and made sure it's using the same javax.jms library (this now points to the same jar containing javax.jms.Message as the original ant build) - in fact I simply grabbed the jar referenced by the ant build and upload it to maven repo and reference it from my maven build.
But I still encounter the above problem. The original ant-build would deploy with no problem, but currently I am stuck at this issue for the maven-build ear.
Any suggestion on what other steps i can take to make sure there are no different class files issue? Thanks!
Is the javax.jms library being packaged in your ear (jboss-j2ee.jar, jboss-client.jar, etc)? If so, you don't want that since you want to use the one provided by the app server. You can fix this by changing the dependency in your pom to have the <scope>provided</scope> for anything that shouldn't be in your ear.
I'm working on a project which includes persistence library (JPA 1.2), EJB 3 and Web presentation layer (JSF). I develop application using Eclipse and application is published on Websphere Application Server Community Edition (Geronimo 2.1.4) through eclipse plugin (but the same thing happens if I publish manually). When publishing to server I get the following error:
java.lang.NoClassDefFoundError: Could not fully load class: manager.administration.vehicles.VehicleTypeAdminBean
due to:manager/vehicles/VehicleType
in classLoader:
org.apache.geronimo.kernel.classloader.TemporaryClassLoader#18878c7
at org.apache.xbean.finder.ClassFinder.(ClassFinder.java:177)
at org.apache.xbean.finder.ClassFinder.(ClassFinder.java:146)...
In web.xml I have reference to EJB:
<ejb-local-ref>
<ejb-ref-name>ejb/VehicleTypeAdmin</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local>manager.administration.vehicles.VehicleTypeAdmin</local>
<ejb-link>VehicleTypeAdminBean</ejb-link>
</ejb-local-ref>
EJB project has a reference to persistence project, and Web project has references to both projects. I don't get any compilation errors, so I suppose classes and references are correct.
I don't know if it is app server problem, but I ran previously application on the same server using same configuration parameters.
Does anybody have a clue what might be the problem?
Looks almost like it couldn't find the class manager.vehicles.VehicleType when it was attempting to create/load the class manager.administration.vehicles.VehicleTypeAdminBean.
I've encountered similar problems before. When the class loader attempts to load the class it looks at the import statements (and other class usage declarations) and then attempts to load those classes and so on until it reaches the bottom of the chain (ie java.lang.Object). If it cannot find one class along the chain (in your case it looks like it cannot load VehicleType) then it will state that it cannot load the class at the top of the chain (in your case VehicleTypeAdminBean).
Is the VehicleType class in a different jar? If you have a web module and and EJB module do you have the jar containing the VehicleType class in the appropriate place(s). Sometimes with web projects you have to put the jars in the WebContent/WEB-INF/lib folder or it won't find them.
Are both of these projects deployed separately (ie. two ears? or one ear and one war?) or are they together (ie, one ear with jars and a war inside?). I'm assuming the second given you declared your EJB local?
The jars that you are dependent on also have to be declared in your MANIFEST.MF files in the projects that use it.
I'm kind of running on guesses since I do not know your project structure. Showing that would help quite a bit. But I'd still check on where VehicleType is located with regards to your EJB class. You might find it isn't where you think it is come packaging or runtime.
Thanks #Chris for WebContent/WEB-INF/lib idea ! it works for me by following these steps :
1- Export my EJBs to a JAR (MyEJBs.jar)
2- I created another jar with your_installation_path/IBM/SDP/runtimes/your_version/binCreateEJBStrub.bat via CMD.exe, by executing this command :
createEJBStubs.bat <my_path>/MyEJBs.jar -newfile –quiet
3- A new jar will be automatically created in the same directory as MyEJBs.jar named MyEJBs_withStubs.jar
4- Put your new jar in WebContent/WEB-INF/lib
5- Call your EJBs by :
MyEJBRemote eJBRemote;
InitialContext ic = new InitialContext();
obj = ic.lookup("your_ejb_name_jndi");
eJBRemote = (MyEJBRemote ) PortableRemoteObject.narrow(obj,
MyEJBRemote.class);
eJBRemote = (MyEJBRemote ) obj;
Now you can call your EJBs from another EAR