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 Can't access EJB from remote 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 "Can Watch "Can New topic
Author

Can't access EJB from remote client

Debojit Sinha
Ranch Hand

Joined: Mar 13, 2010
Posts: 66

Hi,
I tried to access an EJB via JNDI lookup using Weblogic 10.3.4. The remote client worked fine when both EJB and client were part of same JDeveloper application, but the error happened when I moved the client to another workspace. I deployed the EAR file on the sever, added the classpath for the Client JAR to the new remote client, but still it didn't work. I am posting both code and errors below:

The EJB CalculatorBean.java :

The remote interface Calculator.java :


The remote client CalculatorClient.java :

Code for both the clients I used are the same.

This is the error I get when I try to run the client from a different application:

I'd be really grateful if somebody gives some insight in this matter. Thank You.
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 511
Hello,
Caused by: java.lang.ClassNotFoundException: weblogic.jndi.WLInitialContextFactory


Check the Classpath. I have never worked on JDeveloper and hence cannot pinpoint where to check. But this is a classpath issue for certain.

Regds,
Amit
Debojit Sinha
Ranch Hand

Joined: Mar 13, 2010
Posts: 66

I did. The path for the client JAR is in the classpath fro the project. I also added the libraries for Java EE 1.5 & Java EE 1.5 API to project classpath, but no change. I'm wondering, could this be because of a JNDI lookup failure? I'm not sure myself, but I'm grasping at straws at this point.
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 511
Hi,
No, this class is part of Weblogic runtime. You need to configure JDeveloper so that you make available Weblogic classes to the Project.

regds,
Amit
Debojit Sinha
Ranch Hand

Joined: Mar 13, 2010
Posts: 66

I tried out your suggestion -- I'm assuming that you mean that I should add the Weblogic 10.3 Thin Client and/or Weblogic 10.3 Remote Client jars to project libraries. I added both of those along with wlclient.jar file in server\lib folder. The error change to the following:

By the way, this is an incomplete error log, I think. I still haven't found out where JDev keeps the complete log. I could post the whole error if I knew.
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 511
hi,
Have you changed the port number on which Weblogic server runs ?
It seems your ClassNotFound has now gone and your program is not able to communicate with Weblogic using T3 protocol on port 7001.

Regds,
Amit
Debojit Sinha
Ranch Hand

Joined: Mar 13, 2010
Posts: 66

How do I do that? I'm really new to this environment, I'm only learning this because of project requirement. I can't even look up the specific port where an application is deployed. Actually, I think the fault lies with my installation and configuration of sever instance. I'm having problems with a WSDL web service as well, although others say that they were able to run my code smoothly. Any thoughts anyone? If the server config is at fault, I'd be very grateful if any one could point out the proper configuration for WebLogic 10.3.4 for use in personal environment for learning purpose.
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 511
Hi,
You can find out this from the admin console of Weblogic.
Also you can check the documentation about your version of weblogic to locate this information.
Usually it is 7001 but in case if you have changed the port while installation , the document would be able to tell you which configuration file to look for.

regds,
Amit
Debojit Sinha
Ranch Hand

Joined: Mar 13, 2010
Posts: 66

amit punekar wrote:Hi,
You can find out this from the admin console of Weblogic.
Also you can check the documentation about your version of weblogic to locate this information.
Usually it is 7001 but in case if you have changed the port while installation , the document would be able to tell you which configuration file to look for.

regds,
Amit


Its set at the default port, I'm sure of at least that much.
Actually, I'm starting to think the fault lies with my installation and configuration of sever instance. I'm having problems with a WSDL web service as well, although others say that they were able to run my code smoothly. Any thoughts anyone? If the server config is at fault, I'd be very grateful if any one could point out the proper configuration for WebLogic 10.3.4 for use in personal environment for learning purpose.
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 511
Hi,
You can check if you can access the same EJB from within a JSP or Servlet.
There you can just instantiate InitialContext without any environment properties.
Let us know how that test goes?

regds,
Amit
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8836
    
    7

Debojit Sinha wrote: I'd be very grateful if any one could point out the proper configuration for WebLogic 10.3.4 for use in personal environment for learning purpose.


I use Weblogic all the time. How did you install it? How did you configure your domain? Are you sure Weblogic is running?
Debojit Sinha
Ranch Hand

Joined: Mar 13, 2010
Posts: 66

Joe Ess wrote:

I use Weblogic all the time. How did you install it? How did you configure your domain? Are you sure Weblogic is running?


Prestty sure that Webllogic is running. I created a addition web service, and was able to etst it properly from Weblogic test client.

I installed it with deafult options. During configuration of a server instance, I selected all dfault options. Also, when I installed OSB and SOA suite, I create separate domains for each of them and configured them with the developers option for each of them. Would that in any way hamper or otherwise impde the perfomance? I'm sorry I'm still all very new to this environment. That's why I was asking for installation options. I seem to have misread the installation guide at Oracle, and was wondering how people usually configured the server when using it from home.
Debojit Sinha
Ranch Hand

Joined: Mar 13, 2010
Posts: 66

I just deleted my enitre workspace in Jdev, remade the entire workspace from a back up, then manually wrote everything in the client. It works like a charm now. I'd still like configuration pointers for weblogic, though. Optionally, those for OSB and SOA 11g.
nick mk
Greenhorn

Joined: Sep 08, 2011
Posts: 1
Debojit Sinha wrote:I just deleted my enitre workspace in Jdev, remade the entire workspace from a back up, then manually wrote everything in the client. It works like a charm now. I'd still like configuration pointers for weblogic, though. Optionally, those for OSB and SOA 11g.


Check the following tag in your build.xml

property name="WLS_HOME" value="${env.WLS_HOME}"

where WLS_HOME=c:\weblogic\wls\wlserver if running on windows i kept trying to run a simple hello world program and it kept throwing

run: [echo] Executing client class
[java] javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.WLInitialContextFactory [Root exception is java.lang.ClassNotFoundException: weblogic.jndi.WLInitialContextFactory]

once i changed the above mention tag it in the build.xml it worked fine
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can't access EJB from remote client
 
Similar Threads
Error in EJB
Got problem when setup HelloEJB project in RAD
JNDI/JBOSS
Problem with code
Access EJB from Remote POJO