Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt about Local and Remote

 
Chaminda Amarasinghe
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Celinio Fernandes
Ranch Hand
Posts: 549
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
post your code if you want some significative help.
 
Chaminda Amarasinghe
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Mirko Bonasorte
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
Sergio Tridente
Ranch Hand
Posts: 329
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Chaminda Amarasinghe
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic