`

the type org.springframework.dao.support.daosuppor

    博客分类:
  • OSGI
阅读更多
I am using only the 3rd party bundles from the revision 6343, spring-osgi-core, spring-osgi-extender, io and mock are from revision 6170. (I've got compilation errors on the new version)... anyway:

The thing is that I've got a lot of class not found errors when I try to use hibernate3 and spring-hibernate3.


Bundle H is the actual hibernate bundle, which exports all the org.hibernate packages...

Bundle A has .hbm.xml, has DAO's and is using springs HibernateTemplate by extending the class HibernateDaoSupport. Actually I just need to import org.springframework.orm.hibernate3.support package to A, but I needed some more:

org.springframework.core,
org.springframework.orm.hibernate3,
org.springframework.beans.factory,
org.springframework.dao.support.DaoSupport,
org.hibernate.proxy,

This are lots of unneccessary imports for my own bundle, it seems that a lot of them are requiered indirectly by other parts of spring(-osgi)... please double check that, because a plug-in developer for my own application, which wants to use some of my DAO's in its own bundle doesn't really want to import some stuff he doesn't know about.... he just wants to import packages that he/she is using directly....

The spring-hibernate3 bundle needed also some more imports from the actual hibernate3 bundle:

org.hibernate.exception,
org.hibernate.loader.custom,
org.hibernate.engine.query.sql,
package org.hibernate.collection

spring-hibernate3 bundle seems to be incomplete... a good solution would be to import all real hibernate3 packages... please double check that, too.

The above description is just a summary of my protocal I wrote besides I resolved the errors. Here it is (from top to the bottom):

---

Invocation of init method failed; nested exception is net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
Caused by:
net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
....
Caused by: java.lang.NoClassDefFoundError: org/hibernate/proxy/HibernateProxy
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)


Solution:

Adding the package org.hibernate.proxy to my own bundle, where the DAO's are present. This shouldn't be the case,
because I just want to import packages that I directly use.

---

java.lang.NoClassDefFoundError: org/hibernate/exception/GenericJDBCException
Caused by:
java.lang.NoClassDefFoundError: org/hibernate/exception/GenericJDBCException
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.updateDatabaseSchema(LocalSessionFactoryBean.java:940)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterSessionFactoryCreation(LocalSessionFactoryBean.java:833)
...

Solution:

Adding to the imports of spring-hibernate3 manifest the package org.hibernate.exception

---

java.lang.NoClassDefFoundError: org.hibernate.loader.custom.CustomQuery
Caused by:
java.lang.NoClassDefFoundError: org.hibernate.loader.custom.CustomQuery
at $Proxy1.<clinit>(Unknown Source)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
...

Solution:

Adding to the imports of spring-hibernate3 manifest the package org.hibernate.loader.custom

---

java.lang.NoClassDefFoundError: org.hibernate.engine.query.sql.NativeSQLQuerySpecification
Caused by:
java.lang.NoClassDefFoundError: org.hibernate.engine.query.sql.NativeSQLQuerySpecification
at $Proxy1.<clinit>(Unknown Source)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
...

Solution:

Adding to the imports of spring-hibernate3 manifest the package org.hibernate.engine.query.sql

---

java.lang.NoClassDefFoundError: org.hibernate.collection.PersistentCollection
Caused by:
java.lang.NoClassDefFoundError: org.hibernate.collection.PersistentCollection
at $Proxy1.<clinit>(Unknown Source)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
...

Solution:

Adding to the imports of spring-hibernate3 manifest the package org.hibernate.collection

---

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'vorlesungsDAO' defined in OSGi bundle resource [id=2|symName=de.fhbrs.aloe.core|bundle-url:bundleentry://2/META-INF/spring/bundle-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [de.fhbrs.aloe.core.model.dao.VorlesungsDAO]: Constructor threw exception; nested exception is java.lang.Error: Unresolved compilation problems:
The hierarchy of the type VorlesungsDAO is inconsistent
The type org.springframework.dao.support.DaoSupport cannot be resolved. It is indirectly referenced from required .class files
The type org.springframework.dao.DataAccessException cannot be resolved. It is indirectly referenced from required .class files
Access restriction: The method save(Object) from the type HibernateTemplate is not accessible due to restriction on required library spring-hibernate3/target/classes/

Caused by:
org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [de.fhbrs.aloe.core.model.dao.VorlesungsDAO]: Constructor threw exception; nested exception is java.lang.Error: Unresolved compilation problems:
The hierarchy of the type VorlesungsDAO is inconsistent
The type org.springframework.dao.support.DaoSupport cannot be resolved. It is indirectly referenced from required .class files
The type org.springframework.dao.DataAccessException cannot be resolved. It is indirectly referenced from required .class files
Access restriction: The method save(Object) from the type HibernateTemplate is not accessible due to restriction on required library spring-hibernate3/target/classes/

Caused by:
java.lang.Error: Unresolved compilation problems:
The hierarchy of the type VorlesungsDAO is inconsistent
The type org.springframework.dao.support.DaoSupport cannot be resolved. It is indirectly referenced from required .class files
The type org.springframework.dao.DataAccessException cannot be resolved. It is indirectly referenced from required .class files
Access restriction: The method save(Object) from the type HibernateTemplate is not accessible due to restriction on required library spring-hibernate3/target/classes/

at de.fhbrs.aloe.core.model.dao.VorlesungsDAO.<init>(VorlesungsDAO.java:10)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
...

Eclipse is complaining the same thing.

DAO class:
public class myDAO extends HibernateDaoSupport implements IVorlesungsDAO { .. }

Imports from DAO bundle so far:
Import-Package: org.hibernate.proxy, org.springframework.orm.hibernate3.support;specification-version="2.1.0.SNAPSHOT-202-2"


Solution:

adding to my DAO bundle manifest the package org.springframework.dao.support.DaoSupport. This shouldn't be the case,
because I just want to import packages that I directly use.

---

next problem is the same, but with package org.springframework.beans.factory:

Caused by:
java.lang.Error: Unresolved compilation problems:
The hierarchy of the type VorlesungsDAO is inconsistent
The type org.springframework.beans.factory.InitializingBean cannot be resolved. It is indirectly referenced from required .class files
Access restriction: The method save(Object) from the type HibernateTemplate is not accessible due to restriction on required library spring-hibernate3/target/classes/


Solution:

adding to my DAO bundle manifest the package org.springframework.beans.factory. This shouldn't be the case,
because I just want to import packages that I directly use.

---

Eclipse complains:

Access restriction: The method save(Object) from the type HibernateTemplate is not accessible due to restriction on required library spring-hibernate3/target/classes/ de.fhbrs.aloe.core/src/main/java/de/fhbrs/aloe/core/model/dao

Solution:

Adding the package org.springframework.orm.hibernate3 to my own bundle, where the DAO's are present. This shouldn't be the case,
because I just want to import packages that I directly use.

---

Eclipse complains:

The project was not built since its build path is incomplete. Cannot find the class file for org.springframework.core.NestedRuntimeException. Fix the build path then try building this project

Solution:

Adding the package org.springframework.core to my own bundle, where the DAO's are present. This shouldn't be the case,
because I just want to import packages that I directly use.
分享到:
评论

相关推荐

    解决The type org.springframework.dao.support.DaoSupport cannot be resolved.bao报错

    在开发Spring框架相关的Java应用时,可能会遇到"The type org.springframework.dao.support.DaoSupport cannot be resolved"的错误提示。这个错误通常意味着编译环境无法找到`DaoSupport`类,这是Spring DAO模块中的...

    org.spring-framework-3.0.4. 所有jar

    org.springframework.context.support-3.0.4.RELEASE.jar org.springframework.context-3.0.4.RELEASE.jar org.springframework.core-3.0.4.RELEASE.jar org.springframework.expression-3.0.4.RELEASE.jar org....

    org.springframework.flex-1.0.3.RELEASE.jar.zip

    org.springframework.flex-1.0.3.RELEASE.jar.zip用于JAR包,org.springframework.flex-1.0.3.RELEASE.jar.zip用于JAR包org.springframework.flex-1.0.3.RELEASE.jar.zip用于JAR包org.springframework.flex-1.0.3....

    org.springframework.core.jar

    5. **排序与比较**:`org.springframework.core.order`和`org.springframework.core.type`包提供了排序算法和类型比较机制,对于Spring容器中bean的排序和类型检查起到了关键作用。 6. **事件驱动**:`org.spring...

    spring-web-2.5.jar

    org.springframework.remoting.jaxrpc.support.AxisBeanMappingServicePostProcessor.class org.springframework.remoting.jaxws.JaxWsPortClientInterceptor.class org.springframework.remoting.jaxws....

    spring3.0.5 所有jar文件

    org.springframework.context.support-3.0.5.RELEASE.jar org.springframework.core-3.0.5.RELEASE.jar org.springframework.expression-3.0.5.RELEASE.jar org.springframework.instrument-3.0.5.RELEASE.jar org....

    org.springframework.core_3.1.1.RELEASE.jar

    7. `org.springframework.core.type`: 提供了类型扫描和类型分析的工具,是Spring自动配置和组件扫描的基础。 三、3.1.1.RELEASE版本的改进 在`3.1.1.RELEASE`版本中,Spring对核心模块进行了一些优化: 1. 更强的...

    org.springframework.context.support-3.1.0.M1.jar

    org.springframework.context.support-3.1.0.M1.jar包,无毒下载

    org.springframework.web的jar包.zip

    在本篇文章中,我们将深入探讨`org.springframework.web`包中的关键概念,特别是`ServerEndpointExporter`类在WebSocket服务器端点中的作用。 首先,让我们了解`org.springframework.web`包的基本构成。这个包主要...

    spring3.1 官方全部jar包

    org.springframework.context.support-3.1.RELEASE.jar org.springframework.context-3.1.RELEASE.jar org.springframework.core-3.1.RELEASE.jar org.springframework.expression-3.1.RELEASE.jar org.spring...

    spring-mock.jar

    org.springframework.mock.jndi.ExpectedLookupTemplate.class org.springframework.mock.jndi.SimpleNamingContext.class org.springframework.mock.jndi.SimpleNamingContextBuilder.class org.springframework....

    org.springframework.web.jar

    9. **Integration with other Spring Modules**:`org.springframework.web.jar`与Spring框架的其他模块紧密集成,如Spring Core、Spring Beans、Spring AOP等,共同构建出一个完整的应用框架。 总的来说,`org....

    aopalliance-1.0.jar,org.springframework.aop-3.0.0.RELEASE.jar

    aopalliance-1.0.jar,org.springframework.aop-3.0.0.RELEASE.jar,org.springframework.jdbc-3.0.0.RELEASEorg.springframework.beans-3.0.0.RELEASE.jar等

    org.springframework.web.servlet-3.0.1.RELEASE-A.jar

    Error creating bean with name 'org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#0' defined in ServletContext resource [/WEB-INF/springMVC-servlet.xml]: Initialization of bean failed;...

    org.springframework.transaction-3.1.2.RELEASE.zip

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.interceptor.TransactionInterceptor#0': Error setting property values; nested ...

    org.springframework.test-3.0.2.RELEASE.jar

    《Spring框架测试模块详解——基于org.springframework.test-3.0.2.RELEASE.jar》 Spring框架是Java领域中广泛使用的轻量级应用框架,它以其模块化、灵活的配置和强大的功能深受开发者喜爱。在Spring的众多模块中,...

    org.springframework.dao.InvalidDataAccessApiUsageException

    ### 关于 `org.springframework.dao.InvalidDataAccessApiUsageException` 的深入解析 在Spring与Hibernate集成开发过程中,开发者可能会遇到各种各样的异常问题。其中一种较为常见的异常是 `org.springframework....

    org.springframework.context-3.1.1.RELEASE.jar

    org.springframework.context-3.1.1.RELEASE.jar java 开发专用

    通过import org.springframework.web.multipart.MultipartFile;上传文件

    通过import org.springframework.web.multipart.MultipartFile;上传文件的一个工具性的jar.

    spring3.1.1jar及其关联jar

    org.springframework.context.support-3.1.1.RELEASE org.springframework.context-3.1.1.RELEASE org.springframework.core-3.1.1.RELEASE org.springframework.expression-3.1.1.RELEASE org.springframework....

Global site tag (gtag.js) - Google Analytics