lundi 20 avril 2015

Can't store BLOB using Oracle + Spring + Liberty profile

I receive ClassNotFoundException : oracle.sql.BLOB exception storing blob in DB. Here is my conf:

<bean id="nativeJdbcExtractor"      class="org.springframework.jdbc.support.nativejdbc.CommonsDbcpNativeJdbcExtractor" />
<bean id="lobHandler" class="org.springframework.jdbc.support.lob.OracleLobHandler">
<property name="nativeJdbcExtractor" ref="nativeJdbcExtractor" /> 
</bean>

<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="DataBase" /> 
</bean>

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

I changed it like this:

<bean id="nativeJdbcExtractor" class="org.springframework.jdbc.support.nativejdbc.WebSphereNativeJdbcExtractor"/>

and now I receive:

[ERROR ] Context initialization failed
Error creating bean with name 'clusterizer': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private ru.sbrf.indexer.dao.ClusterizerDao ru.sbrf.indexer.ClusterizerProcessor.clusterizerDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clusterizerDao': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.jdbc.support.lob.LobHandler ru.sbrf.indexer.dao.ClusterizerDao.lobHandler; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lobHandler' defined in ServletContext resource [/WEB-INF/spring/ds.xml]: Cannot resolve reference to bean 'nativeJdbcExtractor' while setting bean property 'nativeJdbcExtractor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'nativeJdbcExtractor' defined in ServletContext resource [/WEB-INF/spring/ds.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [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
[ERROR ] SRVE0283E: При инициализации контекста возникла исключительная ситуация: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clusterizer': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private ru.sbrf.indexer.dao.ClusterizerDao ru.sbrf.indexer.ClusterizerProcessor.clusterizerDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clusterizerDao': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.jdbc.support.lob.LobHandler ru.sbrf.indexer.dao.ClusterizerDao.lobHandler; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lobHandler' defined in ServletContext resource [/WEB-INF/spring/ds.xml]: Cannot resolve reference to bean 'nativeJdbcExtractor' while setting bean property 'nativeJdbcExtractor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'nativeJdbcExtractor' defined in ServletContext resource [/WEB-INF/spring/ds.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [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.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1210)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:2223)
at [internal classes]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [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:89)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1094)
... 51 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:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
... 53 more

but I can't find this com.ibm.ws.rsadapter.jdbc.WSJdbcConnection in LP and I don't want copy all dependencies from WAS. How do I store data in Liberty profile?

Aucun commentaire:

Enregistrer un commentaire