Bug 296091 - Nullpointer in javax.persistence Activator
Nullpointer in javax.persistence Activator
Status: CLOSED DUPLICATE of bug 296010
Product: EclipseLink
Classification: RT
Component: JPA
2.0.0
Macintosh Mac OS X - Carbon (unsup.)
: P3 major (vote)
: ---
Assigned To: Project Inbox CLA Friend
osgi
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2009-11-25 03:44 EST by Anders Storsveen CLA Friend
Modified: 2009-11-27 11:46 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anders Storsveen CLA Friend 2009-11-25 03:44:42 EST
User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.3a1pre) Gecko/20091122 Minefield/3.7a1pre
Build Identifier: 

[Framework Event Dispatcher] DEBUG org.eclipse.persistence.core - BundleEvent STARTED
[Start Level Event Dispatcher] DEBUG org.eclipse.persistence.jpa - ServiceEvent REGISTERED
[Start Level Event Dispatcher] DEBUG org.eclipse.persistence.javax.persistence.osgi - org.eclipse.persistence.javax.persistence.osgi::javax.persistence - starting...
[Framework Event Dispatcher] DEBUG org.eclipse.persistence.jpa - BundleEvent STARTED
[Framework Event Dispatcher] DEBUG org.eclipse.persistence.asm - BundleEvent STARTED
[Framework Event Dispatcher] DEBUG javax.persistence - BundleEvent STOPPED
[Framework Event Dispatcher] DEBUG javax.persistence - FrameworkEvent ERROR
org.osgi.framework.BundleException: Exception in org.eclipse.persistence.javax.persistence.osgi.Activator.start() of bundle javax.persistence.
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:806)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:755)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:352)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:370)
	at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1068)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:557)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:464)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:248)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:445)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:337)
Caused by: java.lang.NullPointerException
	at org.eclipse.persistence.javax.persistence.osgi.Activator.addProvider(Unknown Source)
	at org.eclipse.persistence.javax.persistence.osgi.ProviderTrackerCustomizer.addingService(Unknown Source)
	at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:896)
	at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:261)
	at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:184)
	at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:339)
	at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:273)
	at org.eclipse.persistence.javax.persistence.osgi.Activator.start(Unknown Source)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:783)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:774)
	... 10 more
[Framework Event Dispatcher] DEBUG com.springsource.javax.resource - BundleEvent STARTED
[Framework Event Dispatcher] DEBUG no.telenorobjects.accesscontrol.rac.api - BundleEvent STARTED
[Framework Event Dispatcher] DEBUG org.eclipse.osgi - BundleEvent STARTED
[Framework Event Dispatcher] DEBUG org.eclipse.osgi - FrameworkEvent STARTED
[Framework Event Dispatcher] DEBUG org.eclipse.osgi - FrameworkEvent STARTLEVEL CHANGED


Framework is launched.

id	State       Bundle
0	ACTIVE      org.eclipse.osgi_3.5.1.R35x_v20090827
1	ACTIVE      no.telenorobjects.accesscontrol.rac.impl_1.0.0.SNAPSHOT
2	ACTIVE      com.springsource.oracle.jdbc_10.2.0.2
3	ACTIVE      org.eclipse.persistence.core_2.0.0.v20091121-r5847
4	ACTIVE      org.eclipse.persistence.jpa_2.0.0.v20091121-r5847
5	ACTIVE      org.eclipse.persistence.asm_2.0.0.v20091121-r5847
6	RESOLVED    javax.persistence_2.0.0.v200911041116
7	ACTIVE      com.springsource.javax.resource_1.5.0
8	ACTIVE      no.telenorobjects.accesscontrol.rac.api_1.0.0.SNAPSHOT
9	ACTIVE      org.coosproject.messaging.j2se_1.1.0.SNAPSHOT
10	ACTIVE      osgi.cmpn_4.2.0.200908310645
11	ACTIVE      org.ops4j.pax.logging.pax-logging-api_1.4.0
12	ACTIVE      org.ops4j.pax.logging.pax-logging-service_1.4.0
13	ACTIVE      org.coosproject.messaging.org.apache.xmlbeans.xmlbeans_2.4.0
14	ACTIVE      org.coosproject.util-j2se_1.1.0.SNAPSHOT
15	ACTIVE      org.coosproject.api_1.1.0.SNAPSHOT
16	ACTIVE      org.coosproject.extender_1.1.0.SNAPSHOT


Reproducible: Always

Steps to Reproduce:
1. Install bundles
2. Start them
Comment 1 Anders Storsveen CLA Friend 2009-11-25 04:09:33 EST
This seems to be because persistence.jpa is started before javax.persistence. this seems to mean that this code is buggy:

        // Provider bundles should require this bundle to be started before
        // they start, so it is very unlikely that provider bundles will have
        // already loaded and registered but we'll do this just in case...
        ServiceReference[] refs = null;
        try {
            refs = ctx.getServiceReferences(PERSISTENCE_PROVIDER, null);
        } catch (InvalidSyntaxException invEx) {
        } // Can't happen since filter is null
        if (refs != null) {
            for (ServiceReference ref : refs) {
                addProvider(ref);
            }
        }

I am however running this in pax:provision, which means it's hard to control startup so this should probably be fixed.
Comment 2 Anders Storsveen CLA Friend 2009-11-25 04:19:25 EST
ok, since my theory of stopping jpa and starting javax.persistence first and then starting jpa again worked, I just assumed it was that code that failed because of the comments. after checking the stack trace closer it seems that it's this code that fails:

        // Set up a tracker to add providers as they register themselves                                                  
        ServiceTrackerCustomizer customizer = new ProviderTrackerCustomizer(this);
        serviceTracker = new ServiceTracker(ctx, PERSISTENCE_PROVIDER, customizer);
        serviceTracker.open();


Seems that open get's a hold of this via the customizer and then does addProvider from there.
Comment 3 Shaun Smith CLA Friend 2009-11-27 11:46:51 EST

*** This bug has been marked as a duplicate of bug 296010 ***