PDA

View Full Version : Can't resolve javax.transaction...


mburbidg
May 29th, 2008, 12:58 AM
I'm going along using the bundle repository resolving dependencies. I've downloaded many bundles from the repository and got them set up in my application. Then I suddenly get to one that I can't resolve no matter what I do.

My app needs javax.transaction.UserTransaction as is shown by the following exception:


Caused by: java.lang.NoClassDefFoundError: javax/transaction/UserTransaction
at org.quartz.impl.StdSchedulerFactory.instantiate(St dSchedulerFactory.java:1104)
at org.quartz.impl.StdSchedulerFactory.getScheduler(S tdSchedulerFactory.java:1355)
at org.springframework.scheduling.quartz.SchedulerFac toryBean.createScheduler(SchedulerFactoryBean.java :687)
at org.springframework.scheduling.quartz.SchedulerFac toryBean.afterPropertiesSet(SchedulerFactoryBean.j ava:582)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1367)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1333)
... 31 more


So I download com.springsource.javax.transaction-1.1.0.jar from the bundle repository and set it up to get loaded by eclipse as is shown in my config.ini below:


osgi.clean=true
osgi.startLevel=6
osgi.bundles.defaultStartLevel=5

##############################
# Client bundles to install
##############################
osgi.bundles=\
plugins/com.springsource.org.apache.commons.logging-1.1.1.jar,\
plugins/com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar,\
plugins/com.springsource.org.apache.commons.pool-1.3.0.jar,\
plugins/com.springsource.org.apache.commons.lang-2.4.0.jar,\
plugins/com.springsource.org.apache.commons.collections-3.2.0.jar,\
plugins/com.springsource.javax.transaction-1.1.0.jar,\
plugins/com.springsource.org.quartz-1.6.0.jar,\
plugins/slf4j-api-1.4.3.jar,\
plugins/slf4j-log4j12-1.4.3.jar,\
plugins/jcl104-over-slf4j-1.4.3.jar,\
plugins/servlet-api.osgi-2.5-SNAPSHOT.jar,\
plugins/com.adobe.clover.config.tomcat,\
plugins/catalina.osgi-5.5.23-SNAPSHOT.jar,\
plugins/catalina.start.osgi-1.0-SNAPSHOT.jar@:start,\
plugins/jasper.osgi-5.5.23-SNAPSHOT.jar@:start,\
plugins/jsp-api.osgi-2.0-SNAPSHOT.jar,\
plugins/spring-beans-2.5.4.jar@:start,\
plugins/spring-context-2.5.4.jar@:start,\
plugins/spring-context-support-2.5.4.jar@:start,\
plugins/spring-core-2.5.4.jar@:start,\
plugins/spring-aop-2.5.4.jar@:start,\
plugins/spring-tx-2.5.4.jar@:start,\
plugins/spring-web-2.5.4.jar@:start,\
plugins/spring-webmvc-2.5.4.jar@:start,\
plugins/aopalliance.osgi-1.0-SNAPSHOT.jar@:start,\
plugins/spring-osgi-io-1.1.0-rc1-SNAPSHOT.jar@:start,\
plugins/spring-osgi-core-1.1.0-rc1-SNAPSHOT.jar@:start,\
plugins/spring-osgi-extender-1.1.0-rc1-SNAPSHOT.jar@:start,\
plugins/spring-osgi-web-1.1.0-rc1-SNAPSHOT.jar@:start,\
plugins/spring-osgi-web-extender-1.1.0-rc1-SNAPSHOT.jar@:start,\
plugins/dandelion.war@:start


I also add the following to the manifest of my bundle:


Import-Bundle: com.springsource.javax.transaction;version="1.1.0"


When I run equinox with my configuration I get the exception shown above. If I use the console to show the status of the bundles, I can see that com.springsource.javax.transaction-1.1.0.jar has been resolved as is shown below:


State Bundle File Name
0 System Bundle
ACTIVE org.eclipse.osgi_3.3.2.R33x_v20080105
1 initial@reference:file:plugins/com.springsource.org.apache.commons.logging-1.1.1.jar/
RESOLVED com.springsource.org.apache.commons.logging_1.1.1
2 initial@reference:file:plugins/com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar/
RESOLVED com.springsource.org.apache.commons.dbcp_1.2.2.osg i
3 initial@reference:file:plugins/com.springsource.org.apache.commons.pool-1.3.0.jar/
RESOLVED com.springsource.org.apache.commons.pool_1.3.0
4 initial@reference:file:plugins/com.springsource.org.apache.commons.lang-2.4.0.jar/
RESOLVED com.springsource.org.apache.commons.lang_2.4.0
5 initial@reference:file:plugins/com.springsource.org.apache.commons.collections-3.2.0.jar/
RESOLVED com.springsource.org.apache.commons.collections_3. 2.0
6 initial@reference:file:plugins/com.springsource.javax.transaction-1.1.0.jar/
RESOLVED com.springsource.javax.transaction_1.1.0
7 initial@reference:file:plugins/com.springsource.org.quartz-1.6.0.jar/
RESOLVED com.springsource.org.quartz_1.6.0
8 initial@reference:file:plugins/slf4j-api-1.4.3.jar/
INSTALLED slf4j.api_1.4.3
9 initial@reference:file:plugins/slf4j-log4j12-1.4.3.jar/
INSTALLED slf4j.log4j12_1.4.3
10 initial@reference:file:plugins/jcl104-over-slf4j-1.4.3.jar/
INSTALLED jcl104.over.slf4j_1.4.3
11 initial@reference:file:plugins/servlet-api.osgi-2.5-SNAPSHOT.jar/
RESOLVED org.springframework.osgi.servlet-api.osgi_2.5.0.SNAPSHOT
12 initial@reference:file:plugins/com.adobe.clover.config.tomcat/
RESOLVED com.adobe.clover.config.tomcat_1.0.0
13 initial@reference:file:plugins/catalina.osgi-5.5.23-SNAPSHOT.jar/
RESOLVED org.springframework.osgi.catalina.osgi_5.5.23.SNAP SHOT
14 initial@reference:file:plugins/catalina.start.osgi-1.0-SNAPSHOT.jar/
ACTIVE org.springframework.osgi.catalina.start.osgi_1.0.0 .SNAPSHOT
15 initial@reference:file:plugins/jasper.osgi-5.5.23-SNAPSHOT.jar/
ACTIVE org.springframework.osgi.jasper.osgi_5.5.23.SNAPSH OT
16 initial@reference:file:plugins/jsp-api.osgi-2.0-SNAPSHOT.jar/
RESOLVED org.springframework.osgi.jsp-api.osgi_2.0.0.SNAPSHOT
17 initial@reference:file:plugins/spring-beans-2.5.4.jar/
ACTIVE org.springframework.bundle.spring.beans_2.5.4
18 initial@reference:file:plugins/spring-context-2.5.4.jar/
ACTIVE org.springframework.bundle.spring.context_2.5.4
19 initial@reference:file:plugins/spring-context-support-2.5.4.jar/
ACTIVE org.springframework.bundle.spring.context.support_ 2.5.4
20 initial@reference:file:plugins/spring-core-2.5.4.jar/
ACTIVE org.springframework.bundle.spring.core_2.5.4
21 initial@reference:file:plugins/spring-aop-2.5.4.jar/
ACTIVE org.springframework.bundle.spring.aop_2.5.4
22 initial@reference:file:plugins/spring-tx-2.5.4.jar/
ACTIVE org.springframework.bundle.spring.tx_2.5.4
23 initial@reference:file:plugins/spring-web-2.5.4.jar/
ACTIVE org.springframework.bundle.spring.web_2.5.4
24 initial@reference:file:plugins/spring-webmvc-2.5.4.jar/
ACTIVE org.springframework.bundle.spring.webmvc_2.5.4
25 initial@reference:file:plugins/aopalliance.osgi-1.0-SNAPSHOT.jar/
ACTIVE org.springframework.osgi.aopalliance.osgi_1.0.0.SN APSHOT
26 initial@reference:file:plugins/spring-osgi-io-1.1.0-rc1-SNAPSHOT.jar/
ACTIVE org.springframework.bundle.osgi.io_1.1.0.rc1-SNAPSHOT
27 initial@reference:file:plugins/spring-osgi-core-1.1.0-rc1-SNAPSHOT.jar/
ACTIVE org.springframework.bundle.osgi.core_1.1.0.rc1-SNAPSHOT
28 initial@reference:file:plugins/spring-osgi-extender-1.1.0-rc1-SNAPSHOT.jar/
ACTIVE org.springframework.bundle.osgi.extender_1.1.0.rc1-SNAPSHOT
29 initial@reference:file:plugins/spring-osgi-web-1.1.0-rc1-SNAPSHOT.jar/
ACTIVE org.springframework.bundle.osgi.web_1.1.0.rc1-SNAPSHOT
30 initial@reference:file:plugins/spring-osgi-web-extender-1.1.0-rc1-SNAPSHOT.jar/
ACTIVE org.springframework.bundle.osgi.web.extender_1.1.0 .rc1-SNAPSHOT
31 initial@reference:file:plugins/dandelion.war/
ACTIVE com.adobe.dandelion.services_1.0.0


I've followed the same steps to resolve at least a dozen bundle dependencies and now suddenly these steps don't work to resolve this one.

What am I doing wrong?

Thanks,
Michael-

Costin Leau
May 29th, 2008, 08:22 AM
I recall running into this problem some time ago and the solution was to clear the Equinox cache. I was using 3.3. It might not work in your case but just give it a try - remove the eclipse_config folder (that's the name I think) and start all over or use the -clean parameter.
Try reading the docs as there are several others parameters that might come in handy.

mburbidg
May 29th, 2008, 08:31 AM
I cleaned the and it didn't help.

Costin Leau
May 29th, 2008, 08:33 AM
Try starting from scratch or changing the Equinox version (use the latest stable). Add the bundles one by one and see if that helps. I ran in this case only once when using the console - it never occurred with the integration tests using the Spring-DM testing framework.

mburbidg
May 29th, 2008, 10:00 AM
I'm using the latest stable release of Equinox. My approach has been to add bundles one by one. It was going very smoothly till I got to this one.

It occurred to me that perhaps its not my bundle that doesn't have the right imports. How do you tell what bundle is missing an import. The stack trace would lead me to believe that perhaps it is the quartz bundle that isn't importing javax.transaction. After all it was quartz that was using the class javax.transaction.UserTransaction.

I uncompressed the quartz bundle and looked at the manifest. It did list javax.transaction as a package to import. So that's not the problem.

I'm not sure what to do. I guess I could go try Knoplerfish again. Ultimately I'm going to use equinox.

Costin Leau
May 29th, 2008, 10:08 AM
Check the wiring for javax.transaction - the JDK contains the package but not all the classes and subpackages (this is also documented in Spring-DM FAQ). To make sure you use the proper version, you should import version 1.1.0 or at least install javax.transaction before quartz since otherwise, quartz will probably use the JDK version (as Equinox exports the JDK packages automatically).

mburbidg
May 29th, 2008, 11:11 AM
I think the problem is that the quartz bundle that I got from the repository doesn't specify a version for javax.transaction. So it must trying to use the incomplete one from the JDK. I can specify versions all day long in my bundle, but that won't fix the quartz bundle.

Costin Leau
May 29th, 2008, 11:36 AM
You can raise that with the BRITS team but that shouldn't be an issue. No version means 0.0.0. If there is no version number on the import then the highest version available will be used so if you do have 1.1.0 that one should be picked up and not the one from JDK (which is unversioned meaning 0.0.0) assuming that 1.1.0 is available when the wiring is done.

mburbidg
May 29th, 2008, 12:29 PM
I expanded the quartz jar that I downloaded from BRITS (http://www.springsource.com/repository/app/), and added the version to the import in the manifest and repackaged it. That fixed the problem.

How do I bring this up with BRITS? What does BRITS stand for?

Costin Leau
May 29th, 2008, 12:35 PM
See the sticky thread: http://forum.springframework.org/showthread.php?t=53697
The tracker is available at : https://issuetracker.springsource.com/browse/BRITS (it should be also mentioned on BRITS FAQ).

Costin Leau
May 29th, 2008, 12:39 PM
Forgot to add, just to be clear:
BRITS = SpringSource Bundle Repository = S2BR

P.S. BRITS is used as an acronym, a pun since most of the work for it was/is done in UK.

mburbidg
May 29th, 2008, 04:54 PM
That's what I thought BRITS stood for.

Now I'm running into the following exception. My understanding is that this class is in the JDK 5.0. Which is what I'm using. So why do I get this?


java.lang.NoClassDefFoundError: javax/rmi/CORBA/Stub
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java :675)
at org.eclipse.osgi.internal.baseadaptor.DefaultClass Loader.defineClass(DefaultClassLoader.java:161)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManag er.defineClass(ClasspathManager.java:501)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManag er.findClassImpl(ClasspathManager.java:471)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManag er.findLocalClassImpl(ClasspathManager.java:430)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManag er.findLocalClass(ClasspathManager.java:413)
at org.eclipse.osgi.internal.baseadaptor.DefaultClass Loader.findLocalClass(DefaultClassLoader.java:189