Announcement Announcement Module
Collapse

Spring Dynamic Modules forum decommissioned in favor of Eclipse Gemini Blueprint

With the official first release of Eclipse Gemini Blueprint shipped, the migration of the Spring Dynamic Modules code base to the Eclipse Foundation, as part of the Gemini project, has been completed.

As such, this forum has been decommissioned in favour of the Eclipse Gemini forums.
See more
See less
Dependency hell (Class not found) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dependency hell (Class not found)

    Hi All,

    Thanks in advance,

    I been trying to solve this from many days now, and now I think my brain is stuck.
    Below is the error am getting.
    I posted the list of bundles I have and errors am getting including the bean xml I have

    ----------------------------------------------------------------------------

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:osgi="http://www.springframework.org/schema/osgi"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schem...ring-beans.xsd
    http://www.springframework.org/schema/osgi
    http://www.springframework.org/schema/osgi/spring-osgi.xsd">


    <bean id="dataSource"
    class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
    <property name="url" value="jdbc:mysql://localhost/accounts"/>
    <property name="username" value="root"/>
    <property name="password" value="xxxxxxx"/>
    </bean>

    <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate" >
    <constructor-arg><ref bean="dataSource" /></constructor-arg>
    </bean>
    <osgi:service ref="dataSource" interface="javax.sql.DataSource" />


    <bean id="contactsDao" init-method="show" destroy-method="stop"
    class="com.javaworld.osgi.spring.ContactsDaoImpl">
    <property name="dataSource" ref="dataSource" />
    </bean>



    </beans>

    -----------------------------------------------------------------------------

    id State Bundle
    0 ACTIVE org.eclipse.osgi_3.6.2.R36x_v20110210
    1 ACTIVE org.springframework.test_2.5.6.SEC01
    2 ACTIVE org.apache.commons.logging_1.0.4.v201005080501
    3 ACTIVE com.springsource.org.objectweb.asm_2.2.3
    4 RESOLVED com.springsource.slf4j.log4j_1.5.0
    Master=7
    5 ACTIVE org.springframework.core_2.5.6.SEC01
    6 ACTIVE org.springframework.osgi.core_1.2.1
    7 ACTIVE com.springsource.slf4j.api_1.5.0
    Fragments=4
    8 ACTIVE org.springframework.transaction_2.5.6
    9 ACTIVE com.springsource.com.mysql.jdbc_5.1.6
    10 ACTIVE com.springsource.net.sf.cglib_2.1.3
    11 ACTIVE org.springframework.context_2.5.6.SEC01
    12 ACTIVE HelloWorld_1.0.0.qualifier
    13 ACTIVE org.springframework.aop_2.5.6.SEC01
    14 ACTIVE org.springframework.jdbc_2.5.6
    15 ACTIVE org.springframework.osgi.io_1.2.1
    16 ACTIVE com.springsource.slf4j.org.apache.commons.logging_ 1.5.0
    17 ACTIVE com.springsource.org.apache.commons.pool_1.5.3
    18 ACTIVE javax.servlet_2.5.0.v200910301333
    19 ACTIVE com.springsource.org.apache.commons.dbcp_1.2.2.osg i
    20 ACTIVE org.springframework.beans_2.5.6.SEC01
    21 ACTIVE org.eclipse.osgi.services_3.2.100.v20100503
    22 ACTIVE org.springframework.osgi.extender_1.2.1
    23 ACTIVE com.springsource.org.aopalliance_1.0.0
    24 ACTIVE org.springframework.osgi.log4j.osgi_1.2.15.SNAPSHO T

    osgi> stop 12

    osgi> start 12

    osgi> Exception in thread "SpringOsgiExtenderThread-4" org.springframework.beans.factory.CannotLoadBeanCl assException: Cannot find class [org.springframework.jdbc.core.JdbcTemplate] for bean with name 'jdbcTemplate' defined in URL [bundleentry://12.fwk25860399/META-INF/spring/contactdao.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.jdbc.core.JdbcTemplate not found from bundle [HelloWorld]
    at org.springframework.beans.factory.support.Abstract BeanFactory.resolveBeanClass(AbstractBeanFactory.j ava:1141)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.predictBeanType(Abstrac tAutowireCapableBeanFactory.java:524)
    at org.springframework.beans.factory.support.Abstract BeanFactory.isFactoryBean(AbstractBeanFactory.java :1177)
    at org.springframework.beans.factory.support.Abstract BeanFactory.isFactoryBean(AbstractBeanFactory.java :758)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:422)
    at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:728)
    at org.springframework.osgi.context.support.AbstractD elegatedExecutionApplicationContext.access$1600(Ab stractDelegatedExecutionApplicationContext.java:69 )
    at org.springframework.osgi.context.support.AbstractD elegatedExecutionApplicationContext$4.run(Abstract DelegatedExecutionApplicationContext.java:355)
    at org.springframework.osgi.util.internal.PrivilegedU tils.executeWithCustomTCCL(PrivilegedUtils.java:85 )
    at org.springframework.osgi.context.support.AbstractD elegatedExecutionApplicationContext.completeRefres h(AbstractDelegatedExecutionApplicationContext.jav a:320)
    at org.springframework.osgi.extender.internal.depende ncies.startup.DependencyWaiterApplicationContextEx ecutor$CompleteRefreshTask.run(DependencyWaiterApp licationContextExecutor.java:132)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.ClassNotFoundException: org.springframework.jdbc.core.JdbcTemplate not found from bundle [HelloWorld]
    at org.springframework.osgi.util.BundleDelegatingClas sLoader.findClass(BundleDelegatingClassLoader.java :103)
    at org.springframework.osgi.util.BundleDelegatingClas sLoader.loadClass(BundleDelegatingClassLoader.java :156)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at org.springframework.util.ClassUtils.forName(ClassU tils.java:211)
    at org.springframework.beans.factory.support.Abstract BeanDefinition.resolveBeanClass(AbstractBeanDefini tion.java:385)
    at org.springframework.beans.factory.support.Abstract BeanFactory.resolveBeanClass(AbstractBeanFactory.j ava:1138)
    ... 11 more
    Caused by: java.lang.ClassNotFoundException: org.springframework.jdbc.core.JdbcTemplate
    at org.eclipse.osgi.internal.loader.BundleLoader.find ClassInternal(BundleLoader.java:506)
    at org.eclipse.osgi.internal.loader.BundleLoader.find Class(BundleLoader.java:422)
    at org.eclipse.osgi.internal.loader.BundleLoader.find Class(BundleLoader.java:410)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClass Loader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at org.eclipse.osgi.internal.loader.BundleLoader.load Class(BundleLoader.java:338)
    at org.eclipse.osgi.framework.internal.core.BundleHos t.loadClass(BundleHost.java:232)
    at org.eclipse.osgi.framework.internal.core.AbstractB undle.loadClass(AbstractBundle.java:1197)
    at org.springframework.osgi.util.BundleDelegatingClas sLoader.findClass(BundleDelegatingClassLoader.java :99)
    ... 16 more
    Last edited by linuxmank; Jul 11th, 2011, 02:23 AM. Reason: spelling mistake

  • #2
    Pleae use [ code][/code ] tags when posting code, that way it remains readable. Can you post your manifest file? You have included the correct import packages/bundles in your manifest didn't you? You are also mixing spring versions (judging from the bundles yu posted) in general this is a bad idea... Either use 2.5.6 or 2.5.6.SEC01 but don't mix jars...

    Comment


    • #3
      Hi Marten,

      Thanks for the reply. Below is the Manifest file
      Code:
      Manifest-Version: 1.0
      Bundle-ManifestVersion: 2
      Bundle-Name: HelloWorld
      Bundle-SymbolicName: HelloWorld
      Bundle-Version: 1.0.0.qualifier
      Bundle-RequiredExecutionEnvironment: JavaSE-1.6
      Import-Package: com.mysql.jdbc;version="5.1.6",
       com.mysql.jdbc.configs;version="5.1.6",
       com.mysql.jdbc.exceptions;version="5.1.6",
       org.apache.commons.dbcp;version="1.2.2.osgi",
       org.apache.commons.logging,
       org.springframework.beans;version="2.5.6.SEC01",
       org.springframework.core;version="2.5.6.SEC01",
       org.springframework.jdbc;version="2.5.6",
       org.springframework.jdbc.support;version="2.5.6",
       org.springframework.transaction;version="2.5.6"
      Thanks Again
      Appreciated
      Last edited by linuxmank; Jul 11th, 2011, 06:08 AM.

      Comment


      • #4
        Some more info

        It looks like I am able to use BasicDataSource to get connection and use jdbc but the moment i uncomment the below i get the above error

        Code:
        <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate" >
        <constructor-arg><ref bean="dataSource" /></constructor-arg>
        </bean>

        Comment

        Working...
        X