This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JBoss/WildFly and the fly likes Not able to locate Session bean thru sar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Not able to locate Session bean thru sar" Watch "Not able to locate Session bean thru sar" New topic
Author

Not able to locate Session bean thru sar

Amee Dabo
Ranch Hand

Joined: Dec 22, 2001
Posts: 74
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


Thanks..
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Amee Dabo
Ranch Hand

Joined: Dec 22, 2001
Posts: 74
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
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

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
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

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

Joined: Dec 22, 2001
Posts: 74
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
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10069
    
163

Have a look at:

How can a MBean depend on a Session Bean


[My Blog] [JavaRanch Journal]
Amee Dabo
Ranch Hand

Joined: Dec 22, 2001
Posts: 74
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
Marshal

Joined: Jul 20, 2005
Posts: 10069
    
163

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
Marshal

Joined: Jul 20, 2005
Posts: 10069
    
163

Here's one of the example MBean on JBoss:

HelloWorldMBean in JBoss

See if it helps
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Not able to locate Session bean thru sar