Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes EJB and other Java EE Technologies and the fly likes EJB  bean not able to run Client 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 "EJB  bean not able to run Client" Watch "EJB  bean not able to run Client" New topic
Author

EJB bean not able to run Client

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi
i am trying out my first demo example of EJB in Weblogic. However i am getting the following error. I am trying to invoke the client with the bean deployed.
"
C:\weblogic>java examples.ejb.basic.statelessSession.Client
Beginning statelessSession.Client...
We were unable to get a connection to the WebLogic server at t3://localhost:7001
Please make sure that the server is running."
I have the bean deployed and can be seen in the Weblogic console . it is running on the default 7001 port.
Is it that i have missed something.
Regds.
Rahul

[This message has been edited by rahul_mkar (edited July 11, 2000).]
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi,
are you using weblogic 5.1 or 4.5.1.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
hi,
I am using 5.1.
Regds.
Rahul
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi Iam also using weblogic 5.1.Iam able to run.I can just give you the steps I did.Hope you did all this already.
1.Make sure the server,deployer and console is started.In console connect to the server by logging through your password.
In deployer also make sure that the listen port and password match to the weblogic properties file.
2.Load the corresponding jar file which is in \weblogic\myserver directory.
3.Deploy through the deployer.you can see it on the console.
4.At the command prompt change to weblogic directory and type in C:\weblogic>java examples.ejb.basic.statelesssession.Client
This should work.and It worked for me.I think its better if you check in weblogic properties file to make sure the port and password.and also in client program.
thanks.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
hi,
the exact error is as follows which i have trapped
C:\weblogic>java examples.ejb.basic.statelessSession.Client
Beginning statelessSession.Client...
We were unable to get a connection to the WebLogic server at t3://127.0.0.1:7001
Please make sure that the server is running.
javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.
WLInitialContextFactory [Root exception is java.lang.ClassNotFoundException: web
logic.jndi.WLInitialContextFactory]
i saw something about this in the sun site which i will be checking out. I carried out the same steps u specified.
Regds
Rahul
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi,
The sun site was really helpful. i entered WLInitialContextFactory in the search field and got some good results. Basically it told me that there is a WLInitialContextFactory.jar file in weblogic/classes folder. gotto check out by adding it in the classpath at home.
Regds.
Rahul
[This message has been edited by rahul_mkar (edited July 13, 2000).]
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi,
I looked at the sun site and read the solution given,but I didn't found any jar file you specied.According to the solution it is asked to add directory which contains weblogic.jndi package.this is in weblogic/classes path and it is already added to the classpath of setenv.please post here how the problem is solved.
thanks
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
hi,
i removed the set path command in my autoexec.bat file. then i restarted the system. i started the console with the bean specified in the properties file. the bean was deployed. later i created a new console window. i used setEnv command.
i had renamed the setEnv.cmd file to setEnv.bat earlier and specified in the file where my java clases are.
i went into the examples.ejb.basic.statefulSession and compiled all the files through javac *.java.
then i moved up to the weblogic folder and gave the command
java examples.ejb.basic.statefulSession.Client
things went off smoothly.
i think the problem lies in the classpath in the autoexec file which the documentation says has to be removed.

thanks for all u r help. I will be asking for more!!
Regds.
Rahul

[This message has been edited by rahul_mkar (edited July 14, 2000).]
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hai,
great,your problem got solved.Its good not to use autoexec.bat file at all.always create your own batch files for java development.o,k.see my another question in this post regarding connection pool.if you got answer please post it there.
thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB bean not able to run Client