File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Very frustrating....please help (Weblogic 5.1.0) 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 "Very frustrating....please help (Weblogic 5.1.0)" Watch "Very frustrating....please help (Weblogic 5.1.0)" New topic
Author

Very frustrating....please help (Weblogic 5.1.0)

Sanjeev Verma
Ranch Hand

Joined: Aug 24, 2000
Posts: 87
Hi friends
I am a newbie to the world of EJB/Weblogic. I have successfully deployes a entity bean with cmp in Weblogic5.1.0 (or at least the EJB Deployer and console says so!!!). However, I am not able to access it with the client. given below is the relevant code of the client:
import javax.naming.*;
import javax.rmi.*;
import java.util.*;
import javax.ejb.*;
import java.rmi.*;
import com.sanjeev.ejb.*; //The package where all bean classes reside. This jar file is placed in the classpath.
public class CabinClient
{
public static void main(String args[])
{
try
{
Hashtable p=new Hashtable();
p.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
p.put(Context.PROVIDER_URL,"t3://localhost:7001");
Context jndiContext=new InitialContext(p);
Object ref=jndiContext.lookup("Cabin");//<--HERE
/*CabinHome home=(CabinHome)PortableRemoteObject.narrow(ref,CabinHome.class);
Cabin cabin_1=home.create(1);
cabin_1.setName("Master Suite");
cabin_1.setDeckLevel(1);
cabin_1.setShip(1);
cabin_1.setBedCount(3);
System.out.println("Completed Entry");*/
}
catch(Exception e)
{
System.out.println("Sorry: "+e);
}
}
}
When i run this client, an exception is reported at the line commented (Here) in the code. The message is as follows
Sorry: javax.naming.ConfigurationException [Root exception is weblogic.rmi.ServerException: A remote exception occurred while executing the method on the remote object - with nested exception:[weblogic.rmi.MarshalException: error marshalling return - with nested exception:[weblogic.rmi.server.ExportException: A description for com.sanjeev.ejb.CabinBeanHomeImpl was found but it could not be read due to: [Failed to find a stub for [class com.sanjeev.ejb.CabinBeanHomeImpl] implements at least one interface [interface com.sanjeev.ejb.CabinHome] which extends Remote.] weblogic.rmi.StubNotFoundException: Failed to find a stub for [class com.sanjeev.ejb.CabinBeanHomeImpl] implements at least one interface [interface com.sanjeev.ejb.CabinHome] which extends Remote. at weblogic.rmi.extensions.BasicDescriptor.<init>(BasicDescriptor.java:25)
at weblogic.rmi.extensions.BasicRuntimeDescriptor.<init>(BasicRuntimeDescriptor.java:34)
at weblogic.rmi.internal.DescriptorManager.resolveClass(DescriptorManager.java:52)
at weblogic.rmi.internal.DescriptorManager.getDescriptor(DescriptorManager.java:36)
at weblogic.rmi.internal.DescriptorManager.getDescriptor(DescriptorManager.java:27)
at weblogic.rmi.internal.OIDManager.getRequestDispatcher(OIDManager.java:193)
at weblogic.rmi.internal.OIDManager.getReplacement(OIDManager.java:182)
at weblogic.rmi.internal.OIDManager.replaceObject(OIDManager.java, Compiled Code)
at weblogic.common.internal.WLObjectOutputStreamBase.replaceObject(WLObjectOutputStreamBase.java, Compiled Code)
at weblogic.common.internal.WLObjectOutputStreamBase.writeObject(WLObjectOutputStreamBase.java, Compiled Code)
at weblogic.common.internal.WLObjectOutputStreamBase.writeObjectWL(WLObjectOutputStreamBase.java, Compiled Code)
at weblogic.rmi.extensions.AbstractOutputStream2.writeObject(AbstractOutputStream2.java:82)
at weblogic.jndi.toolkit.BasicWLContext_WLSkel.invoke(BasicWLContext_WLSkel.java:77)
at weblogic.rmi.extensions.BasicServerObjectAdapter.invoke(BasicServerObjectAdapter.java, Compiled Code)
at weblogic.rmi.extensions.BasicRequestHandler.handleRequest(BasicRequestHandler.java:69)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:15)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled Code)]]]
Could someone please help. It has frustrated me for one full day and i don't like to move forward w/o clearing my concepts
Thanx in advance
Sanjeev
PS: BTW, is the wrox book on EJB with Weblogic server 5.1.0 good?
Jim Baiter
Ranch Hand

Joined: Jan 05, 2001
Posts: 532
If it failed to find the stub then you may not have all the necessary classes in the jar. I would look at the Weblogic samples they give you and make sure you follow the same steps they have in their examples.
Sanjeev Verma
Ranch Hand

Joined: Aug 24, 2000
Posts: 87
Hi Jim
I'm not saying I'm not wrong, cz definately I am. But I have followed the example code ditto. I have posted it so that anyone can see and comment on it.
Thanx for the reply anyway
Regards
Sanjeev
Rahul Mahindrakar
Ranch Hand

Joined: Jul 28, 2000
Posts: 1850
Sanjeev,
We have a forum dedicated to Weblogic in the products section. Please post your queries regarding Weblogic there not here. This forum is dedicated to EJB and J2EE.
Thanks
mohit joshi
Ranch Hand

Joined: Sep 23, 2000
Posts: 243
Make sure that that stubs(including all the bean classes) and all helper classes are available on the client machine and are on the classpath( from where you are trying to remotely access the bean ). Also make sure that the objects that you are trying to pass as arguments are implementing the serializable interface.
This problem shouldnt be difficult to solve.
Regards
Mohit Joshi
Sanjeev Verma
Ranch Hand

Joined: Aug 24, 2000
Posts: 87
Hi Mohit
Thanx for the reply.
Nope, all u said is already there and doesn't help. BTW, i tried to implement the same client code as a servlet running inside weblogic, and that is working fine!!!??? Any pointers!!!
Thanx again
Sanjeev
Shaibaz Gadhwala
Greenhorn

Joined: Jan 22, 2001
Posts: 11
Hello,
See there is some problem with EJB Deployer of Weblogic 5.1..
Just do onething...
execute the following command to generate the stub for the client in the directory where you have the JAR file present. Actually the graphical EJB deployer doesn't generate the client stubs to do so issue the following command
java weblogic.ejbc OldEJB.jar NewEJB.jar
where NewEJB.jar is the new file with the stubs generated..
then register this file in the weblogic.properties file and you would be able to execute it from the client
[This message has been edited by Shaibaz Gadhwala (edited June 26, 2001).]
[This message has been edited by Shaibaz Gadhwala (edited June 26, 2001).]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Very frustrating....please help (Weblogic 5.1.0)