aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Doubt about Local and Remote 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 "Doubt about Local and Remote" Watch "Doubt about Local and Remote" New topic
Author

Doubt about Local and Remote

Chaminda Amarasinghe
Ranch Hand

Joined: May 17, 2006
Posts: 402
Hi All,

I have deployed an Ejb Local Interface on JBoss. I was unable to create a reference to the Ejb Local form a web application deployed on same Jboss instance. If Im not mistaken that is meant by "Same JVM"


I want to know is that possible or My understanding on "Same JVM" is in correct

I tried creating an EAR application and worked fine.

Thanks
Chaminda
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10207
    
166

Originally posted by Chaminda Amarasinghe:


I have deployed an Ejb Local Interface on JBoss. I was unable to create a reference to the Ejb Local form a web application deployed on same Jboss instance. If Im not mistaken that is meant by "Same JVM"


Yes, that's what is meant by same JVM. When you start JBoss (or any application server), it runs in its own JVM. So when you deploy applications to that server, they will be deployed in that JVM.

What error did you get while trying to use the local reference? And how were your application packaged?


[My Blog] [JavaRanch Journal]
Celinio Fernandes
Ranch Hand

Joined: Jun 28, 2003
Posts: 547

post your code if you want some significative help.


SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCBCD 5
Visit my blog
Chaminda Amarasinghe
Ranch Hand

Joined: May 17, 2006
Posts: 402
Hi All,

Thanks for the quick reply,

Here is my code,









************

How I deployed


packaged the ejb using netbeans,

made a lib reference to ejb package (inside dist folder) from web client for compilation of web (but that lib will not go to WEB-INF)

deployed ejb to <jboss>/server/default/deploy
deployed web clinet to <jboss>/server/default/deploy



*********************
output of server log

19:58:18,718 INFO [EJB3Deployer] Deployed: file:/usr/share/jboss-4.2.3.GA/jboss-4.2.3.GA/server/default/deploy/EjbTest.jar
19:58:43,777 INFO [TomcatDeployer] undeploy, ctxPath=/EJBWebClient, warUrl=.../tmp/deploy/tmp45013EJBWebClient-exp.war/
19:58:43,823 INFO [TomcatDeployer] deploy, ctxPath=/EJBWebClient, warUrl=.../tmp/deploy/tmp45015EJBWebClient-exp.war/
19:59:10,498 INFO [STDOUT] --- Calling the doGet Method
19:59:10,498 INFO [STDOUT] --- EJB is remote null
19:59:10,498 INFO [STDOUT] --- EJB is local null
19:59:10,499 ERROR [[EJBCaller]] Servlet.service() for servlet EJBCaller threw exception
java.lang.NullPointerException
at scwcd.web.controller.EJBCaller.doGet(EJBCaller.java:40)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)



**************************

The same application in Glassfish v2 works fine



your help greatly appreciate

Thanks
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9427
    
    2

I'm not sure how JBoss works, but with Weblogic I faced a similiar error where I missed out some entries in the weblogic-jar.xml and during deploy time, it threw me java.lang.NullPointer.


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Mirko Bonasorte
Ranch Hand

Joined: May 14, 2007
Posts: 244
Hi,
this is an application exception: it seems that EJB injection has not been applied.
Maybe your is web.xml is for Servlet container 2.4 ?


SCJP<br />SCWCD 1.4 Upgrade (Remember: me stupid)<br />SCWCD 1.4<br /><a href="http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html" target="_blank" rel="nofollow">SCBCD 5.0</a><br /><a href="http://www.enthuware.com" target="_blank" rel="nofollow">SCBCD 5.0 mock exam</a> <br /> <br />SCEA 5 Part1: Preparing...
Sergio Tridente
Ranch Hand

Joined: Mar 22, 2007
Posts: 329

Your code is just fine, the problem is with JBoss 4.2.x which is not J2EE 5 compliant (it is only EJB 3.0 compliant). The @EJB annotation will only work inside the EJB container, not inside the web container: injecting into a servlet works/will work from Jboss 5.x (still RC1) only.

My advice for you is to stick to Glassfish if your goal is to study for the exam.


SCJP 1.4 (88%) - SCJP 5.0 Upgrade (93%) - SCWCD 1.4 (97%) - SCBCD 5.0 (98%)
Chaminda Amarasinghe
Ranch Hand

Joined: May 17, 2006
Posts: 402
Hi All,

Thanks for your valuable comments,

With I have another issue, If I dont include interfaces jar into WEB-INF/lib (or server lib) it throws class not found exception (I deployed webapp after the ejb)

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt about Local and Remote