- This topic has 6 replies, 3 voices, and was last updated 16 years, 9 months ago by Diederik.
-
AuthorPosts
-
DiederikMemberHello,
I’m new to creating EJBs and need to create one for Java 1.4.2, so it needs to be an EJB2 project.
I followed the tutorial in the documentation about it using XDoclet. In the business logic method I added to it, I used an object whose definition is in a jar file. So I added the jar file (and a couple of others) to my project.
But when I try to deploy it to JBoss (4.0.3SP1) I get an error that it can’t find the class for the object I used.What do I need to do so the jar files added to the project are part of the deployment, so that it will find the class?
Is XDoclet the preferred way to create EJB2 beans in MyEclipse, or should I use another technology for it?
I’m using MyEclipse 6.01
Riyad KallaMemberPietjePuk,
You need to create a Enterprise Application Project (J2EE 1.4) and drop the JAR into the root of the EAR project. When it gets deployed, the class-loader rules for an EAR will expose it’s JARs to all modules, 1 of which will have to be your EJB project
DiederikMemberThanks, will do that.
harryajhMemberhaving a similar problem, can someone please confirm/reject if I have understood this correctly?
If I wanted to deploy a self-contained (by this I mean all the jar files it uses are deployed with it!) do I HAVE to create an Enterprise app, add the EJB module to it, move the jars files to the root of the app & specify which ones I want to use in the EJB’s META-INF\MANIFEST.MF file
So unlike a WAR file you cannot simply creating an EJB project & deploy just that to the server, you have to package it up WITHIN and EAR file?
thanks in advance
harry
DiederikMemberI’ve tried what you said, but I’m getting an error while deploying
I’ve created an Enterprise Application Project, called DJServices and put the jar files needed by the EJB in the root of that project.
I’ve created a EJB project, with the create EAR project wizard, called DJServicesEJB and in that I’ve created an EJB2 Stateful Session Bean object called ‘Zaak’ (Case).
Added my own parametrized ejbCreate method and changed the default generator business method to return a (String) property value of the ‘Zaak’ object.
I’ve done that by following the ‘MyEclipse EJB 2.x Tutorial (Using XDoclet)’ from the help, but changed the version of JBoss to 4.0, since I’m using JBoss 4.03SP1 and it said to set the specification level to J2EE 1.3, but I choose J2EE 1.4.When I’m trying to deploy DJServices to JBoss it does it’s thing and reports that the deployment was successful.
But the console seems to indicate otherwise:17:25:01,203 INFO [EARDeployer] Init J2EE application: file:/D:/jboss403SP1/server/default/deploy/DJServices.ear/ 17:25:01,265 ERROR [MainDeployer] Could not initialise deployment: file:/D:/jboss403SP1/server/default/deploy/DJServices.ear/ org.jboss.deployment.DeploymentException: url file:/D:/jboss403SP1/server/default/deploy/DJServices.ear/DJServicesEJB.jar could not be opened, does it exist? at org.jboss.deployment.DeploymentInfo.<init>(DeploymentInfo.java:191) at org.jboss.deployment.EARDeployer.init(EARDeployer.java:235) at org.jboss.deployment.MainDeployer.init(MainDeployer.java:843) at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:780) at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:753) at sun.reflect.GeneratedMethodAccessor51.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) 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.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 $Proxy9.deploy(Unknown Source) at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:319) at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:507) at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:192) at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:203) at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:182) 17:25:06,265 INFO [EARDeployer] Init J2EE application: file:/D:/jboss403SP1/server/default/deploy/DJServices.ear/ 17:25:06,734 WARN [EJBDeployer] Verify failed; continuing java.lang.NoClassDefFoundError: com/filenet/wcm/api/PropertyNotFoundException at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:1655) at java.lang.Class.privateGetPublicMethods(Class.java:1778) at java.lang.Class.getMethods(Class.java:832) at org.jboss.verifier.strategy.AbstractVerifier.hasEJBCreateMethod(AbstractVerifier.java:664) at org.jboss.verifier.strategy.EJBVerifier20.verifySessionBean(EJBVerifier20.java:834) at org.jboss.verifier.strategy.EJBVerifier20.checkSession(EJBVerifier20.java:64) at org.jboss.verifier.BeanVerifier.verify(BeanVerifier.java:166) at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:559) 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:324) 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) at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:753) at sun.reflect.GeneratedMethodAccessor51.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) 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.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 $Proxy9.deploy(Unknown Source) at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:319) at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:489) at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:192) at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:203) at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:182) 17:25:06,734 ERROR [MainDeployer] Could not create deployment: file:/D:/jboss403SP1/server/default/deploy/DJServices.ear/DJServicesEJB.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:324) 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) at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:753) at sun.reflect.GeneratedMethodAccessor51.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) 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.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 $Proxy9.deploy(Unknown Source) at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:319) at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:489) at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:192) at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:203) at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:182)
What am I missing / what did I do wrong?
The PropertyNotFoundException class is referenced in the EJB project and the jar file containing it’s implementation is one of the jar files which I put in the root of the EAR project.
Changing the PropertyNotFoundException (caught inside 2 methods) to a regular Exception resulted in another NoClassDefFoundError but then on another object which is referenced by the EJB project and that jar file is the same jar file which I put in the root of the EAR project.
DiederikMember@harryajh wrote:
do I HAVE to create an Enterprise app, add the EJB module to it, move the jars files to the root of the app & specify which ones I want to use in the EJB’s META-INF\MANIFEST.MF file
Can you elaborate on that part?
Cause I didn’t modify my META-INF/MANIFEST.MF file and maybe that’s causing my problem.
DiederikMember@PietjePuk wrote:
@harryajh wrote:
do I HAVE to create an Enterprise app, add the EJB module to it, move the jars files to the root of the app & specify which ones I want to use in the EJB’s META-INF\MANIFEST.MF file
Can you elaborate on that part?
Cause I didn’t modify my META-INF/MANIFEST.MF file and maybe that’s causing my problem.And that was indeed what caused the problem.
Specifying all those jar files in the Class-Path: line of the MANIFEST.MF of the EJB solved the problem 🙂 -
AuthorPosts