Discussion:
javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.WLInitialContextFactory [Root exception is java.lang.ClassNotFoundException: weblogic/jndi/WLInitialContextFactory]
(too old to reply)
Vish
2003-11-07 21:00:57 UTC
Permalink
I am getting the following exception javax.naming.NoInitialContextException: Cannot
instantiate class: weblogic.jndi.WLInitialContextFactory [Root exception is java.lang.ClassNotFoundException:
weblogic/jndi/WLInitialContextFactory]

Peoplesoft application is customized to run a java program and this program is
trying to do Initial context and I am getting the above exception. Peoplesoft
application server has Weblogic 6.1 SP4 and /classes directory has weblogic.jar
file. Strangest thing is that when I load this class using Class.forName it works
fine but it is giving exception with InitialContext(properties).


try
{
c = Class.forName("weblogic.jndi.WLInitialContextFactory");
}
catch (ClassNotFoundException e)
{
System.out.println("ClassNotFoundException:" + e.toString());
}
catch (Exception e)
{
System.out.println("Exception:" + e.toString());
}
System.out.println("----Class name:" + c.getName() );

Above code works fine. I get the class name correctly which is given below.
----Class name:weblogic.jndi.WLInitialContextFactory

Following code is throwing an exception which is listed at the top.
properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL, url +":" + port);
properties.put(Context.SECURITY_PRINCIPAL, user);
properties.put(Context.SECURITY_CREDENTIALS, password == null ? "" : password);

try
{
this.initialContext = new InitialContext(properties);
}
catch (NoInitialContextException e)
{
System.out.println("NoInitialContextException:" + e.toString());
}

catch (NamingException e)
{
System.out.println("NamingException:" + e.toString());
}
catch (Exception e)
{
System.out.println("Exception:" + e.toString());
}

Any ideas on this is appreciated.

Vish
Deepak Vohra
2003-11-09 21:32:46 UTC
Permalink
Is weblogic.jar in the classpath?
weblogic.jndi.WLInitialContextFactory is in weblogic.jar
Post by Vish
I am getting the following exception javax.naming.NoInitialContextException: Cannot
instantiate class: weblogic.jndi.WLInitialContextFactory [Root exception
weblogic/jndi/WLInitialContextFactory]
Peoplesoft application is customized to run a java program and this program is
trying to do Initial context and I am getting the above exception. Peoplesoft
application server has Weblogic 6.1 SP4 and /classes directory has weblogic.jar
file. Strangest thing is that when I load this class using Class.forName it works
fine but it is giving exception with InitialContext(properties).
try
{
c = Class.forName("weblogic.jndi.WLInitialContextFactory");
}
catch (ClassNotFoundException e)
{
System.out.println("ClassNotFoundException:" + e.toString());
}
catch (Exception e)
{
System.out.println("Exception:" + e.toString());
}
System.out.println("----Class name:" + c.getName() );
Above code works fine. I get the class name correctly which is given below.
----Class name:weblogic.jndi.WLInitialContextFactory
Following code is throwing an exception which is listed at the top.
properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL, url +":" + port);
properties.put(Context.SECURITY_PRINCIPAL, user);
properties.put(Context.SECURITY_CREDENTIALS, password == null ? "" : password);
try
{
this.initialContext = new InitialContext(properties);
}
catch (NoInitialContextException e)
{
System.out.println("NoInitialContextException:" + e.toString());
}
catch (NamingException e)
{
System.out.println("NamingException:" + e.toString());
}
catch (Exception e)
{
System.out.println("Exception:" + e.toString());
}
Any ideas on this is appreciated.
Vish
Vish
2003-11-10 14:41:58 UTC
Permalink
Yes, weblogic.jar is in classpath. weblogic.jar has weblogic.jndi.WLInitialContextFactory.class

Vish
Post by Deepak Vohra
Is weblogic.jar in the classpath?
weblogic.jndi.WLInitialContextFactory is in weblogic.jar
Post by Vish
I am getting the following exception javax.naming.NoInitialContextException: Cannot
instantiate class: weblogic.jndi.WLInitialContextFactory [Root exception
weblogic/jndi/WLInitialContextFactory]
Peoplesoft application is customized to run a java program and this
program
Post by Vish
is
trying to do Initial context and I am getting the above exception. Peoplesoft
application server has Weblogic 6.1 SP4 and /classes directory has weblogic.jar
file. Strangest thing is that when I load this class using Class.forName it works
fine but it is giving exception with InitialContext(properties).
try
{
c = Class.forName("weblogic.jndi.WLInitialContextFactory");
}
catch (ClassNotFoundException e)
{
System.out.println("ClassNotFoundException:" + e.toString());
}
catch (Exception e)
{
System.out.println("Exception:" + e.toString());
}
System.out.println("----Class name:" + c.getName() );
Above code works fine. I get the class name correctly which is given below.
----Class name:weblogic.jndi.WLInitialContextFactory
Following code is throwing an exception which is listed at the top.
properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL, url +":" + port);
properties.put(Context.SECURITY_PRINCIPAL, user);
properties.put(Context.SECURITY_CREDENTIALS, password == null ? "" : password);
try
{
this.initialContext = new InitialContext(properties);
}
catch (NoInitialContextException e)
{
System.out.println("NoInitialContextException:" + e.toString());
}
catch (NamingException e)
{
System.out.println("NamingException:" + e.toString());
}
catch (Exception e)
{
System.out.println("Exception:" + e.toString());
}
Any ideas on this is appreciated.
Vish
Rob Woollen
2003-11-10 19:15:58 UTC
Permalink
My money is still on something being wrong in your classpath.

Can you print out the $CLASSPATH your server is using and then do

javap -classpath $YOURCLASSPATH weblogic.jndi.WLInitialContextFactory

-- Rob
Post by Vish
I am getting the following exception javax.naming.NoInitialContextException: Cannot
weblogic/jndi/WLInitialContextFactory]
Peoplesoft application is customized to run a java program and this program is
trying to do Initial context and I am getting the above exception. Peoplesoft
application server has Weblogic 6.1 SP4 and /classes directory has weblogic.jar
file. Strangest thing is that when I load this class using Class.forName it works
fine but it is giving exception with InitialContext(properties).
try
{
c = Class.forName("weblogic.jndi.WLInitialContextFactory");
}
catch (ClassNotFoundException e)
{
System.out.println("ClassNotFoundException:" + e.toString());
}
catch (Exception e)
{
System.out.println("Exception:" + e.toString());
}
System.out.println("----Class name:" + c.getName() );
Above code works fine. I get the class name correctly which is given below.
----Class name:weblogic.jndi.WLInitialContextFactory
Following code is throwing an exception which is listed at the top.
properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL, url +":" + port);
properties.put(Context.SECURITY_PRINCIPAL, user);
properties.put(Context.SECURITY_CREDENTIALS, password == null ? "" : password);
try
{
this.initialContext = new InitialContext(properties);
}
catch (NoInitialContextException e)
{
System.out.println("NoInitialContextException:" + e.toString());
}
catch (NamingException e)
{
System.out.println("NamingException:" + e.toString());
}
catch (Exception e)
{
System.out.println("Exception:" + e.toString());
}
Any ideas on this is appreciated.
Vish
Vish
2003-11-10 23:44:46 UTC
Permalink
classpath being used by the appserver: /ps/psdev/appserv/classes:/ps/psdev/appserv/classes/weblogic.jar:/ps/psdev/appserv/classes/com:/ps/psdev/appserv/classes/weblogic

I did javap and this is what I got.
[***@psdevapp]$ javap -classpath /ps/psdev/appserv/classes:/ps/psdev/appserv/classes/weblogic.jar:/ps/psdev/appserv/classes/com:/ps/psdev/appserv/classes/weblogic
weblogic.jndi.WLInitialContextFactory
Compiled from WLInitialContextFactory.java
public class weblogic.jndi.WLInitialContextFactory extends java.lang.Object implements
javax.naming.spi.InitialContextFactory {
public weblogic.jndi.WLInitialContextFactory();
public final javax.naming.Context getInitialContext(java.util.Hashtable) throws
javax.naming.NamingException;
}

It looks good to me.
Post by Rob Woollen
Can you print out the $CLASSPATH your server is using and then do
javap -classpath $YOURCLASSPATH weblogic.jndi.WLInitialContextFactory
-- Rob
Cannot
Post by Vish
instantiate class: weblogic.jndi.WLInitialContextFactory [Root exception
weblogic/jndi/WLInitialContextFactory]
Peoplesoft application is customized to run a java program and this
program is
Post by Vish
trying to do Initial context and I am getting the above exception.
Peoplesoft
Post by Vish
application server has Weblogic 6.1 SP4 and /classes directory has
weblogic.jar
Post by Vish
file. Strangest thing is that when I load this class using Class.forName
it works
Post by Vish
fine but it is giving exception with InitialContext(properties).
try
{
c = Class.forName("weblogic.jndi.WLInitialContextFactory");
}
catch (ClassNotFoundException e)
{
System.out.println("ClassNotFoundException:" + e.toString());
}
catch (Exception e)
{
System.out.println("Exception:" + e.toString());
}
System.out.println("----Class name:" + c.getName() );
Above code works fine. I get the class name correctly which is given
below.
Post by Vish
----Class name:weblogic.jndi.WLInitialContextFactory
Following code is throwing an exception which is listed at the top.
properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL, url +":" + port);
properties.put(Context.SECURITY_PRINCIPAL, user);
properties.put(Context.SECURITY_CREDENTIALS, password == null ? ""
: password);
Post by Vish
try
{
this.initialContext = new InitialContext(properties);
}
catch (NoInitialContextException e)
{
System.out.println("NoInitialContextException:" + e.toString());
}
catch (NamingException e)
{
System.out.println("NamingException:" + e.toString());
}
catch (Exception e)
{
System.out.println("Exception:" + e.toString());
}
Any ideas on this is appreciated.
Vish
Rob Woollen
2003-11-11 02:37:38 UTC
Permalink
Very odd. Can you try
Class.forName("weblogic.jndi.WLInitialContextFactory", true,
getClass().getClassLoader());

and show me the output?

-- Rob
Post by Vish
classpath being used by the appserver: /ps/psdev/appserv/classes:/ps/psdev/appserv/classes/weblogic.jar:/ps/psdev/appserv/classes/com:/ps/psdev/appserv/classes/weblogic
I did javap and this is what I got.
weblogic.jndi.WLInitialContextFactory
Compiled from WLInitialContextFactory.java
public class weblogic.jndi.WLInitialContextFactory extends java.lang.Object implements
javax.naming.spi.InitialContextFactory {
public weblogic.jndi.WLInitialContextFactory();
public final javax.naming.Context getInitialContext(java.util.Hashtable) throws
javax.naming.NamingException;
}
It looks good to me.
Post by Rob Woollen
Can you print out the $CLASSPATH your server is using and then do
javap -classpath $YOURCLASSPATH weblogic.jndi.WLInitialContextFactory
-- Rob
Cannot
Post by Vish
instantiate class: weblogic.jndi.WLInitialContextFactory [Root exception
weblogic/jndi/WLInitialContextFactory]
Peoplesoft application is customized to run a java program and this
program is
Post by Vish
trying to do Initial context and I am getting the above exception.
Peoplesoft
Post by Vish
application server has Weblogic 6.1 SP4 and /classes directory has
weblogic.jar
Post by Vish
file. Strangest thing is that when I load this class using Class.forName
it works
Post by Vish
fine but it is giving exception with InitialContext(properties).
try
{
c = Class.forName("weblogic.jndi.WLInitialContextFactory");
}
catch (ClassNotFoundException e)
{
System.out.println("ClassNotFoundException:" + e.toString());
}
catch (Exception e)
{
System.out.println("Exception:" + e.toString());
}
System.out.println("----Class name:" + c.getName() );
Above code works fine. I get the class name correctly which is given
below.
Post by Vish
----Class name:weblogic.jndi.WLInitialContextFactory
Following code is throwing an exception which is listed at the top.
properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL, url +":" + port);
properties.put(Context.SECURITY_PRINCIPAL, user);
properties.put(Context.SECURITY_CREDENTIALS, password == null ? ""
: password);
Post by Vish
try
{
this.initialContext = new InitialContext(properties);
}
catch (NoInitialContextException e)
{
System.out.println("NoInitialContextException:" + e.toString());
}
catch (NamingException e)
{
System.out.println("NamingException:" + e.toString());
}
catch (Exception e)
{
System.out.println("Exception:" + e.toString());
}
Any ideas on this is appreciated.
Vish
Rob Woollen
2003-11-11 02:38:44 UTC
Permalink
Or, what I'm really asking is if you've added anything to the JDK's
extension directory?

-- Rob
Post by Rob Woollen
Very odd. Can you try
Class.forName("weblogic.jndi.WLInitialContextFactory", true,
getClass().getClassLoader());
and show me the output?
-- Rob
Post by Vish
/ps/psdev/appserv/classes:/ps/psdev/appserv/classes/weblogic.jar:/ps/psdev/appserv/classes/com:/ps/psdev/appserv/classes/weblogic
I did javap and this is what I got.
/ps/psdev/appserv/classes:/ps/psdev/appserv/classes/weblogic.jar:/ps/psdev/appserv/classes/com:/ps/psdev/appserv/classes/weblogic
weblogic.jndi.WLInitialContextFactory
Compiled from WLInitialContextFactory.java
public class weblogic.jndi.WLInitialContextFactory extends
java.lang.Object implements
javax.naming.spi.InitialContextFactory {
public weblogic.jndi.WLInitialContextFactory();
public final javax.naming.Context
getInitialContext(java.util.Hashtable) throws
javax.naming.NamingException;
}
It looks good to me.
Post by Rob Woollen
Can you print out the $CLASSPATH your server is using and then do
javap -classpath $YOURCLASSPATH weblogic.jndi.WLInitialContextFactory
-- Rob
Post by Vish
I am getting the following exception
Cannot
Post by Vish
instantiate class: weblogic.jndi.WLInitialContextFactory [Root exception
weblogic/jndi/WLInitialContextFactory]
Peoplesoft application is customized to run a java program and this
program is
Post by Vish
trying to do Initial context and I am getting the above exception.
Peoplesoft
Post by Vish
application server has Weblogic 6.1 SP4 and /classes directory has
weblogic.jar
Post by Vish
file. Strangest thing is that when I load this class using
Class.forName
it works
Post by Vish
fine but it is giving exception with InitialContext(properties).
try
{
c = Class.forName("weblogic.jndi.WLInitialContextFactory");
}
catch (ClassNotFoundException e)
{
System.out.println("ClassNotFoundException:" + e.toString());
}
catch (Exception e)
{
System.out.println("Exception:" + e.toString());
}
System.out.println("----Class name:" + c.getName() );
Above code works fine. I get the class name correctly which is given
below.
Post by Vish
----Class name:weblogic.jndi.WLInitialContextFactory
Following code is throwing an exception which is listed at the top.
properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL, url +":" + port);
properties.put(Context.SECURITY_PRINCIPAL, user);
properties.put(Context.SECURITY_CREDENTIALS, password == null ? ""
: password);
Post by Vish
try
{
this.initialContext = new InitialContext(properties);
}
catch (NoInitialContextException e)
{
System.out.println("NoInitialContextException:" + e.toString());
}
catch (NamingException e)
{
System.out.println("NamingException:" + e.toString());
}
catch (Exception e)
{
System.out.println("Exception:" + e.toString());
}
Any ideas on this is appreciated.
Vish
Vish
2003-11-12 01:08:47 UTC
Permalink
I did what you asked me to do and It loads the class correctly. How do I get the
output you are looking for.

Thanks
Post by Rob Woollen
Or, what I'm really asking is if you've added anything to the JDK's
extension directory?
-- Rob
Post by Rob Woollen
Very odd. Can you try
Class.forName("weblogic.jndi.WLInitialContextFactory", true,
getClass().getClassLoader());
and show me the output?
-- Rob
Post by Vish
/ps/psdev/appserv/classes:/ps/psdev/appserv/classes/weblogic.jar:/ps/psdev/appserv/classes/com:/ps/psdev/appserv/classes/weblogic
I did javap and this is what I got.
/ps/psdev/appserv/classes:/ps/psdev/appserv/classes/weblogic.jar:/ps/psdev/appserv/classes/com:/ps/psdev/appserv/classes/weblogic
weblogic.jndi.WLInitialContextFactory
Compiled from WLInitialContextFactory.java
public class weblogic.jndi.WLInitialContextFactory extends
java.lang.Object implements
javax.naming.spi.InitialContextFactory {
public weblogic.jndi.WLInitialContextFactory();
public final javax.naming.Context
getInitialContext(java.util.Hashtable) throws
javax.naming.NamingException;
}
It looks good to me.
Post by Rob Woollen
Can you print out the $CLASSPATH your server is using and then do
javap -classpath $YOURCLASSPATH weblogic.jndi.WLInitialContextFactory
-- Rob
Post by Vish
I am getting the following exception
Cannot
Post by Vish
instantiate class: weblogic.jndi.WLInitialContextFactory [Root exception
weblogic/jndi/WLInitialContextFactory]
Peoplesoft application is customized to run a java program and this
program is
Post by Vish
trying to do Initial context and I am getting the above exception.
Peoplesoft
Post by Vish
application server has Weblogic 6.1 SP4 and /classes directory has
weblogic.jar
Post by Vish
file. Strangest thing is that when I load this class using Class.forName
it works
Post by Vish
fine but it is giving exception with InitialContext(properties).
try
{
c = Class.forName("weblogic.jndi.WLInitialContextFactory");
}
catch (ClassNotFoundException e)
{
System.out.println("ClassNotFoundException:" + e.toString());
}
catch (Exception e)
{
System.out.println("Exception:" + e.toString());
}
System.out.println("----Class name:" + c.getName() );
Above code works fine. I get the class name correctly which is given
below.
Post by Vish
----Class name:weblogic.jndi.WLInitialContextFactory
Following code is throwing an exception which is listed at the top.
properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL, url +":" + port);
properties.put(Context.SECURITY_PRINCIPAL, user);
properties.put(Context.SECURITY_CREDENTIALS, password == null ?
""
Post by Rob Woollen
Post by Vish
Post by Rob Woollen
: password);
Post by Vish
try
{
this.initialContext = new InitialContext(properties);
}
catch (NoInitialContextException e)
{
System.out.println("NoInitialContextException:" + e.toString());
}
catch (NamingException e)
{
System.out.println("NamingException:" + e.toString());
}
catch (Exception e)
{
System.out.println("Exception:" + e.toString());
}
Any ideas on this is appreciated.
Vish
Loading...