本文介绍了java.lang.ClassNotFoundException:com.ibm.ws.rsadapter.jdbc.WSJdbcConnection的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将WAS自由rutime配置文件与Eclipse Luna一起使用.

I am trying to use WAS liberty rutime profile with eclipse Luna.

我的环境:

我的应用程序使用的是Spring Framework 2.5,配置文件如下.

My application using spring framework 2.5, and configuration file as below.

<!-- For Oracle and Websphere; you need to use this lob handler definition instead of defaultLobHandler. Because of differences in Oracle's Blob objects. -->
<bean id="oracleLobHandler" class="org.springframework.jdbc.support.lob.OracleLobHandler" >
    <property name="nativeJdbcExtractor" >
        <bean class="org.springframework.jdbc.support.nativejdbc.WebSphereNativeJdbcExtractor"/>
    </property>
</bean>

但是,当我将应用程序部署到Liberty Profile(LP)中时.由于某种原因,该类无法正确加载.

however when I deploy my application into Liberty Profile (LP). for some reason the class can not be loaded properly.

我可以在com.ibm.ws.jdbc_1.0.8.jar文件和{server.home}/lib文件夹下的jar文件中找到此类.据我了解,该库应自动加载.

I can find this class in com.ibm.ws.jdbc_1.0.8.jar file, and this jar file located under {server.home}/lib folder. As I understand this library should be loaded automatically.

错误日志的详细信息:

[ERROR   ] SRVE0283E: Exception caught while initializing context: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'oracleLobHandler' defined in ServletContext resource [/WEB-INF/dataAccessContext.xml]: Cannot create inner bean 'org.springframework.jdbc.support.nativejdbc.WebSphereNativeJdbcExtractor#fff379a3' of type [org.springframework.jdbc.support.nativejdbc.WebSphereNativeJdbcExtractor] while setting bean property 'nativeJdbcExtractor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.jdbc.support.nativejdbc.WebSphereNativeJdbcExtractor#fff379a3' defined in ServletContext resource [/WEB-INF/dataAccessContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.jdbc.support.nativejdbc.WebSphereNativeJdbcExtractor]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Could not initialize WebSphereNativeJdbcExtractor because WebSphere API classes are not available: java.lang.ClassNotFoundException: com.ibm.ws.rsadapter.jdbc.WSJdbcConnection
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:282)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:121)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1391)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1132)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:607)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
    at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:2388)
    at [internal classes]
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.jdbc.support.nativejdbc.WebSphereNativeJdbcExtractor]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Could not initialize WebSphereNativeJdbcExtractor because WebSphere API classes are not available: java.lang.ClassNotFoundException: com.ibm.ws.rsadapter.jdbc.WSJdbcConnection
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1004)
    ... 21 more
Caused by: java.lang.IllegalStateException: Could not initialize WebSphereNativeJdbcExtractor because WebSphere API classes are not available: java.lang.ClassNotFoundException: com.ibm.ws.rsadapter.jdbc.WSJdbcConnection
    at org.springframework.jdbc.support.nativejdbc.WebSphereNativeJdbcExtractor.<init>(WebSphereNativeJdbcExtractor.java:65)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:56)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:527)
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148)

任何对此问题的想法都很感激.我真的很痛苦.

Any ideas on this issue really appreciate. I really got pain with this one.

非常感谢.

推荐答案

您是否在server.xml中启用了jdbc功能?如果您最近安装了Liberty,建议您启用webProfile-6.0功能,该功能是许多常用功能的组合.

Do you have the jdbc feature enabled in your server.xml? If you have a recent Liberty installation, I would recommend enabling the webProfile-6.0 feature, which is a combination of many commonly used features.

这篇关于java.lang.ClassNotFoundException:com.ibm.ws.rsadapter.jdbc.WSJdbcConnection的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 17:35