Weird Problem NamingContextFactory in jar cannot be instatiated

Discussions

EJB programming & troubleshooting: Weird Problem NamingContextFactory in jar cannot be instatiated

  1. import org.jnp.interfaces.NamingContextFactory; class Test { Test() { NamingContextFactory f = new NamingContextFactory(); System.out.println(f); } public static void main(String args[]) { new Test(); }; }; javac -cp jbossall-client.jar Test When trying the same code from within a jar i have: SET CLASSPATH=.;.\jbossall-client.jar Exception in thread "main" java.lang.NoClassDefFoundError: org/jnp/interfaces/NamingContextFactory at client.App.(App.java:18) at client.App.main(App.java:46)
  2. import org.jnp.interfaces.NamingContextFactory;

    class Test
    {
    Test() {
    NamingContextFactory f = new NamingContextFactory();
    System.out.println(f);
    }

    public static void main(String args[]) {
    new Test();
    };
    };

    javac -cp jbossall-client.jar Test

    When trying the same code from within a jar i have:
    SET CLASSPATH=.;.\jbossall-client.jar

    Exception in thread "main" java.lang.NoClassDefFoundError: org/jnp/interfaces/NamingContextFactory
    at client.App.(App.java:18)
    at client.App.main(App.java:46)
    make sure package structure is also same.
  3. Solved[ Go to top ]

    The jar manifest needs a 'Class-Path:' attribute with the libs it reference.