• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Problem: creating EJBs in Client in Weblogic7.0  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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>
...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!