*
The moose likes Servlets and the fly likes Urgent help needed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Urgent help needed" Watch "Urgent help needed" New topic
Author

Urgent help needed

Gopal
Greenhorn

Joined: Sep 04, 2002
Posts: 7
I am a newbie to java technology.
i am creating java applications using visualage for java.
I have a EJB created and tested in WTE of visualage for java(VAJ) is working fine.
I have a servlet which is also developed in VAJ is also working fine.
When i am trying to call the EJB from the servlet, it does not show any error while creating the objects of the bean.
But when i am running it, it shows a Null pointer exception.
Both the EJB and servlet are in the same package.
Please help me in get rid of this problem by providing a solution to this.
If possible please provide me the exact syntax to call a EJB from servlet through a sample code which i can run on VAJ.
Ta Ri Ki Sun
Ranch Hand

Joined: Mar 26, 2002
Posts: 442
post the code you have now, only the relevant bits, ie bean creation from servlet, i'll see if i can help
maybe also post the stack trace
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
BtsGopal
Welcome to the JavaRanch! Please adjust your display name to meet
the JavaRanch Naming Policy. You can change it here.
Thanks!
and welcome to the JavaRanch!
Gopal
Greenhorn

Joined: Sep 04, 2002
Posts: 7
here is my servler coding
-------------------------
System.setProperty("java.naming.factory.initial","com.ibm.ejs.ns.jndi.CNInitialContextFactory");
System.setProperty("java.naming.provider.url","iiop://localhost:900/");
InitialContext jndiContext= new InitialContext();
Object ref= jndiContext.lookup("com/ibm/ivj/wte/samples/leapyear/loginHome");
loginHome home=(loginHome) PortableRemoteObject.narrow(ref,loginHome.class);
login loged= home.create();
loged.testMethod();
The exceptions are handled perfectly.
The bean coding (the method that i have called)is here
System.out.println("just a try");
It does not shown any error while creating the object of the bean. but it gives the following exception
Error 500
An error has occured while processing request:http://localhost:8080/servlet/com.ibm.ivj.wte.samples.leapyear.usebean
Message: Server caught unhandled exception from servlet [com.ibm.ivj.wte.samples.leapyear.usebean]: null
the <ejb-ref> in web.xml is set as follows
<ejb-ref>
<description>The test of java bean</description>
<ejb-ref-name>com/ibm/ivj/wte/samples/leapyear/login
</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>loginhome</home>
<remote>login</remote>
</ejb-ref>
please reply for this as quick as possible.
with thanks,
Gopal
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Urgent help needed
 
Similar Threads
classpaths for servlets
calling EJB from servlet in visualage for java
EJB and servlet question....
Don't find EJB tab on VAJ...
JSP Execution Monitor