Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » EclipseLink in RCP: javax.naming.NoInitialContextException
EclipseLink in RCP: javax.naming.NoInitialContextException [message #1071007] Fri, 19 July 2013 06:24
Christian Eugster is currently offline Christian EugsterFriend
Messages: 134
Registered: July 2009
Location: St. Gallen Switzerland
Senior Member
Hi,

I am using EclipseLink 2.5.0 in an rcp. The entity beans have an EntityListener annotated:

@MappedSuperclass

@EntityListeners(EntityMediator.class)
@ObjectTypeConverter(name = "booleanConverter", dataType = java.lang.Short.class, objectType = java.lang.Boolean.class, conversionValues = {
		@ConversionValue(dataValue = "0", objectValue = "false"),
		@ConversionValue(dataValue = "1", objectValue = "true") }, defaultObjectValue = "false")
public abstract class AbstractEntity implements Entity


I instantiate the PersistenceProvider manually and obtain from it the EntityManagerFactories. Starting my app there is an exception thrown when the tries to find an entity:

	@Override
	public T find(final Long id)
	{
		T entity = null;
		EntityManager entityManager = null;
		try
		{
			entityManager = this.connectionService.getEntityManager();
			if (entityManager != null)
			{
				entity = entityManager.find(this.getEntityClass(), id);
			}
		}
		catch (Exception e)
		{
		}
		return entity;
	}


The exception in question starts with the message:
[EL Finest]: jpa: 2013-07-19 08:09:57.639--ServerSession(568888)--Thread(Thread[Start Level Event Dispatcher,5,main])--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


What's going wrong here? Any hint is appreciated!

The full stacktrace is:

[EL Finest]: jpa: 2013-07-19 08:09:57.639--ServerSession(568888)--Thread(Thread[Start Level Event Dispatcher,5,main])--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(Unknown Source)
	at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
	at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
	at javax.naming.InitialContext.lookup(Unknown Source)
	at org.eclipse.persistence.internal.sessions.cdi.EntityListenerInjectionManagerImpl.<init>(EntityListenerInjectionManagerImpl.java:45)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at java.lang.Class.newInstance0(Unknown Source)
	at java.lang.Class.newInstance(Unknown Source)
	at org.eclipse.persistence.internal.sessions.AbstractSession.createEntityListenerInjectionManager(AbstractSession.java:1143)
	at org.eclipse.persistence.internal.sessions.AbstractSession.getEntityListenerInjectionManager(AbstractSession.java:2232)
	at org.eclipse.persistence.internal.jpa.metadata.listeners.EntityListener.createEntityListenerAndInjectDependancies(EntityListener.java:137)
	at org.eclipse.persistence.internal.jpa.metadata.listeners.EntityListener.constructListenerInstance(EntityListener.java:151)
	at org.eclipse.persistence.internal.jpa.metadata.listeners.EntityListener.getListener(EntityListener.java:234)
	at org.eclipse.persistence.internal.jpa.metadata.listeners.EntityListener.invokeMethod(EntityListener.java:350)
	at org.eclipse.persistence.internal.jpa.metadata.listeners.EntityListener.postClone(EntityListener.java:414)
	at org.eclipse.persistence.descriptors.DescriptorEventManager.notifyListener(DescriptorEventManager.java:730)
	at org.eclipse.persistence.descriptors.DescriptorEventManager.notifyEJB30Listeners(DescriptorEventManager.java:674)
	at org.eclipse.persistence.descriptors.DescriptorEventManager.executeEvent(DescriptorEventManager.java:229)
	at org.eclipse.persistence.internal.sessions.AbstractSession.executeDeferredEvents(AbstractSession.java:1447)
	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.cloneAndRegisterObject(UnitOfWorkImpl.java:1046)
	at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildWorkingCopyCloneNormally(ObjectBuilder.java:793)
	at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObjectInUnitOfWork(ObjectBuilder.java:730)
	at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:629)
	at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:587)
	at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:571)
	at org.eclipse.persistence.queries.ObjectLevelReadQuery.buildObject(ObjectLevelReadQuery.java:782)
	at org.eclipse.persistence.queries.ReadObjectQuery.registerResultInUnitOfWork(ReadObjectQuery.java:861)
	at org.eclipse.persistence.queries.ReadObjectQuery.executeObjectLevelReadQuery(ReadObjectQuery.java:532)
	at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:1155)
	at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:899)
	at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1114)
	at org.eclipse.persistence.queries.ReadObjectQuery.execute(ReadObjectQuery.java:429)
	at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1202)
	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2894)
	at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1797)
	at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1779)
	at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1730)
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.executeQuery(EntityManagerImpl.java:883)
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.findInternal(EntityManagerImpl.java:826)
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.find(EntityManagerImpl.java:719)
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.find(EntityManagerImpl.java:588)
	at ch.eugster.colibri.persistence.queries.AbstractQuery.find(AbstractQuery.java:58)
	at ch.eugster.colibri.persistence.queries.CommonSettingsQuery.findDefault(CommonSettingsQuery.java:13)
	at ch.eugster.colibri.persistence.connection.service.AbstractConnectionService.connect(AbstractConnectionService.java:401)
	at ch.eugster.colibri.persistence.connection.service.AbstractConnectionService.createEntityManager(AbstractConnectionService.java:388)
	at ch.eugster.colibri.persistence.connection.service.AbstractConnectionService.getEntityManager(AbstractConnectionService.java:648)
	at ch.eugster.colibri.persistence.queries.AbstractQuery.find(AbstractQuery.java:55)
	at ch.eugster.colibri.persistence.queries.CommonSettingsQuery.findDefault(CommonSettingsQuery.java:13)
	at ch.eugster.colibri.persistence.transfer.impl.services.TransferSchedulerImpl.activate(TransferSchedulerImpl.java:79)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:227)
	at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
	at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:346)
	at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:588)
	at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:196)
	at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:328)
	at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:221)
	at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:104)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
	at org.eclipse.equinox.internal.ds.InstanceProcess.registerService(InstanceProcess.java:504)
	at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:259)
	at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:328)
	at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:221)
	at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:104)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:950)
	at ch.eugster.colibri.persistence.connection.Activator.startPersistenceService(Activator.java:338)
	at ch.eugster.colibri.persistence.connection.Activator.start(Activator.java:306)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:389)
	at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1131)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:559)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:544)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:457)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:438)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

Previous Topic:Expression Builder Union With Sub Queries [2.5]
Next Topic:NullPointerException while using jaxb moxy
Goto Forum:
  


Current Time: Fri Dec 19 09:36:32 GMT 2014

Powered by FUDForum. Page generated in 0.02201 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software