• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Error deploying EJB Model

 
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi guys,

I'm having real trouble deplying my ejb-jar.xml file onto my Sun WebApp Server 9.0

The file structure of the ejb module jar is:-
+module.jar
+meta-inf
-ejb-jar.xml
-Manifest.mf
+lib
-j2ee.jar
-ejb-3_0-api.jar
+com\myproject\sample1
-SampleRemote
-SampleLocal
-SampleModel

The ejb-jar.xml looks like this:
<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
JavaBeans 1.1//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd">

<ejb-jar>
<description>
Sample
</description>
<enterprise-beans>
<session>
<description>
Sample Bean for testing
</description>
<display-name>
SampleBean
</display-name>
<ejb-name>SampleModel</ejb-name>
<home>com.myproject.sample1.SampleLocal</home>
<remote>com.myproject.sample1.SampleRemote</remote>
<ejb-class>com.myproject.sample1.SampleModel</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>

And the error I get is:
[#|2007-10-06T11:39:16.544+0100|SEVERE|sun-appserver-pe9.0|javax.enterprise.system.tools.deployment|_ThreadID=17;_ThreadName=Thread-31;_RequestID=ae20b5ad-3d0d-4c6a-8009-e11a14b53e63;|Exception occured in J2EEC Phase
com.sun.enterprise.deployment.backend.IASDeploymentException: Error loading deployment descriptors for module [sample] -- Error processing EjbDescriptor
at com.sun.enterprise.deployment.backend.Deployer.loadDescriptors(Deployer.java:362)
at com.sun.enterprise.deployment.backend.AppDeployerBase.loadDescriptors(AppDeployerBase.java:327)
at com.sun.enterprise.deployment.backend.AppDeployer.explodeArchive(AppDeployer.java:332)
at com.sun.enterprise.deployment.backend.AppDeployer.deploy(AppDeployer.java:182)
at com.sun.enterprise.deployment.backend.AppDeployer.doRequestFinish(AppDeployer.java:129)
at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:169)
at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:95)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:871)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:266)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:739)
at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:174)
at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:210)
Caused by: java.lang.RuntimeException: Error processing EjbDescriptor
at com.sun.enterprise.deployment.util.EjbBundleValidator.accept(EjbBundleValidator.java:160)
at com.sun.enterprise.deployment.EjbDescriptor.visit(EjbDescriptor.java:2036)
at com.sun.enterprise.deployment.EjbBundleDescriptor.visit(EjbBundleDescriptor.java:674)
at com.sun.enterprise.deployment.Application.visit(Application.java:1734)
at com.sun.enterprise.deployment.archivist.ApplicationArchivist.validate(ApplicationArchivist.java:457)
at com.sun.enterprise.deployment.backend.Deployer.loadDescriptors(Deployer.java:342)
... 11 more
Caused by: java.lang.ClassNotFoundException: com.myproject.sample1.SampleModel
at com.sun.enterprise.loader.EJBClassLoader.findClassData(EJBClassLoader.java:697)
at com.sun.enterprise.loader.EJBClassLoader.findClass(EJBClassLoader.java:595)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at com.sun.enterprise.deployment.util.EjbBundleValidator.accept(EjbBundleValidator.java:117)
... 16 more
|#]


Any advice?

[ October 06, 2007: Message edited by: Keith Seller ]
[ October 06, 2007: Message edited by: Keith Seller ]
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Caused by: java.lang.ClassNotFoundException: com.myproject.sample1.SampleModel



Is this class present inside the module.jar ejb jar file? Can you post the output of the following:

- From the command prompt, move the folder containing module.jar
- Run the following command



Post the output here.
 
Kevin P Smith
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorted it, cheers!

My error, the classpath was wrong.
 
Kevin P Smith
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys

More problems with deploying EJB3.0 module!!!

I've created and EJB module/client simple sample system just to try out the basics (very basic) of EJB3.0, the classes were written/compiled in Eclipse-Europa using J2EE5 i took the java2ee.jar file from Sun's WebApp 9 (which I am using as my WebApp) so the classes were compiled using the same jar as the WebApp, the WAR & JAR both deployed OK (seemingly, but when I start-up the Web Server I get the following errors (the 3rd error comes when running the system, but I expect is related)...

Error 1:
[#|2007-10-08T13:06:41.360+0100|SEVERE|sun-appserver-pe9.0|javax.enterprise.system.core.classloading|_ThreadID=10;_ThreadName=main;_RequestID=1b7fb4d2-d492-46b6-9e3e-dc2234590025;|LDR5004: UnExpected error occured while creating ejb container
java.lang.NoSuchMethodException: com.myproject.sample1.SampleLocal.create()
at java.lang.Class.getMethod(Class.java:1581)
at com.sun.ejb.containers.BaseContainer.initializeEjbInterfaceMethods(BaseContainer.java:1467)
at com.sun.ejb.containers.BaseContainer.<init>(BaseContainer.java:622)
at com.sun.ejb.containers.StatelessSessionContainer.<init>(StatelessSessionContainer.java:163)
at com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:515)
at com.sun.enterprise.server.AbstractLoader.loadEjbs(AbstractLoader.java:486)
at com.sun.enterprise.server.EJBModuleLoader.load(EJBModuleLoader.java:158)
at com.sun.enterprise.server.AbstractManager.load(AbstractManager.java:206)
at com.sun.enterprise.server.ApplicationLifecycle.onStartup(ApplicationLifecycle.java:198)
at com.sun.enterprise.server.ApplicationServer.onStartup(ApplicationServer.java:326)
at com.sun.enterprise.server.ondemand.OnDemandServer.onStartup(OnDemandServer.java:112)
at com.sun.enterprise.server.PEMain.run(PEMain.java:326)
at com.sun.enterprise.server.PEMain.main(PEMain.java:260)
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 com.sun.enterprise.server.PELaunch.main(PELaunch.java:272)
|#]

[#|2007-10-08T13:06:41.360+0100|WARNING|sun-appserver-pe9.0|javax.enterprise.system.core|_ThreadID=10;_ThreadName=main;module;_RequestID=1b7fb4d2-d492-46b6-9e3e-dc2234590025;|CORE5021: Application NOT loaded: [module]|#]


----------
Error 2:
[#|2007-10-08T13:06:44.555+0100|INFO|sun-appserver-pe9.0|org.apache.catalina.loader.WebappClassLoader|_ThreadID=10;_ThreadName=main;|validateJarFile(C:\Java\Sun\AppServer\domains\domain1\applications\j2ee-modules\client\WEB-INF\lib\j2ee.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class|#]

----------
Error 3:
[#|2007-10-08T13:10:48.095+0100|INFO|sun-appserver-pe9.0|javax.enterprise.system.stream.out|_ThreadID=12;_ThreadName=httpWorkerThread-8080-1;|
Naming Exception: javax.naming.NameNotFoundException: No object bound to name java:/com/myproject/sample1/SampleModel|#]

I know it isn't much to go on but it's all the info I have.

Why does the SampleModel (Session bean) need this create Method?
Why dies the j2ee.jar file's Servlet.jar 'offend'?

Cheers for any help possible.

KS
 
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Keith,

Your ejb-jar.xml file is still using EJB 1.1 dtd, as a result your appserver is trying to call the create method of the EJB to create and instance and pool it. Also EJB 1.1 spec did not have support for EJB Local interfaces. You should change it to use ejb3.0 schema.

This is what your have now in ejb-jar.xml.
<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
JavaBeans 1.1//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd">

Change this to
<ejb-jar xmlns = "http://java.sun.com/xml/ns/javaee"
version = "3.0"
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/ejb-jar_3_0.xsd">

hope this helps.
 
Kevin P Smith
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cheers for that, that's really bad! I took the ejb-jar.xml from a sample tutorial online, so that's been there from the start (I never even bothered to look).

I sorted the Servlet.class error too (never ever deploy the j2ee.jar file to your webapp! :-D )

Unfortuneatley I still get the .create() error for the Home Interface (SampleLocal)

ejb-jar.xml looks like:
<ejb-jar xmlns = "http://java.sun.com/xml/ns/javaee" version="3.0" 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/ejb-jar_3_0.xsd">
<description>
Sample
</description>
<enterprise-beans>
<session>
<description>
Sample Bean for testing
</description>
<display-name>
SampleBean
</display-name>
<ejb-name>SampleModel</ejb-name>
<local>com.myproject.sample1.SampleLocal</local>
<local-home>com.myproject.sample1.SampleRemote</local-home>
<ejb-class>com.myproject.sample1.SampleModel</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
EJB3 no longer requires home/local-home interfaces. The ejb-jar.xml looks a bit incorrect:


<ejb-name>SampleModel</ejb-name>
<local>com.myproject.sample1.SampleLocal</local>
<local-home>com.myproject.sample1.SampleRemote</local-home>
<ejb-class>com.myproject.sample1.SampleModel</ejb-class>



Change it to:

 
Kevin P Smith
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<home> not <local>

<ejb-name>SampleModel</ejb-name>
<home>com.myproject.sample1.SampleLocal</home>
<remote>com.myproject.sample1.SampleRemote</remote>
<ejb-class>com.myproject.sample1.SampleModel</ejb-class>

But still get the same damn error!

Rapidly coming to the conclusion EJB3.0 is a pile of...!

If I can't even deploy the thing, how the hell are you meant to develop anythign with it?
[ October 08, 2007: Message edited by: Keith Seller ]
 
Shailesh Kini
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Keith,

Sorry you feel that way about EJB 3.0. It is very easy and definitely not a pile of ....!

Couple of questions before you completely give up on EJB 3.0.

Are you writing your own tutorial or was it downloaded from the internet?

If your project has SampleLocal and SampleRemote interfaces... I have to agree with Jai you need <local> and <Remote> tags. <home> tags were required for EJB2.1 and 2.0 and are provived for backward compatibility. A pure EJB 3.0 application would never need to use <home> interfaces.

An important feature of EJB 3.0 is the support for annotations. This relieves you from creating a deployment descriptor. You might want to look into it.
 
Kevin P Smith
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe not a pile (certainly seems an improvment on 2.1 - from what I can remember, 2001 I last used EJB)

But does seem very frustrating to set up.

It's also seems quite hard to find an accrate tutorial on EJB 3.0 (I prefer sites that just give working example I can build on).

this was a tutorial I found b ut it seems to have it's faults (obviously), as for the annotations, I've seen the annotations for @Remote/Local etc, but how can you completely eliminate the descriptor and is it wise (XMLs are easier to update than code on a working system).

-------------------------

Saying that, I have found a tutorial on JBoss whoch seems to work (minus the ejb-jar-xml) using @Remote/@Local annotations.

However there is still a problem with my 'lient' (Servlet in this case), which uses the following:

InitialContext ctx = new InitialContext();
SampleRemote remote = (SampleRemote) ctx.lookup("com.myproject.sample1.SampleModel/remote");

but I get this error:

[#|2007-10-08T22:49:49.707+0100|INFO|sun-appserver-pe9.0|javax.enterprise.system.stream.out|_ThreadID=19;_ThreadName=httpWorkerThread-8080-1;|
Naming Exception: javax.naming.NameNotFoundException|#]
[ October 08, 2007: Message edited by: Keith Seller ]
 
Shailesh Kini
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Keith,

You might want to try the petstore application at j-petstore. Petstore allways has been very simple to understand. Hope this get you started in the right direction.
 
Kevin P Smith
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Saying that, I have found a tutorial on JBoss which seems to work (minus the ejb-jar-xml) using @Remote/@Local annotations.

However there is still a problem with my 'Client' (Servlet in this case), which uses the following:

InitialContext ctx = new InitialContext();
SampleRemote remote = (SampleRemote) ctx.lookup("com.myproject.sample1.SampleModel/remote");

but I get this error:

[#|2007-10-08T22:49:49.707+0100|INFO|sun-appserver-pe9.0|javax.enterprise.system.stream.out|_ThreadID=19;_ThreadName=httpWorkerThread-8080-1;|
Naming Exception: javax.naming.NameNotFoundException|#]
[ October 08, 2007: Message edited by: Keith Seller ]
reply
    Bookmark Topic Watch Topic
  • New Topic