Don't set any of the java.naming.factory.initial.* system properties.
Tell us what error you are seeing. Also tell us what you are trying to do.
I don't think we can fix anything 3.0-Preview, as the final build may
have been already done. How ever, we should be able to give you a patch
or something of that sort. But, first give us the above information.
Thanks,
Sahoo
Annies wrote:
> Forgot to mention, we need to resolve this ASAP for a JavaONE lab.
>
> ------------------------------------------------------------------------
> *From:* Annies <annies_a_at_yahoo.com>
> *To:* users_at_glassfish.dev.java.net
> *Sent:* Tuesday, May 26, 2009 11:42:21 PM
> *Subject:* Re: NoInitialContextException
>
> Yes. SerialInitContextFactory is in glassfish-naming.properties. So I
> went ahead and tested my application with the naming factory set to it
> in system.properties and it works fine.
> Actually class lookup is failing somwehre else. This is what made me
> think that SerialInitContextFactory was not included.
>
> This can be easily reprouced by using this system.properties and
> trying to install and start osgi-http.jar -
> http://download.java.net/maven/glassfish/org/glassfish/web/osgi-http/3.0-b47/osgi-http-3.0-b47.jar
> I verified that all the export and import package headers match and
> tried to use auto install for glassfish-naming.jar and even a
> DynamicImport-Package from osgi-http.jar. Nothing helped.
> Can somebody please look into this?
>
> system.properties:
> java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory
> java.naming.factory.url.pkgs=com.sun.enterprise.naming
> java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl
>
> Stack Trace:
> [#|2009-05-26T23:30:31.477-0700|INFO|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|ERROR:
> Error starting
> file:/Users/annies/gf/glassfishv3/glassfish//modules/osgi-http.jar
> (org.osgi.framework.BundleException: Activator start error in bundle
> org.glassfish.web.osgi-http [8].)|#]
>
> [#|2009-05-26T23:30:31.478-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|java.lang.RuntimeException:
> javax.naming.NoInitialContextException: Cannot instantiate class:
> com.sun.enterprise.naming.impl.SerialInitContextFactory [Root
> exception is java.lang.ClassNotFoundException:
> com.sun.enterprise.naming.impl.SerialInitContextFactory]|#]
>
> [#|2009-05-26T23:30:31.478-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at
> com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.<init>(InjectionManagerImpl.java:90)|#]
>
> [#|2009-05-26T23:30:31.478-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)|#]
>
> [#|2009-05-26T23:30:31.478-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)|#]
>
> [#|2009-05-26T23:30:31.478-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)|#]
>
> [#|2009-05-26T23:30:31.479-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at java.lang.reflect.Constructor.newInstance(Constructor.java:513)|#]
>
> [#|2009-05-26T23:30:31.479-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at java.lang.Class.newInstance0(Class.java:355)|#]
>
> [#|2009-05-26T23:30:31.479-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at java.lang.Class.newInstance(Class.java:308)|#]
>
> [#|2009-05-26T23:30:31.480-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at
> com.sun.hk2.component.ConstructorWomb.create(ConstructorWomb.java:72)|#]
>
> [#|2009-05-26T23:30:31.480-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:71)|#]
>
> [#|2009-05-26T23:30:31.480-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at
> com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)|#]
>
> [#|2009-05-26T23:30:31.480-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)|#]
>
> [#|2009-05-26T23:30:31.480-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at
> com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)|#]
>
> [#|2009-05-26T23:30:31.481-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at org.jvnet.hk2.component.Habitat.getByContract(Habitat.java:570)|#]
>
> [#|2009-05-26T23:30:31.481-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at
> com.sun.enterprise.web.EmbeddedWebContainer.<init>(EmbeddedWebContainer.java:114)|#]
>
> [#|2009-05-26T23:30:31.481-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at
> com.sun.enterprise.web.WebContainer.postConstruct(WebContainer.java:522)|#]
>
> [#|2009-05-26T23:30:31.481-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at
> com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:170)|#]
>
> [#|2009-05-26T23:30:31.481-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:90)|#]
>
> [#|2009-05-26T23:30:31.481-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at java.security.AccessController.doPrivileged(Native Method)|#]
>
> [#|2009-05-26T23:30:31.481-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at
> com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:87)|#]
>
> [#|2009-05-26T23:30:31.482-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77)|#]
>
> [#|2009-05-26T23:30:31.482-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at
> com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)|#]
>
> [#|2009-05-26T23:30:31.482-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)|#]
>
> [#|2009-05-26T23:30:31.482-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at
> com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)|#]
>
> [#|2009-05-26T23:30:31.485-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at org.jvnet.hk2.component.Habitat.getBy(Habitat.java:576)|#]
>
> [#|2009-05-26T23:30:31.485-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at org.jvnet.hk2.component.Habitat.getByType(Habitat.java:557)|#]
>
> [#|2009-05-26T23:30:31.488-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at org.jvnet.hk2.component.Habitat.getComponent(Habitat.java:317)|#]
>
> [#|2009-05-26T23:30:31.488-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at org.glassfish.internal.api.Globals.get(Globals.java:53)|#]
>
> [#|2009-05-26T23:30:31.488-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at
> org.glassfish.web.osgihttp.Activator.getStandardContext(Activator.java:94)|#]
>
> [#|2009-05-26T23:30:31.488-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at org.glassfish.web.osgihttp.Activator.start(Activator.java:86)|#]
>
> [#|2009-05-26T23:30:31.488-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at
> org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:589)|#]
>
> [#|2009-05-26T23:30:31.488-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at org.apache.felix.framework.Felix.startBundle(Felix.java:1458)|#]
>
> [#|2009-05-26T23:30:31.489-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:984)|#]
>
> [#|2009-05-26T23:30:31.489-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at
> org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:263)|#]
>
> [#|2009-05-26T23:30:31.489-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at java.lang.Thread.run(Thread.java:637)|#]
>
> [#|2009-05-26T23:30:31.489-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|Caused
> by: javax.naming.NoInitialContextException: Cannot instantiate class:
> com.sun.enterprise.naming.impl.SerialInitContextFactory [Root
> exception is java.lang.ClassNotFoundException:
> com.sun.enterprise.naming.impl.SerialInitContextFactory]|#]
>
> [#|2009-05-26T23:30:31.489-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)|#]
>
> [#|2009-05-26T23:30:31.492-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at
> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)|#]
>
> [#|2009-05-26T23:30:31.493-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at javax.naming.InitialContext.init(InitialContext.java:223)|#]
>
> [#|2009-05-26T23:30:31.493-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at javax.naming.InitialContext.<init>(InitialContext.java:175)|#]
>
> [#|2009-05-26T23:30:31.493-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at
> com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.<init>(InjectionManagerImpl.java:88)|#]
>
> [#|2009-05-26T23:30:31.494-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> ... 33 more|#]
>
> [#|2009-05-26T23:30:31.495-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|Caused
> by: java.lang.ClassNotFoundException:
> com.sun.enterprise.naming.impl.SerialInitContextFactory|#]
>
> [#|2009-05-26T23:30:31.495-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at java.net
> <http://java.net>.URLClassLoader$1.run(URLClassLoader.java:200)|#]
>
> [#|2009-05-26T23:30:31.496-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at java.security.AccessController.doPrivileged(Native Method)|#]
>
> [#|2009-05-26T23:30:31.496-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at java.net
> <http://java.net.URLClassLoader.fi>.URLClassLoader.findClass(URLClassLoader.java:188)|#]
>
> [#|2009-05-26T23:30:31.497-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at java.lang.ClassLoader.loadClass(ClassLoader.java:316)|#]
>
> [#|2009-05-26T23:30:31.497-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)|#]
>
> [#|2009-05-26T23:30:31.497-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)|#]
>
> [#|2009-05-26T23:30:31.498-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at java.lang.Class.forName0(Native Method)|#]
>
> [#|2009-05-26T23:30:31.499-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at java.lang.Class.forName(Class.java:247)|#]
>
> [#|2009-05-26T23:30:31.503-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at
> com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:46)|#]
>
> [#|2009-05-26T23:30:31.503-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> at
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)|#]
>
> [#|2009-05-26T23:30:31.503-0700|SEVERE|glassfish|null|_ThreadID=11;_ThreadName=Thread-1;|
> ... 37 more|#]
>
> ------------------------------------------------------------------------
> *From:* Sahoo <Sahoo_at_Sun.COM>
> *To:* users_at_glassfish.dev.java.net
> *Sent:* Tuesday, May 26, 2009 12:49:14 PM
> *Subject:* Re: NoInitialContextException
>
> That class is there in modules/glassfish-naming.jar. So, something
> else is going wrong here. It appears that GlassFish naming manager is
> not currently designed to work in an OSGi environment. Did you do a
> new InitialContext() in your code? If yes, as a work around, just try
> doing a *new InitialContext(env)* where env contains the property
> name/value pair.
>
> Sahoo
>
> Annies wrote:
> > I have bundle that does some JNDI lookup. This used to work fine in
> V3 until recently.
> > Before using build 47, I used to set this property in Felix
> system.properties
> >
> java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory
> >
> > The class SerialInitContextFactory is not included in latest
> builds. How should I fix this?
> >
> >
> >
> [#|2009-05-26T12:17:57.375-0700|WARNING|glassfish|com.sun.jbi.sun-database-binding.org.glassfish.openesb.databasebc.OutboundMessageProcessor|_ThreadID=28;_ThreadName=Thread-1;|Failed
> to write message:.
> > javax.naming.NoInitialContextException: Need to specify class name
> in environment or system property, or as an applet parameter, or in an
> application resource file: java.naming.factory.initial
> > at
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
> > at
> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
> > at
> javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)
> > at javax.naming.InitialContext.lookup(InitialContext.java:392)
> > at
> org.glassfish.openesb.databasebc.OutboundMessageProcessor.getDataSourceFromContext(OutboundMessageProcessor.java:1289)
> > at
> org.glassfish.openesb.databasebc.OutboundMessageProcessor.getDatabaseConnection(OutboundMessageProcessor.java:1316)
> > at
> org.glassfish.openesb.databasebc.OutboundMessageProcessor.processInOnly(OutboundMessageProcessor.java:1079)
> > at
> org.glassfish.openesb.databasebc.OutboundMessageProcessor.execute(OutboundMessageProcessor.java:273)
> > at
> org.glassfish.openesb.databasebc.OutboundMessageProcessor.run(OutboundMessageProcessor.java:164)
> > at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
> > at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
> > at java.lang.Thread.run(Thread.java:637)
> > |#]
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> <mailto:users-unsubscribe_at_glassfish.dev.java.net>
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
> <mailto:users-help_at_glassfish.dev.java.net>
>
>
>