Noelia Delgado [
http://community.jboss.org/people/Zoeley] created the discussion
"javax.naming.NoInitialContextException: Cannot instantiate class"
To view the discussion, visit:
http://community.jboss.org/message/558637#558637
--------------------------------------------------------------
Hi, I have a problem when I want to run my application's jar, it's a standalone
app and I don't have this problem when I run it into Eclipse.
I'm using Jboss 5.1.0GA, maven 2.2.1 and JDK 1.6.18.
PS C:\Workspace\hre\target> java -jar AppClient.jar
java.exe : javax.naming.NoInitialContextException: Cannot instantiate class: or
g.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoun
dException: org.jnp.interfaces.NamingContextFactory]
At line:1 char:5
+ java <<<< -jar AppClient.jar
+ CategoryInfo : NotSpecified: (javax.naming.No...ContextFactory]
:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at util.Contexto.<init>(Contexto.java:22)
at mesa_entrada.IdPaciente.setContexto(IdPaciente.java:1627)
at mesa_entrada.IdPaciente.<init>(IdPaciente.java:185)
at principal.Escritorio$2.actionPerformed(Escritorio.java:206)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2
318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.ja
va:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonList
ener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6263)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6028)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.
java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.jav
a:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.
java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFa
ctory
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:4
6)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)
... 32 more
This is my code:
public Contexto() throws NamingException{
Properties env = new Properties();
// Try with a login that should succeed
env.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
env.setProperty("java.naming.factory.url.pkgs",
"org.jboss.naming:org.jnp.interfaces");
env.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming.client");
env.setProperty("java.naming.provider.url", "localhost:1099");
env.setProperty(Context.SECURITY_CREDENTIALS, "");
env.setProperty(Context.SECURITY_PRINCIPAL, "");
env.setProperty(Context.SECURITY_PROTOCOL, "java:/jaas/App");
this.ctx = new InitialContext(env);
}
I added my server.log
If anyone can help me I would appreciate it.
Thanks
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/558637#558637]
Start a new discussion in Beginner's Corner at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]