aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes how to get the LOCAL interface of Session Bean form a application in the same JVM? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "how to get the LOCAL interface of Session Bean form a application in the same JVM?" Watch "how to get the LOCAL interface of Session Bean form a application in the same JVM?" New topic
Author

how to get the LOCAL interface of Session Bean form a application in the same JVM?

Jamy Wang
Ranch Hand

Joined: Sep 21, 2003
Posts: 83
I have a startup class in Weblogic Server, I want to get the LOCAL inteface of a Session Bean. I think they are in the same JVM...Maybe I can use the LOCAL EJB interface? If it is ok, something will be effective.
Anybody who could give me some advice or point out my fault?
Thank you very much!


Best Regards<br /> <br />SCJP1.4 SCJD1.4 SCEA
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
How about simply testing whether you can use local interfaces? (I think you can but I'm not sure) Besides, if your startup class only executes once during startup, the performance overhead of a remote interface shouldn't be a problem either.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Jamy Wang
Ranch Hand

Joined: Sep 21, 2003
Posts: 83
My startup class is a server for client. So it's meanful for accessing LOCAL interface.
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
Originally posted by james wang:
I have a startup class in Weblogic Server, I want to get the LOCAL inteface of a Session Bean. I think they are in the same JVM...Maybe I can use the LOCAL EJB interface? If it is ok, something will be effective.
Anybody who could give me some advice or point out my fault?
Thank you very much!

From what I can tell of WebLogic, if the startup class is not in the same *JAR* as the EJB it's accessing, it cannot use a local interface. Note that local interfaces do not mean "local to this JVM" or even "local to this container" but rather "local to this JAR" (ClassLoader context?). This is related to the fact that a CMR between two entity beans can exist if and only if the two beans are packaged into the same JAR.
That being said, I haven't used WebLogic's T3StartupDef class because it runs for the container -- not each EJB application deployed in the container. Instead, I created a SLSB called "StartupSessionEJB" and gave it an initial pool size of 1 and max pool size of 1 and then didn't publish it in JNDI. It's ejbCreate() method gets called once and bingo I'm home free.
Jamy Wang
Ranch Hand

Joined: Sep 21, 2003
Posts: 83

That being said, I haven't used WebLogic's T3StartupDef class because it runs for the container -- not each EJB application deployed in the container. Instead, I created a SLSB called "StartupSessionEJB" and gave it an initial pool size of 1 and max pool size of 1 and then didn't publish it in JNDI. It's ejbCreate() method gets called once and bingo I'm home free.

How to create a SLSB and give it an initial and max pool size?
How can I call ejbCreate() method when the Application Server start?
Thanks a lot!!
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
Originally posted by james wang:
How to create a SLSB and give it an initial and max pool size?
How can I call ejbCreate() method when the Application Server start?

Specifying the initial and maximum pool sizes is vendor-specific. I'm using XDoclet to generate our WebLogic deployment descriptors, but here's the resulting block from weblogic-ejb-jar.xml.

As for calling ejbCreate() on the bean, the container does this as part of filling the free pool with initial beans -- one in this case.
Jamy Wang
Ranch Hand

Joined: Sep 21, 2003
Posts: 83
Hi, David Harkness. Thank you very much!!
I have just another question, how to describe the pool size in JBOSS?
Thank you again!
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
Originally posted by james wang:
Hi, David Harkness. Thank you very much!!
I have just another question, how to describe the pool size in JBOSS?
Thank you again!

I'm always glad to help. Unfortunately I have never used JBoss before. You might try a JBoss-specific forum or mailing list.
Good luck!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to get the LOCAL interface of Session Bean form a application in the same JVM?