Invoking EJB hosted in weblogic from silverstream

Posted on 2004-08-20
Medium Priority
Last Modified: 2008-01-09

i have a code like this. I am trying to invoke an EJB that is hosted in a weblogic server. The method given below is on my client java program. if i run from my eclipse IDE it runs perfectly. But the same code when run from SilverStream application server (converted this code to a servlet) there it doesnt run. The execution stops at the line "return new InitialContext(properties);". The initialcontext is not getting created. has any one come across similar problem? how to solve this?

private Context getInitialContext() throws Exception {
    String url = "t3://ip-qdev01:26040";
    String user = null;
    String password = null;
    Properties properties = null;
    try {
      properties = new Properties();
      properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
      properties.put(Context.PROVIDER_URL, url);
      if (user != null) {
        properties.put(Context.SECURITY_PRINCIPAL, user);
        properties.put(Context.SECURITY_CREDENTIALS, password == null ? "" : password);
      //InitialContext sample = new InitialContext();
      //System.out.println("sample ------->  " + sample.getEnvironment());
     //above 3 lines for test purpose
      return new InitialContext(properties);
    catch(Exception e) {
      System.out.println("PaymentInterfaceTestClient1 : getInitialContext() : 6");
      log("Unable to connect to WebLogic server at " + url);
      log("Please make sure that the server is running.");
      throw e;
Question by:msk_satheesh
  • 5
  • 5

Expert Comment

ID: 11862847
Do you get any exception or does the execution simply "hangs"?
Can you run the lookup code from the machine running the Silverstream server as a simple java main program?


Author Comment

ID: 11868263
I tried running from my desktop with the right jars included (wlclient.jar). There it works. From SilverStream the execution simply 'hangs'. No exception thrown. I tried by including the wlclient.jar in the war file as well as setting the property to make use of the weblogic classes from the jar that included. See the below code where i have additionally set the Context.URL_PKG_PREFIXES property.

      properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
      properties.put(Context.PROVIDER_URL, url);

Expert Comment

ID: 11878198
Yes, you need the client Jar in the War used in the SilverStream. But, did you run the test code as a simple java main program on the silverstream machine?

Why am i asking this?, well, im trying to help you isolate the problem (code, environment setting, communication problems etc).
So, a good first step to close on the bugger is to take your code and run it on the machine running the Silverstream, as a java main.

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  


Author Comment

ID: 11879398
I just tried it. it looks more like a java version problem now.

I tried the following scenario:

1. Use Jdk 1.4 (java version "1.4.1_02") to compile and run with both success
2. Use Jdk1.3 (java version "1.3.0_02") to compile and run with compile success and run failure
3. Use the java version of silverstream (java version "1.3.1_07"). (both fail)

For cases 2 and 3. the run time error is:

-- Initializing bean access....
PaymentInterfaceTestClient1 : getInitialContext() : 1
PaymentInterfaceTestClient1 : getInitialContext() : 2
PaymentInterfaceTestClient1 : getInitialContext() : 3
PaymentInterfaceTestClient1 : getInitialContext() : 4
PaymentInterfaceTestClient1 : getInitialContext() : 5   {java.naming.provider.url=t3://ip-qdev01:26040, java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory}
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/corba/se/connection/ORBSocketFactory
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:488)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:106)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:243)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:51)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:190)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:183)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:294)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:281)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:310)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:115)
        at weblogic.corba.j2ee.naming.ORBHelper.<clinit>(ORBHelper.java:111)
        at weblogic.corba.client.ClientORBInitializer.initialize(ClientORBInitializer.java:84)
        at weblogic.jndi.WLInitialContextFactory.<init>(WLInitialContextFactory.java:29)
        at java.lang.Class.newInstance0(Native Method)
        at java.lang.Class.newInstance(Class.java:232)
        at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:647)
        at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:241)
        at javax.naming.InitialContext.init(InitialContext.java:217)
        at javax.naming.InitialContext.<init>(InitialContext.java:193)
        at be.belgacom.mobile.wlan.lmpg.PaymentInterfaceTestClient1.getInitialContext(PaymentInterfaceTestClient1.java:91)
        at be.belgacom.mobile.wlan.lmpg.PaymentInterfaceTestClient1.initialize(PaymentInterfaceTestClient1.java:36)
        at be.belgacom.mobile.wlan.lmpg.PaymentInterfaceTestClient1.<init>(PaymentInterfaceTestClient1.java:24)
        at be.belgacom.mobile.wlan.lmpg.PaymentInterfaceTestClient1.main(PaymentInterfaceTestClient1.java:451)

Accepted Solution

yuvalg earned 1200 total points
ID: 11879812
You got it then. I guess you have to use JDK 1.4 to use the wlclient. Or (perhaps) alternatively try an older version of the wlclient.
LVL 23

Assisted Solution

rama_krishna580 earned 300 total points
ID: 11889566

I also have same problem as like you, only solution for this you need to run the EJB's from Weblogic Console using only JDK 1.3 Version, then it will be fine, because we also initially tries with 1.4 then it got failed, then we tried with JDK 1.3, debugs and runs fine. So in your case you try to use only JDK 1.3 rather than 1.4.

i hope it may help you
best of luck


Author Comment

ID: 11889963

Yes when it tried with the weblogic.jar from weblogic 7.0 (which runs on jdk1.3) it worked. Though i ran the program as a standalone. With silverstream i have not run it yet. some classpath problems are there.

Finally it is not going to solve my problem because i have to run two applications, one of them in silverstream 4.0 (runs on jre 1.3) and weblogic 8.1 that runs on jre1.4. The weblogic.jar from old version of weblogic will not be supported officially(for my project).

Now atleast i know what the problem is! Thanks to you guys!

Expert Comment

ID: 11890687
Say, how bout some points :) ?

Author Comment

ID: 11894270
here you go yuvalg!

Author Comment

ID: 11894372
Am back with another problem!
Now it is accessing EJB from one Silverstream server to another! Ran into some problems. I have a piece of code which is:

Class NSUPProxy.java has method:

private NsupProxy(String providerURL) throws NsupLocatorException {
        this.providerURL = providerURL;
        this.nsupRemote = NsupLocator.getInstance(providerURL).getNsupService();

Class NsupLocator.java has method:

public UserProfilesReaderRemoteHome getHome() throws NsupLocatorException {
        try {
            Hashtable env = new Hashtable();
            env.put(Context.PROVIDER_URL, providerURL);

            InitialContext initial = new InitialContext(env);

            Object objRef = initial.lookup("ejb/UserProfilesReader");
            UserProfilesReaderRemoteHome userProfilesReaderRemoteHome =

            return userProfilesReaderRemoteHome;
        catch (ClassCastException e) {
            throw new NsupLocatorException(e.getMessage(), e);
        catch (NamingException e) {
            throw new NsupLocatorException(e.getMessage(), e);

Now i get an exception like this below. But again the wonderful thing is the code runs from my desktop (eclipse IDE) but not from silverstream. So my nsup server is up and running and the ejb name is alright. But from silverstream ??? :-((

javax.naming.NameNotFoundException.  Root exception is org.omg.CosNaming.NamingContextPackage.NotFound
        at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:29)
        at org.omg.CosNaming._NamingContextExtStub.resolve(_NamingContextExtStub.java:241)
        at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:363)
        at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:412)
        at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:390)
        at javax.naming.InitialContext.lookup(InitialContext.java:345)
        at be.belgacom.mobile.ns.userprofile.client.NsupLocator.getHome(NsupLocator.java:74)
        at be.belgacom.mobile.ns.userprofile.client.NsupLocator.getNsupService(NsupLocator.java:113)
        at be.belgacom.mobile.ns.userprofile.client.NsupLocator.getNsupService(NsupLocator.java:57)
        at be.belgacom.mobile.ns.userprofile.client.NsupProxy.<init>(NsupProxy.java:58)
        at be.belgacom.mobile.ns.userprofile.client.NsupProxy.getInstance(NsupProxy.java:45)
        at be.belgacom.mobile.wlan.nsup.ServletNSUPTester.checkMSISDN(ServletNSUPTester.java:115)
        at be.belgacom.mobile.wlan.nsup.ServletNSUPTester.doPost(ServletNSUPTester.java:63)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at com.sssw.srv.busobj.AgoFilterChain.doServlet(AgoFilterChain.java:396)
        at com.sssw.srv.busobj.AgoFilterChain.doFilter(AgoFilterChain.java:182)
        at com.sssw.srv.resources.AgWarResource.service(AgWarResource.java:629)
        at com.sssw.srv.resources.AgWarURLResource.perform(AgWarURLResource.java:115)
        at com.sssw.srv.http.httpd.perform(httpd.java:5631)
        at com.sssw.srv.http.Client.processRequest(Client.java:902)
        at com.sssw.srv.http.Client.loop(Client.java:1268)
        at com.sssw.srv.http.Client.runConnection(Client.java:1484)
        at com.sssw.srv.http.Client.run(Client.java:1432)
        at java.lang.Thread.run(Thread.java:479)

Expert Comment

ID: 11900008
Are you sure that what you are trying to access is deployed correctly, can you call it fom its own server machine?

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Convert websphere application server default chained Certificates from 1024 to 2048 keysize or higher size and also you can change signatureAlgorithm . Please make sure Websphere Application Server fixpack or Above. The following steps a…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question