-
15. Re: ClassNotFoundException using EJB in RESTfull Application
jaikiran Jan 12, 2012 1:40 PM (in response to jaikiran)You also have a web.xml. So please post the contents of that file too.
-
16. Re: ClassNotFoundException using EJB in RESTfull Application
h3llghost Jan 12, 2012 1:47 PM (in response to jaikiran)Here the javap output:
Compiled from "RESTService.java" public class de.h3llghost.service.RESTService extends javax.ws.rs.core.Application { protected static java.util.ResourceBundle includeBundle; protected de.h3llghost.data.DataAccessObjectRemote dao; static {}; public de.h3llghost.service.RESTService(); public java.util.Set<java.lang.Class<?>> getClasses(); public java.util.Set<java.lang.Object> getSingletons(); public static java.lang.String getOption(java.lang.String); }
Here my web.xml:
<?xml version="1.0" encoding="UTF-8"?> <web-app id="WebApp_ID" version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> <display-name>FrontEndJSON</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> </web-app>
-
17. Re: ClassNotFoundException using EJB in RESTfull Application
jaikiran Jan 12, 2012 1:58 PM (in response to h3llghost)Hmm, I can't think of what's wrong then. By the way, how exactly are you deploying this application? And from where are you getting the output of these commands? From the JBOSS_HOME/standalone/deployment folder? You mentioned earlier that you are using an IDE. What happens if you keep aside the IDE and instead start the server manually and deploy (a clean version of) the application manually by placing it in JBOSS_HOME/standalone/deployment folder?
-
18. Re: ClassNotFoundException using EJB in RESTfull Application
h3llghost Jan 12, 2012 2:08 PM (in response to jaikiran)I am using Eclipse with the JBoss Tools.
Now I have tried to deploy manually, start the server with the standalone.bat and copy the war files into the deployment folder.
Deployment works, but I got the same exception.
But what do you mean by clean version?
-
19. Re: ClassNotFoundException using EJB in RESTfull Application
jaikiran Jan 12, 2012 2:11 PM (in response to h3llghost)h3llghost wrote:
But what do you mean by clean version?
A version that is built afresh.
h3llghost wrote:
Deployment works, but I got the same exception.
It's failing during deploy right? Can you post the new exception stacktrace please?
-
20. Re: ClassNotFoundException using EJB in RESTfull Application
h3llghost Jan 12, 2012 2:23 PM (in response to jaikiran)A version that is built afresh.
Thanks.
It's failing during deploy right? Can you post the new exception stacktrace please?
No only if I call the service.
javax.servlet.ServletException: Servlet.init() for servlet de.h3llghost.service.RESTService threw exception
org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:151)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:897)
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:626)
org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2033)
java.lang.Thread.run(Unknown Source)
root cause
java.lang.NoClassDefFoundError: Lde/h3llghost/data/DataAccessObjectRemote;
java.lang.Class.getDeclaredFields0(Native Method)
java.lang.Class.privateGetDeclaredFields(Unknown Source)
java.lang.Class.getDeclaredFields(Unknown Source)
org.jboss.resteasy.core.PropertyInjectorImpl.populateMap(PropertyInjectorImpl.java:139)
org.jboss.resteasy.core.PropertyInjectorImpl.<init>(PropertyInjectorImpl.java:57)
org.jboss.resteasy.core.InjectorFactoryImpl.createPropertyInjector(InjectorFactoryImpl.java:50)
org.jboss.resteasy.spi.ResteasyDeployment.createFromInjectorFactory(ResteasyDeployment.java:280)
org.jboss.resteasy.spi.ResteasyDeployment.createApplication(ResteasyDeployment.java:259)
org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:220)
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:67)
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36)
org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:151)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:897)
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:626)
org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2033)
java.lang.Thread.run(Unknown Source)root cause
java.lang.ClassNotFoundException: de.h3llghost.data.DataAccessObjectRemote from [Module "deployment.BF3AccessRestrictionJSON.war:main" from Service Module Loader]
org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
java.lang.Class.getDeclaredFields0(Native Method)
java.lang.Class.privateGetDeclaredFields(Unknown Source)
java.lang.Class.getDeclaredFields(Unknown Source)
org.jboss.resteasy.core.PropertyInjectorImpl.populateMap(PropertyInjectorImpl.java:139)
org.jboss.resteasy.core.PropertyInjectorImpl.<init>(PropertyInjectorImpl.java:57)
org.jboss.resteasy.core.InjectorFactoryImpl.createPropertyInjector(InjectorFactoryImpl.java:50)
org.jboss.resteasy.spi.ResteasyDeployment.createFromInjectorFactory(ResteasyDeployment.java:280)
org.jboss.resteasy.spi.ResteasyDeployment.createApplication(ResteasyDeployment.java:259)
org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:220)
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:67)
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36)
org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:151)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:897)
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:626)
org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2033)
java.lang.Thread.run(Unknown Source) -
21. Re: ClassNotFoundException using EJB in RESTfull Application
h3llghost Jan 17, 2012 7:53 AM (in response to h3llghost)There was an answer from someone, but it seems that it has been deleted. He has solved the problem by placing the exported ejb in the lib-folder, but it means finally I can't replace the backend without redeploying the frontend.
-
22. Re: ClassNotFoundException using EJB in RESTfull Application
jaikiran Jan 17, 2012 8:00 AM (in response to h3llghost)h3llghost wrote:
There was an answer from someone, but it seems that it has been deleted.
https://community.jboss.org/message/647150#647150
I re-read your thread again and no where did you mention that the .war and the ejb jar are separate deployments. Or did I miss it? That's a totally different usecase than what I thought the problem was. Can you please explain your application packaging more clearly?
-
23. Re: ClassNotFoundException using EJB in RESTfull Application
jaikiran Jan 17, 2012 8:02 AM (in response to jaikiran)jaikiran pai wrote:
I re-read your thread again and no where did you mention that the .war and the ejb jar are separate deployments. Or did I miss it?
I guess that's what you meant by:
I have a EJB project, which contains my entities and connecting to the database via hibernate.
My second project is the dynamic web project containing the classes.
I didn't understand it to be 2 different deployments.
So in this case, you'll have to package the business interfaces (no need of the bean impl) of the beans in a jar in your .war/WEB-INF/lib folder.
-
24. Re: ClassNotFoundException using EJB in RESTfull Application
h3llghost Jan 17, 2012 8:14 AM (in response to jaikiran)jaikiran pai wrote:
I didn't understand it to be 2 different deployments.
So in this case, you'll have to package the business interfaces (no need of the bean impl) of the beans in a jar in your .war/WEB-INF/lib folder.
Yeah I make two different deployments, it is the same problem, which Eric K. has.
Deploying all in one for example with an EAR all works fine.
I don't tested your explained way, but I think it will be work, because Eric K. has mentioned it before.