SOAP connect for WebSphere vs TomCat

Discussion in 'Java' started by Bojan, Apr 21, 2009.

  1. Bojan

    Bojan Guest

    Hi,

    I am programing using RAD (Rational Application Developer) a version
    of Eclipse which has built in WebSphere Server. When execute my
    program it works properly. But when I export it as a war file and run
    it with Apache Tomcat server I get the following error:


    com.ibm.websphere.management.exception.ConnectorException: ADMC0053E:
    The system cannot create a SOAP connector to connect to host localhost
    at port 8880 with SOAP connector security enabled.


    my Code:

    Properties connectProps = new Properties();
    connectProps.setProperty("javax.net.ssl.trustStore", "C:\
    \cacerts.jks");
    connectProps.setProperty("javax.net.ssl.keyStore", "C:\
    \cacerts.jks");
    connectProps.setProperty("javax.net.ssl.trustStorePassword",
    "changeit");
    connectProps.setProperty("javax.net.ssl.keyStorePassword",
    "changeit");

    connectProps.setProperty(AdminClient.CONNECTOR_TYPE,
    AdminClient.CONNECTOR_TYPE_SOAP);

    connectProps.setProperty(AdminClient.CONNECTOR_SECURITY_ENABLED,
    "true");

    connectProps.setProperty(AdminClient.CONNECTOR_HOST, host);
    connectProps.setProperty(AdminClient.CONNECTOR_PORT, port);

    if (user!=null && !user.equalsIgnoreCase("null")){
    connectProps.setProperty(AdminClient.USERNAME, user);
    connectProps.setProperty(AdminClient.PASSWORD, password);
    }

    admin = AdminClientFactory.createAdminClient
    (connectProps);
    The Error occurs at the last line.

    Any idea how to resolve the issue?

    Thanks in advance for your help.
     
    Bojan, Apr 21, 2009
    #1
    1. Advertising

  2. Bojan <> wrote in
    news::

    > Hi,
    >
    > I am programing using RAD (Rational Application Developer) a version
    > of Eclipse which has built in WebSphere Server. When execute my
    > program it works properly. But when I export it as a war file and run
    > it with Apache Tomcat server I get the following error:


    Apparently You have created a Web Service client using WebSphere specific
    tools and libraries.

    You need to create the client with some all around solution, like Apache
    Axis in order to get it running in other containers than WebSphere.
     
    Donkey Hottie, Apr 22, 2009
    #2
    1. Advertising

  3. Bojan

    Guest

    On Apr 22, 7:46 am, Donkey Hottie <> wrote:
    > Bojan <> wrote innews::
    >
    > > Hi,

    >
    > > I am programing using RAD (Rational Application Developer) a version
    > > of Eclipse which has built in WebSphere Server.  When execute my
    > > program it works properly.  But when I export it as a war file and run
    > > it with Apache Tomcat server I get the following error:

    >
    > Apparently You have created a Web Service client using WebSphere specific
    > tools and libraries.
    >
    > You need to create the client with some all around solution, like Apache
    > Axis in order to get it running in other containers than WebSphere.


    Indeed...
    Right off the bat, it looks like you're using the AdminClient classes
    which if I recall correctly, are a part of the WebSphere runtime so
    you'd have to have a jar with those classes accessible to your app
    when it runs on a non-WebSphere environment... this is probably not a
    great solution.
    A more generic solution would probably replace AdminClient with
    MBeanServerConnection and JMXConnector (which I think is in javax.* so
    you shouldn't need any extra jars), for starters.
     
    , Apr 22, 2009
    #3
  4. Bojan

    Bojan Guest

    On Apr 22, 9:57 am, wrote:
    > On Apr 22, 7:46 am, Donkey Hottie <> wrote:
    >
    > > Bojan <> wrote innews::

    >
    > > > Hi,

    >
    > > > I am programing using RAD (Rational Application Developer) a version
    > > > of Eclipse which has built in WebSphere Server.  When execute my
    > > > program it works properly.  But when I export it as a war file and run
    > > > it with Apache Tomcat server I get the following error:

    >
    > > Apparently You have created a Web Service client using WebSphere specific
    > > tools and libraries.

    >
    > > You need to create the client with some all around solution, like Apache
    > > Axis in order to get it running in other containers than WebSphere.

    >
    > Indeed...
    > Right off the bat, it looks like you're using the AdminClient classes
    > which if I recall correctly, are a part of the WebSphere runtime so
    > you'd have to have a jar with those classes accessible to your app
    > when it runs on a non-WebSphere environment... this is probably not a
    > great solution.
    > A more generic solution would probably replace AdminClient with
    > MBeanServerConnection and JMXConnector (which I think is in javax.* so
    > you shouldn't need any extra jars), for starters.


    I have done what you have recommended but the problem is still there.
    What I found interesting is that when i run it with the IBM's
    environment no errors occur. But if I run the same code with the JRE
    1.6 environment it fails.

    The code:
    String jndiPath="/jndi/JMXConnector";

    String urlString = "service:jmx:iiop://localhost:9100" +jndiPath;
    JMXServiceURL url = new JMXServiceURL(urlString);

    Hashtable<String, String> h = new Hashtable<String, String>();

    //Specify the user ID and password for the server if security is
    enabled on server.
    h.put(Context.INITIAL_CONTEXT_FACTORY,
    "com.ibm.websphere.naming.WsnInitialContextFactory");
    h.put(Context.URL_PKG_PREFIXES,"com.ibm.ws.naming");

    //Establish the JMX connection.
    try
    {
    JMXConnector jmxc = JMXConnectorFactory.connect(url, h);
    //Get the MBean server connection instance.
    mbsc = jmxc.getMBeanServerConnection();
    }
    catch(Exception e)
    {
    System.out.println("Error creating connection:");
    e.printStackTrace();
    }
    }

    my class name is JMXConnectorClient in the package jmx_test
    the error is:

    java.io.IOException: Failed to retrieve RMIServer stub:
    javax.naming.NameNotFoundException: Context: 16DH7CAC83600B1Node01Cell/
    nodes/16DH7CAC83600B1Node01/servers/server1, name: JMXConnector: First
    component in name JMXConnector not found. [Root exception is
    org.omg.CosNaming.NamingContextPackage.NotFound: IDL:eek:mg.org/CosNaming/
    NamingContext/NotFound:1.0]
    at javax.management.remote.rmi.RMIConnector.connect(Unknown Source)
    at javax.management.remote.JMXConnectorFactory.connect(Unknown
    Source)
    at jmx_test.JMXConnectorClient.connect(JMXConnectorClient.java:78)
    at jmx_test.JMXConnectorClient.main(JMXConnectorClient.java:32)
    Caused by: javax.naming.NameNotFoundException: Context:
    16DH7CAC83600B1Node01Cell/nodes/16DH7CAC83600B1Node01/servers/server1,
    name: JMXConnector: First component in name JMXConnector not found.
    [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound:
    IDL:eek:mg.org/CosNaming/NamingContext/NotFound:1.0]
    at com.ibm.ws.naming.jndicos.CNContextImpl.processNotFoundException
    (CNContextImpl.java:4730)
    at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup
    (CNContextImpl.java:1907)
    at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup
    (CNContextImpl.java:1862)
    at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt
    (CNContextImpl.java:1552)
    at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:
    1354)
    at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:172)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(Unknown
    Source)
    at javax.management.remote.rmi.RMIConnector.findRMIServer(Unknown
    Source)
    ... 4 more
    Caused by: org.omg.CosNaming.NamingContextPackage.NotFound:
    IDL:eek:mg.org/CosNaming/NamingContext/NotFound:1.0
    at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(Unknown
    Source)
    at com.ibm.WsnOptimizedNaming._NamingContextStub.resolve_complete_info
    (_NamingContextStub.java:504)
    at com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve
    (CNContextImpl.java:4351)
    at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup
    (CNContextImpl.java:1901)
    ... 11 more

    Any recommendations??

    Thanks in advance
     
    Bojan, Apr 23, 2009
    #4
  5. Bojan

    Lew Guest

    Bojan wrote:
    > On Apr 22, 9:57 am, wrote:
    >> On Apr 22, 7:46 am, Donkey Hottie <> wrote:
    >>
    >>> Bojan <> wrote innews::
    >>>> Hi,
    >>>> I am programing using RAD (Rational Application Developer) a version
    >>>> of Eclipse which has built in WebSphere Server. When execute my
    >>>> program it works properly. But when I export it as a war file and run
    >>>> it with Apache Tomcat server I get the following error:
    >>> Apparently You have created a Web Service client using WebSphere specific
    >>> tools and libraries.
    >>> You need to create the client with some all around solution, like Apache
    >>> Axis in order to get it running in other containers than WebSphere.

    >> Indeed...
    >> Right off the bat, it looks like you're using the AdminClient classes
    >> which if I recall correctly, are a part of the WebSphere runtime so
    >> you'd have to have a jar with those classes accessible to your app
    >> when it runs on a non-WebSphere environment... this is probably not a
    >> great solution.
    >> A more generic solution would probably replace AdminClient with
    >> MBeanServerConnection and JMXConnector (which I think is in javax.* so
    >> you shouldn't need any extra jars), for starters.

    >
    > I have done what you have recommended but the problem is still there.
    > What I found interesting is that when i run it with the IBM's
    > environment no errors occur. But if I run the same code with the JRE
    > 1.6 environment it fails.

    ....
    > the error is:
    >
    > java.io.IOException: Failed to retrieve RMIServer stub:
    > javax.naming.NameNotFoundException: Context: 16DH7CAC83600B1Node01Cell/
    > nodes/16DH7CAC83600B1Node01/servers/server1, name: JMXConnector: First
    > component in name JMXConnector not found. [Root exception is
    > org.omg.CosNaming.NamingContextPackage.NotFound: IDL:eek:mg.org/CosNaming/
    > NamingContext/NotFound:1.0]
    > at javax.management.remote.rmi.RMIConnector.connect(Unknown Source)
    > at javax.management.remote.JMXConnectorFactory.connect(Unknown
    > Source)
    > at jmx_test.JMXConnectorClient.connect(JMXConnectorClient.java:78)
    > at jmx_test.JMXConnectorClient.main(JMXConnectorClient.java:32)
    > Caused by: javax.naming.NameNotFoundException: Context:
    > 16DH7CAC83600B1Node01Cell/nodes/16DH7CAC83600B1Node01/servers/server1,
    > name: JMXConnector: First component in name JMXConnector not found.
    > [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound:
    > IDL:eek:mg.org/CosNaming/NamingContext/NotFound:1.0]

    ....

    See if the IBM JRE includes ORB JARs in its own extensions directory that are
    not present in the Sun installation.

    --
    Lew
     
    Lew, Apr 24, 2009
    #5
  6. Bojan

    Guest

    On Apr 23, 5:23 pm, Bojan <> wrote:
    > On Apr 22, 9:57 am, wrote:
    >
    >
    >
    >
    >
    > > On Apr 22, 7:46 am, Donkey Hottie <> wrote:

    >
    > > > Bojan <> wrote innews::

    >
    > > > > Hi,

    >
    > > > > I am programing using RAD (Rational Application Developer) a version
    > > > > of Eclipse which has built in WebSphere Server.  When execute my
    > > > > program it works properly.  But when I export it as a war file and run
    > > > > it with Apache Tomcat server I get the following error:

    >
    > > > Apparently You have created a Web Service client using WebSphere specific
    > > > tools and libraries.

    >
    > > > You need to create the client with some all around solution, like Apache
    > > > Axis in order to get it running in other containers than WebSphere.

    >
    > > Indeed...
    > > Right off the bat, it looks like you're using the AdminClient classes
    > > which if I recall correctly, are a part of the WebSphere runtime so
    > > you'd have to have a jar with those classes accessible to your app
    > > when it runs on a non-WebSphere environment... this is probably not a
    > > great solution.
    > > A more generic solution would probably replace AdminClient with
    > > MBeanServerConnection and JMXConnector (which I think is in javax.* so
    > > you shouldn't need any extra jars), for starters.

    >
    > I have done what you have recommended but the problem is still there.
    > What I found interesting is that when i run it with the IBM's
    > environment no errors occur.  But if I run the same code with the JRE
    > 1.6 environment it fails.
    >
    > The code:
    >                 String jndiPath="/jndi/JMXConnector";
    >
    >                 String urlString = "service:jmx:iiop://localhost:9100" +jndiPath;
    >                 JMXServiceURL url = new JMXServiceURL(urlString);
    >
    >                 Hashtable<String, String> h  = new Hashtable<String, String>();
    >
    >                 //Specify the user ID and password for the server if security is
    > enabled on server.
    >                 h.put(Context.INITIAL_CONTEXT_FACTORY,
    > "com.ibm.websphere.naming.WsnInitialContextFactory");
    >                         h.put(Context.URL_PKG_PREFIXES,"com.ibm.ws.naming");
    >
    >                 //Establish the JMX connection.
    >                 try
    >                 {
    >                         JMXConnector jmxc = JMXConnectorFactory.connect(url, h);
    >                 //Get the MBean server connection instance.
    >                         mbsc = jmxc.getMBeanServerConnection();
    >                 }
    >                 catch(Exception e)
    >                 {
    >                         System.out.println("Error creating connection:");
    >                         e.printStackTrace();
    >                 }
    >         }
    >
    > my class name is JMXConnectorClient in the package jmx_test
    > the error is:
    >
    > java.io.IOException: Failed to retrieve RMIServer stub:
    > javax.naming.NameNotFoundException: Context: 16DH7CAC83600B1Node01Cell/
    > nodes/16DH7CAC83600B1Node01/servers/server1, name: JMXConnector: First
    > component in name JMXConnector not found. [Root exception is
    > org.omg.CosNaming.NamingContextPackage.NotFound: IDL:eek:mg.org/CosNaming/
    > NamingContext/NotFound:1.0]
    >         at javax.management.remote.rmi.RMIConnector.connect(Unknown Source)
    >         at javax.management.remote.JMXConnectorFactory.connect(Unknown
    > Source)
    >         at jmx_test.JMXConnectorClient.connect(JMXConnectorClient..java:78)
    >         at jmx_test.JMXConnectorClient.main(JMXConnectorClient.java:32)
    > Caused by: javax.naming.NameNotFoundException: Context:
    > 16DH7CAC83600B1Node01Cell/nodes/16DH7CAC83600B1Node01/servers/server1,
    > name: JMXConnector: First component in name JMXConnector not found.
    > [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound:
    > IDL:eek:mg.org/CosNaming/NamingContext/NotFound:1.0]
    >         at com.ibm.ws.naming.jndicos.CNContextImpl.processNotFoundException
    > (CNContextImpl.java:4730)
    >         at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup
    > (CNContextImpl.java:1907)
    >         at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup
    > (CNContextImpl.java:1862)
    >         at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt
    > (CNContextImpl.java:1552)
    >         at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:
    > 1354)
    >         at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:172)
    >         at javax.naming.InitialContext.lookup(Unknown Source)
    >         at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(Unknown
    > Source)
    >         at javax.management.remote.rmi.RMIConnector.findRMIServer(Unknown
    > Source)
    >         ... 4 more
    > Caused by: org.omg.CosNaming.NamingContextPackage.NotFound:
    > IDL:eek:mg.org/CosNaming/NamingContext/NotFound:1.0
    >         at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(Unknown
    > Source)
    >         at com.ibm.WsnOptimizedNaming._NamingContextStub.resolve_complete_info
    > (_NamingContextStub.java:504)
    >         at com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve
    > (CNContextImpl.java:4351)
    >         at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup
    > (CNContextImpl.java:1901)
    >         ... 11 more
    >
    > Any recommendations??
    >
    > Thanks in advance


    Hmm Your code looks very similar to an IBM example I've seen:
    http://publib.boulder.ibm.com/infoc...ress.doc/info/exp/ae/tjmx_develop_jsr160.html

    Only difference is that they set the PROVIDER_URL and your code
    doesn't:

    String providerUrl = "corbaloc:iiop:" + hostname + ":" + port + "/
    WsnAdminNameService";
    h.put(Context.PROVIDER_URL, providerUrl);

    If would try setting this, unless there's a reason not to.
     
    , Apr 28, 2009
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Otis Mukinfus
    Replies:
    3
    Views:
    959
    Juan T. Llibre
    Jul 8, 2005
  2. Replies:
    0
    Views:
    484
  3. Replies:
    3
    Views:
    40,666
    Roedy Green
    Nov 16, 2005
  4. Ulf Meinhardt
    Replies:
    6
    Views:
    2,416
    Arne Vajhøj
    Jan 26, 2008
  5. Garg
    Replies:
    2
    Views:
    786
    Mike Schilling
    Sep 1, 2008
Loading...

Share This Page