3 Replies Latest reply on Nov 19, 2004 1:35 AM by adicko

    InitialContext(JNDI) not found

    adicko Newbie

      I coded an application, which works perfectly in eclipse. But when I want to start this over an *.bat, the InitialContext Method doesn't work - it seems it gets stuck.

      private MyLocator() throws MyLocatorException
       {
       try
       {
       Properties jndiProps = new Properties();
       String myServer = "localhost";
       jndiProps.setProperty("java.naming.factory.initial",
       "org.jnp.interfaces.NamingContextFactory");
       jndiProps.setProperty("java.naming.provider.url", myServer);
       jndiProps.setProperty("java.naming.factory.url.pkgs",
       "org.jboss.naming:org.jnp.interfaces");
      
      System.out.println("MyLocator: InitialContext is initialised...");
       context = new InitialContext(jndiProps);
      System.out.println("MyLocator: InitialContext was initialised.");
       }
       catch (Exception e)
       {
       throw new MyLocatorException("InitialContext failed");
       }
       }


      The first System.out is printed but the second System.out isn't shown not an exception thrown either.

      After the executing thread is reactivated after a period of time, I receive:
      java.lang.UnsupportedClassVersionError: org/jboss/logging/Logger (Unsupported major.minor version 48.0)
       at java.lang.ClassLoader.defineClass0(Native Method)
       at java.lang.ClassLoader.defineClass(Unknown Source)
       at java.security.SecureClassLoader.defineClass(Unknown Source)
       at java.net.URLClassLoader.defineClass(Unknown Source)
       at java.net.URLClassLoader.access$100(Unknown Source)
       at java.net.URLClassLoader$1.run(Unknown Source)
       at java.security.AccessController.doPrivileged(Native Method)
       at java.net.URLClassLoader.findClass(Unknown Source)
       at java.lang.ClassLoader.loadClass(Unknown Source)
       at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
       at java.lang.ClassLoader.loadClass(Unknown Source)
       at java.lang.ClassLoader.loadClassInternal(Unknown Source)
       at org.jnp.interfaces.NamingContext.<clinit>(NamingContext.java:101)
       at org.jnp.interfaces.NamingContextFactory.getInitialContext(NamingContextFactory.java:41)
       at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
       at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
       at javax.naming.InitialContext.init(Unknown Source)
       at javax.naming.InitialContext.<init>(Unknown Source)
       at test.mail.MyLocator.<init>(MyLocator.java:52)
       at test.mail.MyLocator.getInstance(MyLocator.java:70)
       at test.mail.MyImp.<init>(MyImp.java:89)
       at test.mail.DoImp.handleImport(DoImp.java:77)
       at test.mail.MyThread.run(MyThread.java:68)
      


      The classpath is correct and the needed class and *.jars are available.

      => So where's the bug? [The applications works properly in eclipse!)]
      Why is the exception just thrown in the 2nd "run" and why does the application "seize"?

      Thanks in advance

      ADICKO