wood burning stoves 2.0*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes EJB application deployment problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "EJB application deployment problem" Watch "EJB application deployment problem" New topic
Author

EJB application deployment problem

Garlapati Ravi
Ranch Hand

Joined: Mar 05, 2008
Posts: 171
Hi All,

I am dying to deploy/run a simple EJB application.

I belive i got correct application server to deploy EJB3.0 application, i am using jboss-4.2.1.GA, from it's release notes i came to know it supports EJB3.0, please find the below link for that info.
http://sourceforge.net/project/shownotes.php?release_id=523619&group_id=22866

now my question is, why i am getting the below error at the time of deployment ?
DEBUG - 2008-08-13 09:51:12,215 [main] ejb.EJBDeployer (create:593) - Verifying file:/C:/jboss-4.2.1.GA/server/MigrationDomain/tmp/deploy/tmp27658PlaceBid.ear-contents/PlaceBidEJB.jar
WARN - 2008-08-13 09:51:12,247 [main] EJBDeployer.verifier (specViolation:588) - EJB spec violation:
Bean : PlaceBidBean
Section: 7.10.2
Warning: A Session bean must implement, directly or indirectly, the javax.ejb.SessionBean interface.

WARN - 2008-08-13 09:51:12,247 [main] EJBDeployer.verifier (specViolation:588) - EJB spec violation:
Bean : PlaceBidBean
Section: 7.10.3
Warning: A Session bean must define at least one ejbCreate method.

WARN - 2008-08-13 09:51:12,247 [main] EJBDeployer.verifier (specViolation:588) - EJB spec violation:
Bean : PlaceBidBean
Section: 7.10.1
Warning: The session bean must implement either a remote home and remote, or a local home and a local interface.

DEBUG - 2008-08-13 09:51:12,262 [main] util.NestedThrowable (create:977) - org.jboss.util.NestedThrowable.parentTraceEnabled=true
DEBUG - 2008-08-13 09:51:12,262 [main] util.NestedThrowable (create:977) - org.jboss.util.NestedThrowable.nestedTraceEnabled=false
DEBUG - 2008-08-13 09:51:12,262 [main] util.NestedThrowable (create:977) - org.jboss.util.NestedThrowable.detectDuplicateNesting=true
ERROR - 2008-08-13 09:51:12,247 [main] deployment.MainDeployer (create:977) - Could not create deployment: file:/C:/jboss-4.2.1.GA/server/MigrationDomain/tmp/deploy/tmp27658PlaceBid.ear-contents/PlaceBidEJB.jar
org.jboss.deployment.DeploymentException: Verification of Enterprise Beans failed, see above for error messages.
at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:610)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
DEBUG - 2008-08-13 09:51:12,262 [main] scanner.URLDeploymentScanner (deploy:429) - Failed to deploy: org.jboss.deployment.scanner.URLDeploymentScanner$DeployedURL@3eaa71bb{ url=file:/C:/jboss-4.2.1.GA/server/MigrationDomain/deploy/PlaceBid.ear, deployedLastModified=0 }
org.jboss.deployment.DeploymentException: Verification of Enterprise Beans failed, see above for error messages.
at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:610)
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:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)

i suspect this server follows EJB2.0 specification, but how come it's release notes specifies it supports EJB3.0, do i need to modify any thing in my code to make it work. Please help me out.
please find my code in below post, unfortunately it has been moved to BEA/weblogic category.
http://www.coderanch.com/t/421092/BEA-Weblogic/unable-deploy-EJB-component

Requesting for help.
[ August 13, 2008: Message edited by: Garla Ravi ]

Ravi Kumar
SCWCD 5 - 89%, SCJP 1.4 - 90%
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10205
    
166

JBoss-4.2.1 does support EJB3. Post the output of the following commands:



and



Also post the contents of your application.xml. In your PlaceBidEJB.jar do you have a ejb-jar.xml? (Its not mandatory).

P.S: The latest stable version of JBoss is 4.2.3 GA. Its always better to use the latest stable version. But as far as this error is concerned, it's not because of the JBoss version.


[My Blog] [JavaRanch Journal]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10205
    
166

Also post the entire logs, that you see on the console (from the point when you start JBoss). While posting logs or xml content or code, remember to wrap it in a code block.
Garlapati Ravi
Ranch Hand

Joined: Mar 05, 2008
Posts: 171
Thank you very much Jaikiran,

i think i am nearing, it deployed properly after removing ejb-jar.xml. But i am unable to access the application, i got below exception on browser :

META-INF/
META-INF/MANIFEST.MF
META-INF/application.xml
PlaceBidEJB.jar
PlaceBidWeb.war

META-INF/
META-INF/MANIFEST.MF
com/
com/ravi/
com/ravi/bidding/
com/ravi/bidding/ejb/
com/ravi/bidding/ejb/PlaceBid.class
com/ravi/bidding/ejb/PlaceBidBean.class
PlaceBid.java
PlaceBidBean.java
Also post the entire logs, that you see on the console (from the point when you start JBoss).

[ August 13, 2008: Message edited by: Garla Ravi ]
Garlapati Ravi
Ranch Hand

Joined: Mar 05, 2008
Posts: 171
application.xml

web.xml


URL i am using to access the application :

[ August 13, 2008: Message edited by: Garla Ravi ]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10205
    
166

The logs dont show that the WAR files in the EAR is being deployed. Your application.xml looks incorrect:


It should be:



Change the application.xml and redeploy the application.
Sergio Tridente
Ranch Hand

Joined: Mar 22, 2007
Posts: 329

Are you sure your web application gets deployed without problems? Are there any log files where you can check that out (I am running JBoss under Linux and my logs are printed to a file instead of to the console)?
If you can't find more log information then you could try checking JBoss' jmx-console.

Also it would be useful if you post the PlaceBidServlet code.


SCJP 1.4 (88%) - SCJP 5.0 Upgrade (93%) - SCWCD 1.4 (97%) - SCBCD 5.0 (98%)
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

unfortunately it has been moved to BEA/weblogic category

Please understand that containers problems should be discussed at their respective forum, where you'll have more chances to find help.


[My Blog]
All roads lead to JavaRanch
Garlapati Ravi
Ranch Hand

Joined: Mar 05, 2008
Posts: 171
Thank you Jaikiran,

one step away.

After changing application.xml i could able to access my application, i think now it deployed properly, but i believe lookup is not happening, i guess EJBs are not registered with JNDI. what else need to be done. please help. I had a look in to log file, no exceptions regarding EJBs deployment.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10205
    
166

java.lang.NullPointerException
at com.ravi.bidding.PlaceBidServlet.service(PlaceBidServlet.java:14)


The NullPointerException is coming from the PlaceBidServlet code. Post the code of the service method. Check what line number 14 is doing in that code.
[ August 14, 2008: Message edited by: Jaikiran Pai ]
Garlapati Ravi
Ranch Hand

Joined: Mar 05, 2008
Posts: 171
you can find all classes coding in the below post:
http://www.coderanch.com/t/421092/BEA-Weblogic/unable-deploy-EJB-component

my servlet code is as below:
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10205
    
166

@EJB
private com.ravi.bidding.ejb.PlaceBid placeBid;


In JBoss-4.2.x, the @EJB injection does not work in servlets. It works only in EJBs. JBoss-5 (which is still in a CR version) is a JavaEE5 server and the @EJB injection in servlets is going to work in JBoss-5 versions.

Your alternate option is to do a JNDI lookup of the bean in your service method instead of injecting it.
Garlapati Ravi
Ranch Hand

Joined: Mar 05, 2008
Posts: 171
Thank you for your info, I wrote below code in servlet to lookup EJB. It throws an exception:

I doubt whether EJBs are registered in JNDI, any clues ?
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10205
    
166

You are using an incorrect jndi name for looking up the bean. Use the jmx-console to figure out the jndi-name of your bean and then use that string in the lookup().
Garlapati Ravi
Ranch Hand

Joined: Mar 05, 2008
Posts: 171
I didn't find anything regarding PlaceBidEJB.jar nor about EJB class name, everywhere i could see about PlaceBidWeb.war or PlaceBid.ear, but nothing about .jar file.

even checked for JNDI in complete jmx-console, no use. nothing about PlaceBid

did Ctrl+F for strings "PlaceBid" and "Place", everywhere it shows about web, nothing found about EJB/.jar file.

followed the steps in jmx-console link. no use.

anything else ?

please find below lines on my jboss console, nothing about .jar/EJB.

These are the lines i found on console regarding my application, don't find anything else. I belive it supposed to show something about .jar/ejb as well right ?

Any clues ?
[ August 15, 2008: Message edited by: Garla Ravi ]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10205
    
166

Post the code of your beans. Have you annotated them appropriately?
Garlapati Ravi
Ranch Hand

Joined: Mar 05, 2008
Posts: 171
you could find all classes of my application at below post:
http://www.coderanch.com/t/421092/BEA-Weblogic/unable-deploy-EJB-component
[ August 15, 2008: Message edited by: Garla Ravi ]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10205
    
166

From your other thread:

import javax.ejb30.Stateless;
@Stateless
....

import javax.ejb30.Local;
@Local
...


The imports are wrong. It should be javax.ejb.Stateless and same for the rest of the other imports. Where did you get that example from? I am surprised that it even compiled, unless ofcourse you created the javax.ejb30 package or is present in some jar in your application.
John Kristin
Greenhorn

Joined: Sep 19, 2007
Posts: 13
Guys,

This is useful link to start EJB3.0 (By MZ)
http://java.boot.by/scbcd5-guide/apa.html
Garlapati Ravi
Ranch Hand

Joined: Mar 05, 2008
Posts: 171
You spot it correct man, thank you, i believe EJB module got deployed, but i am unable to trace out JNDI name, can we trace JNDI name from below log comments made on jboss console at deployment time, i was looking into jmx-console, i found MBean: jboss.j2ee:ear=PlaceBid.ear,jar=PlaceBidEJB.jar,name=PlaceBidBean,service=EJB3
any clues from this ?
I am using PlaceBidEJB by guessing it could be my JNDI name, but it throws me same exception :


I got javax.ejb30.* package from weblogic.jar of weblogic9.1, i removed it and replaced it with jboss-ejb3x.jar
[ August 15, 2008: Message edited by: Garla Ravi ]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10205
    
166

14:14:14,174 INFO [EJBContainer] STARTED EJB: com.ravi.bidding.ejb.PlaceBidBean ejbName: PlaceBidBean


So now the bean has been deployed.

Follow this link again, access the JNDIView MBean and invoke the list method. Post the output that you see on the JNDI tree page, here.
Garlapati Ravi
Ranch Hand

Joined: Mar 05, 2008
Posts: 171
I found lots of things, but i am posting only related to my application:

Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10205
    
166

+- PlaceBid (class: org.jnp.interfaces.NamingContext)
| +- PlaceBidBean (class: org.jnp.interfaces.NamingContext)
| | +- local (proxy: $Proxy65 implements interface com.ravi.bidding.ejb.PlaceBid,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)



Based on this, your lookup string should be "PlaceBid/PlaceBidBean/local" to get the local bean.
Garlapati Ravi
Ranch Hand

Joined: Mar 05, 2008
Posts: 171
Thank You very much 'Jaikiran Pai'. Happiest moment of the month. I could successfully deployed and accessed my first EJB3.0 application. If this doesn't work by any reason, i would have disappointed. I learned many things.

you are equally good at JBOSS as well, that's really cool.

thank you once again !
[ August 15, 2008: Message edited by: Garla Ravi ]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10205
    
166

Glad to know it worked
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB application deployment problem