Loading ...
Sorry, an error occurred while loading the content.

Glassfish - spawn of the Devil!

Expand Messages
  • piikoicoder
    Hi All, The following code works wonderfully easy with my local Glassfish server. -- First it gets the server s InitialContext - ctx . -- Then it looks up an
    Message 1 of 4 , Jun 12, 2011
    View Source
    • 0 Attachment
      Hi All,

      The following code works wonderfully easy with my local Glassfish server.
      -- First it gets the server's InitialContext - 'ctx".
      -- Then it looks up an instance of javax.jms.ConnectionFactory as an Object.

      But when I change to my remote Glassfish server, it gets the context but then bombs with the error below -- that produces ZERO hits even on Google.

      I pasted the CODE: followed by the CONSOLE OUTPUT: below.

      Anyone have any idea.
      Or know anyone who works on a Glassfish server.
      Or anything
      ... I mean were do you go from here
      ... when no one seems to have heard of my error before????????????

      CODE:
      import java.util.Hashtable;
      import javax.naming.Context;
      import javax.naming.InitialContext;
      import javax.naming.NamingException;
      import org.america3.toolkit.Utility;

      public class JNDITest {

      public static void main (String[] args) {
      JNDITest t = new JNDITest ();
      }

      public JNDITest () {
      Hashtable<String, String> env = new Hashtable<String, String>();
      env.put("java.naming.factory.initial",
      "com.sun.enterprise.naming.impl.SerialInitContextFactory");
      env.put("java.naming.factory.url.pkgs",
      "com.sun.enterprise.naming");
      env.put("java.naming.factory.state",
      "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
      env.put("org.omg.CORBA.ORBInitialPort",
      "3700");
      env.put("org.omg.CORBA.ORBInitialHost",
      "myDomain.org");
      try {
      Context ctx = (Context) new InitialContext(env);
      System.out.println("ctx OK."); // works local & remote
      Object obj = ctx.lookup("jms/goFactory"); // works local but not remote
      System.out.println("lookup OK.");
      } catch (Exception e) {
      String iAmError = Utility.getIAmError(Thread.currentThread().getStackTrace());
      System.out.println("Attempt to lookup remote ConnectionFactory failed.");
      System.out.println(iAmError + "\nType: " + e.getClass().getSimpleName());
      System.out.println(Utility.printStackTrace(e.getStackTrace()));
      System.out.println("\nMessage: " + e.getMessage() + "\n");
      System.out.println("Cause: " + e.getCause());
      }
      }
      }

      CONSOLE OUTPUT:
      [NOTE: These first few lines are a pain but not part of the problem.
      Although I'd love to get rid of them because I don't use Derby
      as my SQL server]

      Jun 12, 2011 3:52:43 PM com.sun.enterprise.v3.server.CommonClassLoaderServiceImpl findDerbyClient
      INFO: Cannot find javadb client jar file, derby jdbc driver will not be available by default.

      HERE IS THE REAL PROBLEM]
      ctx OK. [NOTE: I got a valid Context the it failed on ctx.lookup()]
      Attempt to lookup remote ConnectionFactory failed.
      ERROR: JNDITest.<init> ()
      Type: CommunicationException
      Stack Trace:
      com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:542)
      com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)
      javax.naming.InitialContext.lookup(InitialContext.java:392)
      org.america3.test.JNDITest.<init>(JNDITest.java:28)
      org.america3.test.JNDITest.main(JNDITest.java:13)
      Message: Communication exception for SerialContext[myEnv={
      org.omg.CORBA.ORBInitialPort=3700,
      java.naming.factory.initial=
      com.sun.enterprise.naming.impl.SerialInitContextFactory,
      org.omg.CORBA.ORBInitialHost=myDomain.org,
      java.naming.factory.state=
      com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl,
      java.naming.factory.url.pkgs=com.sun.enterprise.naming
      }
      Cause: java.lang.ClassCastException:
      java.lang.String cannot be cast to
      org.glassfish.resource.common.PoolInfo
    • Clifton Royston
      ... I ve never worked with or even heard of Glassfish, and I don t ever do much with Java, but in any such problem, the main thing to do is look at the
      Message 2 of 4 , Jun 18, 2011
      View Source
      • 0 Attachment
        On Mon, Jun 13, 2011 at 02:42:00AM -0000, piikoicoder wrote:
        >
        > Hi All,
        > The following code works wonderfully easy with my local Glassfish
        > server.
        > -- First it gets the server's InitialContext - 'ctx".
        > -- Then it looks up an instance of javax.jms.ConnectionFactory as an
        > Object.
        > But when I change to my remote Glassfish server, it gets the context
        > but then bombs with the error below -- that produces ZERO hits even on
        > Google.
        > I pasted the CODE: followed by the CONSOLE OUTPUT: below.
        > Anyone have any idea.
        > Or know anyone who works on a Glassfish server.
        > Or anything
        > ... I mean were do you go from here
        > ... when no one seems to have heard of my error before????????????

        I've never worked with or even heard of Glassfish, and I don't ever
        do much with Java, but in any such problem, the main thing to do is
        look at the differences between the environment that works and the
        environment that doesn't.

        In this case, tracing it down to:

        > Object obj = ctx.lookup("jms/goFactory"); // works local but not remote

        resulting in:

        > java.lang.String cannot be cast to
        > org.glassfish.resource.common.PoolInfo

        suggests that either

        1) you might have a different version or revision of Glassfish running
        on your remote server, such that there is no ctx.lookup overload which
        takes a single string as its parameter, or

        2) Glassfish on the remote server doesn't have the same hierarchical
        organization for finding the factory you're trying to lookup, or the
        factory hasn't been created on that server.

        As I say, knowing nothing about Glassflish I'm flying blind here, but
        knowing debugging and troubleshooting those would be the places to start
        looking.
        -- Clifton

        > CODE:
        > import java.util.Hashtable;
        > import javax.naming.Context;
        > import javax.naming.InitialContext;
        > import javax.naming.NamingException;
        > import org.america3.toolkit.Utility;
        > public class JNDITest {
        > public static void main (String[] args) {
        > JNDITest t = new JNDITest ();
        > }
        > public JNDITest () {
        > Hashtable<String, String> env = new Hashtable<String, String>();
        > env.put("java.naming.factory.initial",
        > "com.sun.enterprise.naming.impl.SerialInitContextFactory");
        > env.put("java.naming.factory.url.pkgs",
        > "com.sun.enterprise.naming");
        > env.put("java.naming.factory.state",
        > "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
        > env.put("org.omg.CORBA.ORBInitialPort",
        > "3700");
        > env.put("org.omg.CORBA.ORBInitialHost",
        > "myDomain.org");
        > try {
        > Context ctx = (Context) new InitialContext(env);
        > System.out.println("ctx OK."); // works local & remote
        > Object obj = ctx.lookup("jms/goFactory"); // works local but not remote
        > System.out.println("lookup OK.");
        > } catch (Exception e) {
        > String iAmError =
        > Utility.getIAmError(Thread.currentThread().getStackTrace());
        > System.out.println("Attempt to lookup remote ConnectionFactory
        > failed.");
        > System.out.println(iAmError + "\nType: " +
        > e.getClass().getSimpleName());
        > System.out.println(Utility.printStackTrace(e.getStackTrace()));
        > System.out.println("\nMessage: " + e.getMessage() + "\n");
        > System.out.println("Cause: " + e.getCause());
        > }
        > }
        > }
        > CONSOLE OUTPUT:
        > [NOTE: These first few lines are a pain but not part of the problem.
        > Although I'd love to get rid of them because I don't use Derby
        > as my SQL server]
        > Jun 12, 2011 3:52:43 PM
        > com.sun.enterprise.v3.server.CommonClassLoaderServiceImpl
        > findDerbyClient
        > INFO: Cannot find javadb client jar file, derby jdbc driver will not be
        > available by default.
        > HERE IS THE REAL PROBLEM]
        > ctx OK. [NOTE: I got a valid Context the it failed on ctx.lookup()]
        > Attempt to lookup remote ConnectionFactory failed.
        > ERROR: JNDITest.<init> ()
        > Type: CommunicationException
        > Stack Trace:
        > com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:
        > 542)
        > com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:
        > 455)
        > javax.naming.InitialContext.lookup(InitialContext.java:392)
        > org.america3.test.JNDITest.<init>(JNDITest.java:28)
        > org.america3.test.JNDITest.main(JNDITest.java:13)
        > Message: Communication exception for SerialContext[myEnv={
        > org.omg.CORBA.ORBInitialPort=3700,
        > java.naming.factory.initial=
        > com.sun.enterprise.naming.impl.SerialInitContextFactory,
        > org.omg.CORBA.ORBInitialHost=myDomain.org,
        > java.naming.factory.state=
        > com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl,
        > java.naming.factory.url.pkgs=com.sun.enterprise.naming
        > }
        > Cause: java.lang.ClassCastException:
        > java.lang.String cannot be cast to
        > org.glassfish.resource.common.PoolInfo
        >
        >
        > References
        >
        > 1. mailto:g@...?subject=Re%3A%20Glassfish%20-%20spawn%20of%20the%20Devil%21
        > 2. mailto:honolulu-coders@yahoogroups.com?subject=Re%3A%20Glassfish%20-%20spawn%20of%20the%20Devil%21
        > 3. http://groups.yahoo.com/group/honolulu-coders/post;_ylc=X3oDMTJwczRyMzcwBF9TAzk3MzU5NzE0BGdycElkAzEwMDk5NjE3BGdycHNwSWQDMTcwNzI4MTk0MgRtc2dJZAM5NzEEc2VjA2Z0cgRzbGsDcnBseQRzdGltZQMxMzA3OTMyOTMw?act=reply&messageNum=971
        > 4. http://groups.yahoo.com/group/honolulu-coders/post;_ylc=X3oDMTJmczRpYW4wBF9TAzk3MzU5NzE0BGdycElkAzEwMDk5NjE3BGdycHNwSWQDMTcwNzI4MTk0MgRzZWMDZnRyBHNsawNudHBjBHN0aW1lAzEzMDc5MzI5MzA-
        > 5. http://groups.yahoo.com/group/honolulu-coders/message/971;_ylc=X3oDMTMzMGF1NnI4BF9TAzk3MzU5NzE0BGdycElkAzEwMDk5NjE3BGdycHNwSWQDMTcwNzI4MTk0MgRtc2dJZAM5NzEEc2VjA2Z0cgRzbGsDdnRwYwRzdGltZQMxMzA3OTMyOTMwBHRwY0lkAzk3MQ--
        > 6. http://groups.yahoo.com/group/honolulu-coders;_ylc=X3oDMTJmNmlvZjN0BF9TAzk3MzU5NzE0BGdycElkAzEwMDk5NjE3BGdycHNwSWQDMTcwNzI4MTk0MgRzZWMDdnRsBHNsawN2Z2hwBHN0aW1lAzEzMDc5MzI5MzA-
        > 7. http://groups.yahoo.com/;_ylc=X3oDMTJlaXFmdWUzBF9TAzk3MzU5NzE0BGdycElkAzEwMDk5NjE3BGdycHNwSWQDMTcwNzI4MTk0MgRzZWMDZnRyBHNsawNnZnAEc3RpbWUDMTMwNzkzMjkzMA--
        > 8. mailto:honolulu-coders-traditional@yahoogroups.com?subject=Change%20Delivery%20Format:%20Traditional
        > 9. mailto:honolulu-coders-digest@yahoogroups.com?subject=Email%20Delivery:%20Digest
        > 10. mailto:honolulu-coders-unsubscribe@yahoogroups.com?subject=Unsubscribe
        > 11. http://docs.yahoo.com/info/terms/

        --
        Clifton Royston -- cliftonr@... / cliftonr@...
        President - I and I Computing * http://www.iandicomputing.com/
        Custom programming, network design, systems and network consulting services
      • g
        Hi Cliff, Thank you for the suggestions ... but ... well ... that tracing things down part ... it only works till you get to a single line of code using the
        Message 3 of 4 , Jun 19, 2011
        View Source
        • 0 Attachment

          Hi Cliff,

           

          Thank you for the suggestions ... but ... well ... that tracing things down part ... it only works till you get to a single line of code using the Java API classes over which you have no control and whose code you really can't see ... like:

           

          > Object obj = ctx.lookup("jms/goFactory");

          // works local but not remote

          Then it either works or it doesn't.  And to compound the problem ... even when I went up to the remote host for my remote Glassfish server and looked in the logs ... they had the same error message that turned out to be spurious and meaningless.

           

          Because as it turned out, the problem was in a bug.

           

          Normally once you register your installation,  it, like windows, automatically downloads and installs updates as they are release ... as my local glassfish was doing ... so it worked fine ... and I finally figured my remote couldn't do (even though registered for them) because it lived behind a virtual server that lived behind the linux operating system on eApps.com's machine ... with heaven knows how much else between it and the outside word.

           

          Ergo the code works fine on my updated local server didn't on my not updated remote one.

           

          And since it was a bug, the error messages it was throwing out were just junk.

           

          And asking eApps to reinstall the same version didn't help, because the package obviously doesn't have any updates that were released after the package was released. 

           

          That's why a new install normally and automatically updates the installation as the last thing it does

          ... but mine couldn't do it automatically

          ... and since the only access I have to it is through Cgywin SSH shell

          ... and the updatetool is a GUI

          ... I couldn't even do it manually from here

          ... soooooo ... it was a sad painful learning "experience" not to trust the error messages forever.

           

          Anyway ... that is why I'd love to find someone who runs enterprise level Java on Glassfish ... someone who knows the undocumented stuff that only the "family" knows. 

           

          Oh ... Just FYI "Glassfish" is the implementation standard for Java's latest version of its enterprise level API.

           

          Thanks again,

          George

          From: honolulu-coders@yahoogroups.com [mailto:honolulu-coders@yahoogroups.com] On Behalf Of Clifton Royston
          Sent: Saturday, June 18, 2011 7:30 AM
          To: honolulu-coders@yahoogroups.com
          Subject: Re: [honolulu-coders] Glassfish - spawn of the Devil!

           

           

          On Mon, Jun 13, 2011 at 02:42:00AM -0000, piikoicoder wrote:

          >
          > Hi All,
          > The following code works wonderfully easy with my local Glassfish
          > server.
          > -- First it gets the server's InitialContext - 'ctx".
          > -- Then it looks up an instance of javax.jms.ConnectionFactory as an
          > Object.
          > But when I change to my remote Glassfish server, it gets the context
          > but then bombs with the error below -- that produces ZERO hits even on
          > Google.
          > I pasted the CODE: followed by the CONSOLE OUTPUT: below.
          > Anyone have any idea.
          > Or know anyone who works on a Glassfish server.
          > Or anything
          > ... I mean were do you go from here
          > ... when no one seems to have heard of my error before????????????

          I've never worked with or even heard of Glassfish, and I don't ever
          do much with Java, but in any such problem, the main thing to do is
          look at the differences between the environment that works and the
          environment that doesn't.

          In this case, tracing it down to:

          > Object obj = ctx.lookup("jms/goFactory"); // works local but not remote

          resulting in:

          > java.lang.String cannot be cast to
          > org.glassfish.resource.common.PoolInfo

          suggests that either

          1) you might have a different version or revision of Glassfish running
          on your remote server, such that there is no ctx.lookup overload which
          takes a single string as its parameter, or

          2) Glassfish on the remote server doesn't have the same hierarchical
          organization for finding the factory you're trying to lookup, or the
          factory hasn't been created on that server.

          As I say, knowing nothing about Glassflish I'm flying blind here, but
          knowing debugging and troubleshooting those would be the places to start
          looking.
          -- Clifton

          > CODE:
          > import java.util.Hashtable;
          > import javax.naming.Context;
          > import javax.naming.InitialContext;
          > import javax.naming.NamingException;
          > import org.america3.toolkit.Utility;
          > public class JNDITest {
          > public static void main (String[] args) {
          > JNDITest t = new JNDITest ();
          > }
          > public JNDITest () {
          > Hashtable<String, String> env = new Hashtable<String, String>();
          > env.put("java.naming.factory.initial",
          > "com.sun.enterprise.naming.impl.SerialInitContextFactory");
          > env.put("java.naming.factory.url.pkgs",
          > "com.sun.enterprise.naming");
          > env.put("java.naming.factory.state",
          > "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
          > env.put("org.omg.CORBA.ORBInitialPort",
          > "3700");
          > env.put("org.omg.CORBA.ORBInitialHost",
          > "myDomain.org");
          > try {
          > Context ctx = (Context) new InitialContext(env);
          > System.out.println("ctx OK."); // works local & remote
          > Object obj = ctx.lookup("jms/goFactory"); // works local but not remote
          > System.out.println("lookup OK.");
          > } catch (Exception e) {
          > String iAmError =
          > Utility.getIAmError(Thread.currentThread().getStackTrace());
          > System.out.println("Attempt to lookup remote ConnectionFactory
          > failed.");
          > System.out.println(iAmError + "\nType: " +
          > e.getClass().getSimpleName());
          > System.out.println(Utility.printStackTrace(e.getStackTrace()));
          > System.out.println("\nMessage: " + e.getMessage() + "\n");
          > System.out.println("Cause: " + e.getCause());
          > }
          > }
          > }
          > CONSOLE OUTPUT:
          > [NOTE: These first few lines are a pain but not part of the problem.
          > Although I'd love to get rid of them because I don't use Derby
          > as my SQL server]
          > Jun 12, 2011 3:52:43 PM
          > com.sun.enterprise.v3.server.CommonClassLoaderServiceImpl
          > findDerbyClient
          > INFO: Cannot find javadb client jar file, derby jdbc driver will not be
          > available by default.
          > HERE IS THE REAL PROBLEM]
          > ctx OK. [NOTE: I got a valid Context the it failed on ctx.lookup()]
          > Attempt to lookup remote ConnectionFactory failed.
          > ERROR: JNDITest.<init> ()
          > Type: CommunicationException
          > Stack Trace:
          > com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:
          > 542)
          > com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:
          > 455)
          > javax.naming.InitialContext.lookup(InitialContext.java:392)
          > org.america3.test.JNDITest.<init>(JNDITest.java:28)
          > org.america3.test.JNDITest.main(JNDITest.java:13)
          > Message: Communication exception for SerialContext[myEnv={
          > org.omg.CORBA.ORBInitialPort=3700,
          > java.naming.factory.initial=
          > com.sun.enterprise.naming.impl.SerialInitContextFactory,
          > org.omg.CORBA.ORBInitialHost=myDomain.org,
          > java.naming.factory.state=
          > com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl,
          > java.naming.factory.url.pkgs=com.sun.enterprise.naming
          > }
          > Cause: java.lang.ClassCastException:
          > java.lang.String cannot be cast to
          > org.glassfish.resource.common.PoolInfo
          >
          >
          > References
          >
          > 1. mailto:g@...?subject=Re%3A%20Glassfish%20-%20spawn%20of%20the%20Devil%21
          > 2. mailto:honolulu-coders@yahoogroups.com?subject=Re%3A%20Glassfish%20-%20spawn%20of%20the%20Devil%21
          > 3. http://groups.yahoo.com/group/honolulu-coders/post;_ylc=X3oDMTJwczRyMzcwBF9TAzk3MzU5NzE0BGdycElkAzEwMDk5NjE3BGdycHNwSWQDMTcwNzI4MTk0MgRtc2dJZAM5NzEEc2VjA2Z0cgRzbGsDcnBseQRzdGltZQMxMzA3OTMyOTMw?act=reply&messageNum=971
          > 4. http://groups.yahoo.com/group/honolulu-coders/post;_ylc=X3oDMTJmczRpYW4wBF9TAzk3MzU5NzE0BGdycElkAzEwMDk5NjE3BGdycHNwSWQDMTcwNzI4MTk0MgRzZWMDZnRyBHNsawNudHBjBHN0aW1lAzEzMDc5MzI5MzA-
          > 5. http://groups.yahoo.com/group/honolulu-coders/message/971;_ylc=X3oDMTMzMGF1NnI4BF9TAzk3MzU5NzE0BGdycElkAzEwMDk5NjE3BGdycHNwSWQDMTcwNzI4MTk0MgRtc2dJZAM5NzEEc2VjA2Z0cgRzbGsDdnRwYwRzdGltZQMxMzA3OTMyOTMwBHRwY0lkAzk3MQ--
          > 6. http://groups.yahoo.com/group/honolulu-coders;_ylc=X3oDMTJmNmlvZjN0BF9TAzk3MzU5NzE0BGdycElkAzEwMDk5NjE3BGdycHNwSWQDMTcwNzI4MTk0MgRzZWMDdnRsBHNsawN2Z2hwBHN0aW1lAzEzMDc5MzI5MzA-
          > 7. http://groups.yahoo.com/;_ylc=X3oDMTJlaXFmdWUzBF9TAzk3MzU5NzE0BGdycElkAzEwMDk5NjE3BGdycHNwSWQDMTcwNzI4MTk0MgRzZWMDZnRyBHNsawNnZnAEc3RpbWUDMTMwNzkzMjkzMA--
          > 8. mailto:honolulu-coders-traditional@yahoogroups.com?subject=Change%20Delivery%20Format:%20Traditional
          > 9. mailto:honolulu-coders-digest@yahoogroups.com?subject=Email%20Delivery:%20Digest
          > 10. mailto:honolulu-coders-unsubscribe@yahoogroups.com?subject=Unsubscribe
          > 11. http://docs.yahoo.com/info/terms/

          --
          Clifton Royston -- cliftonr@... / cliftonr@...
          President - I and I Computing * http://www.iandicomputing.com/
          Custom programming, network design, systems and network consulting services

        • Clifton Royston
          ... Actually, that s the primary point I was trying to make about debugging - to track down what the actual difference between the case that works (local) and
          Message 4 of 4 , Jun 19, 2011
          View Source
          • 0 Attachment
            On Sun, Jun 19, 2011 at 09:34:54AM -1000, g wrote:
            > Hi Cliff,
            >
            > Thank you for the suggestions ... but ... well ... that tracing things
            > down part ... it only works till you get to a single line of code using
            > the Java API classes over which you have no control and whose code you
            > really can't see ... like:
            >
            >
            > > Object obj = ctx.lookup("jms/goFactory");
            >
            > // works local but not remote
            >
            > Then it either works or it doesn't. And to compound the problem ...
            > even when I went up to the remote host for my remote Glassfish server
            > and looked in the logs ... they had the same error message that turned
            > out to be spurious and meaningless.
            >
            > Because as it turned out, the problem was in a bug.
            >
            > Normally once you register your installation, it, like windows,
            > automatically downloads and installs updates as they are release ... as
            > my local glassfish was doing ... so it worked fine ... and I finally
            > figured my remote couldn't do (even though registered for them) because
            > it lived behind a virtual server that lived behind the linux operating
            > system on eApps.com's machine ... with heaven knows how much else
            > between it and the outside word.
            >
            > Ergo the code works fine on my updated local server didn't on my not
            > updated remote one.

            Actually, that's the primary point I was trying to make about
            debugging - to track down what the actual difference between the case
            that works (local) and the one that doesn't (remote.)

            Glad you tracked it down successfully. Solutions aren't always as
            simple as finding the problem, and that seems to be the remaining issue
            in your case too.

            -- Clifton

            --
            Clifton Royston -- cliftonr@... / cliftonr@...
            President - I and I Computing * http://www.iandicomputing.com/
            Custom programming, network design, systems and network consulting services
          Your message has been successfully submitted and would be delivered to recipients shortly.