Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Not able to locate Session bean thru sar

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

I have a abc1.sar file which calls a POJO --> abc.java which inturns calls SessionBean.
In jboss-service.xml I have an etry like:
<server>
<MyMbean code="abc"
name="abc">
</MyMbean>
</server>

My problem is :
If I deploy abc1.jar --> It calls session Bean & it works fine
But the moment I make abc1.sar & deploys the application I get following error:
javax.naming.NameNotFoundException: ejb not bound

In short, when renamed as SAR file the way I want it, it is not able to locate Session Bean!

Can you please help?

Thanks,
Ameeta
 
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well couldn't you seperate out the EJB side from the service side and have two deployments 1. the sar and the other a jar or ear. Think of it like the Tomcat sar. Would you include all your Servlets in that sar? No you wouldn't you have seperate applications.

I think that is probably the best OO approach, in that other services and applications can now all access the EJB without always having to go through the service.

Mark
 
Amee Dabo
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As I need to pass a parameter from my start() method of my MBean to EJB;
I want to call sessionbean in the same sar file only.
I know that EJB Container needs to get called prior to MBean service. But just not getting how this can be done!! Tried in many ways but was of no use..
Can anybody help please..
Thanks in advance,
-Ameeta
 
Mark Spritzler
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Funny thing, last night I was reading the JBoss Admin book, and was reading about creating MBeans and how some MBeans are dependant on EJBs being already deployed. Now I don't remember the exact part, but I do know that there is a dependcy with the Naming service, so in your XML you use a depends tag. If you have the book, it is near page 100, and you can download the PDF from jboss.org website.

I don't have the book with me right now. And of course, since I just read it, I don't remember the exact details.

Mark
 
Mark Spritzler
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually page 128 to be exact. In the depends tag service=ejb, and the jndi name of the Bean in the JNDI service. The depends is not on Naming but on ejb.

Mark
 
Amee Dabo
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot..

But still I am getting an error:

My jboss-service.xml is as follows:

<server>
<mbean code="com.gameteclabs.bizlogic.workflow.CheckForDraw" name="com.gameteclabs.bizlogic.workflow:service=CheckForDraw"> <depends>jboss.j2ee:service=EJB,jndiName=ejb/ADMDrawResults1Bean</depends> </mbean>
</server>

When I run sar file it gives me following error:

--- MBeans waiting for other MBeans ---
ObjectName: com.gameteclabs.bizlogic.workflow:service=CheckForDraw
State: CONFIGURED
I Depend On:
jboss.j2ee:service=EJB,jndiName=ejb/ADMDrawResults1Bean

--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: jboss.j2ee:service=EJB,jndiName=ejb/ADMDrawResults1Bean
State: NOTYETINSTALLED
Depends On Me:
com.gameteclabs.bizlogic.workflow:service=CheckForDraw

I dont know where I am going wrong!

Please help me!!
Thanks,
Ameeta
 
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
Have a look at:

How can a MBean depend on a Session Bean
 
Amee Dabo
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jaikiran..I referred to same link before & it worked.
Thanks Mark for your note too..I have seperated out ejb from sar.
But sar is working when I invoke start method in JMX console manually.
Actually it should run start method continuously & automatically..
Ranchers..any idea how to achieve this?
Thanks,
Ameeta
 
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

Originally posted by Amee Dabo:
Actually it should run start method continuously & automatically..



I agree that the start should be called automatically, but i did not get what you mean by continuously. The start method will be called only once when the MBean is deployed.

How is your sar packaged? Did you try out by putting a System.out.println message in the start method to check whether that method is invoked when the MBean is deployed?
 
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
Here's one of the example MBean on JBoss:

HelloWorldMBean in JBoss

See if it helps
 
The harder I work, the luckier I get. -Sam Goldwyn So tiny. - this ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic