Win a copy of Murach's MySQL this week in the JDBC and Relational Databases 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem: creating EJBs in Client in Weblogic7.0

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an architecture where I use a java class for creating an ejb. This java class is called from a jsp. Now, in the class, I am
creating an ejb in the following manner. However, i get a peculiar problem:
When running the code, it only runs till the statement "Debug 1(which prints out the following stmnt.)", and then absolutely nothing happens. Even trying to catch
a generic Exception yields nothing.
Debug 1- ... ejb.MoveMosBean_krugnk_HomeImpl@92023
Thanks in advance for your help.

try {
MoveMosUtil.log("making connection to SecureWay directory");
//empty contructor used to initialise bean
//InitialContext initial = getInitialContext();
InitialContext initial = new InitialContext();
Object objref = initial.lookup("java:comp/env/ejb/MoveMos");
System.out.println("Debug 1 - objref looked up :" + objref.toString());
MoveMosHome home = (MoveMosHome)PortableRemoteObject.narrow(objref, MoveMosHome.class);
System.out.println("Debug 2 - home initialised");
remote = (MoveMosRemote) home.create();
System.out.println("Debug 3 - remote variable initilised and connection to SecureWay Created");
}
catch (ClassCastException x)
{MoveMosUtil.log("ERROR - Class cast exception thrown");
x.printStackTrace();
}
catch (LinkException x)
{MoveMosUtil.log("ERROR - Couldn't get MoveMos home: ["+x.getLinkResolvedName()+" resolved, "+x.getLinkRemainingName()+" remaining]. Explanation: "+x.getLinkExplanation());
throw new EJBException("ERROR - Couldn't get MoveMos home: ["+x.getLinkResolvedName()+" resolved, "+x.getLinkRemainingName()+" remaining]. Explanation: "+x.getLinkExplanation());
}
catch (NamingException x)
{MoveMosUtil.log("ERROR - Couldn't get MoveMos home ["+x.getClass().getName()+"]: "+x.getMessage());
throw new EJBException("ERROR - Couldn't get MoveMos home ["+x.getClass().getName()+"]: "+x.getMessage());
}
catch (CreateException x)
{MoveMosUtil.log("ERROR - Couldn't get MoveMos. "+x.getMessage());
throw new EJBException("ERROR - Couldn't get MoveMos. "+x.getMessage());
}
catch (Exception e) {
MoveMosUtil.log("Error in makeConnection procedure");
e.printStackTrace();
}

The .xmls are as follows:
web.xml:
=======
...
<ejb-ref>
<ejb-ref-name>ejb/MoveMos</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>ejb.MoveMosHome</home>
<remote>ejb.MoveMosRemote</remote>
</ejb-ref>
...
WEBLOGIC.XML:
=============
...
<reference-descriptor>
<ejb-reference-description>
<ejb-ref-name>ejb/MoveMos</ejb-ref-name>
<jndi-name>ex-MoveMos/MoveMosBean</jndi-name>
</ejb-reference-description>
...
ejb-jar.xml:
===========
<ejb-jar>
<enterprise-beans>
<session>
<display-name>MoveMosBean</display-name>
<ejb-name>MoveMosBean</ejb-name>
<home>ejb.MoveMosHome</home>
<remote>ejb.MoveMosRemote</remote>
<ejb-class>ejb.MoveMosBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
weblogic-ejb-jar.xml:
=====================
<weblogic-enterprise-bean>
<ejb-name>MoveMosBean</ejb-name>
<stateless-session-descriptor>
<pool>
<max-beans-in-free-pool>1</max-beans-in-free-pool>
<initial-beans-in-free-pool>1</initial-beans-in-free-pool>
</pool>
</stateless-session-descriptor>
<jndi-name>ex-MoveMos/MoveMosBean</jndi-name>
</weblogic-enterprise-bean>
...
 
That's my roommate. He's kinda weird, but he always pays his half of the rent. And he gave me this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic