2015-11-19 129 views
1

我將一個glassfish項目轉換爲IBM WAS Liberty,非常困難我目前遇到訪問在Liberty中配置的連接池的問題(server.xml)利用jndi(jdbc/dataphile)。IBM WAS Liberty錯誤+缺失類型com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource

我週期性地得到一個缺少類型com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource錯誤。

下面是一些更增加的細節:

<library id="DB2JCC4Lib"> 
    <fileset dir="C:/MyApps/db2/jdbc" id="db-fileset" includes="db2jcc4-9.5.jar"/> 
</library> 

<dataSource id="dataSource" jndiName="jdbc/dataphile" type="javax.sql.DataSource"> 
    <jdbcDriver libraryRef="DB2JCC4Lib"/> 
    <connectionManager minPoolSize="2" numConnectionsPerThreadLocal="10"/> 
    <properties.db2.jcc databaseName="DUNDEEPD" id="DataphileProperties" password="username" portNumber="30001" serverName="xxx.xx.xxx.xxx" user="username"/> 
</dataSource> 

我的堆棧跟蹤低於;

[ERROR ] Context initialization failed 
Caused by: org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldException: warning can't determine modifiers of missing type com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource 
[Xlint:cantFindType] 
    at org.aspectj.weaver.reflect.ReflectionWorld$ExceptionBasedMessageHandler.handleMessage(ReflectionWorld.java:129) 
    at org.aspectj.weaver.Lint$Kind.signal(Lint.java:340) 
    at org.aspectj.weaver.MissingResolvedTypeWithKnownSignature.raiseCantFindType(MissingResolvedTypeWithKnownSignature.java:232) 
    at org.aspectj.weaver.MissingResolvedTypeWithKnownSignature.getModifiers(MissingResolvedTypeWithKnownSignature.java:104) 
    at org.aspectj.weaver.ResolvedType.isInterface(ResolvedType.java:876) 
    at org.aspectj.weaver.ResolvedType.getHierarchy(ResolvedType.java:355) 
    at org.aspectj.weaver.patterns.KindedPointcut.fastMatch(KindedPointcut.java:126) 
    at org.aspectj.weaver.internal.tools.PointcutExpressionImpl.couldMatchJoinPointsInType(PointcutExpressionImpl.java:84) 
    at org.springframework.aop.aspectj.AspectJExpressionPointcut.matches(AspectJExpressionPointcut.java:238) 
    at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:200) 
    at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:254) 
    at org.springframework.aop.support.AopUtils.findAdvisorsThatCanApply(AopUtils.java:286) 
    at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findAdvisorsThatCanApply(AbstractAdvisorAutoProxyCreator.java:117) 
    at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:87) 
    at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:68) 
    at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:359) 
    at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:322) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:407) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.postProcessObjectFromFactoryBean(AbstractAutowireCapableBeanFactory.java:1561) 
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:162) 
    ... 58 more 
+0

爲什麼你需要'WSJdbcDataSource',它是內部類,你不應該需要使用呢?附上您使用它的代碼片段。 – Gas

+0

你可以發佈你的堆棧跟蹤和你在server.xml中啓用的功能嗎?正如Gas提到的那樣,你是否試圖以某種方式訪問​​'WSJdbcDataSource'?或者你是從內部代碼中看到的。 –

+0

請理解,我沒有明確使用或調用WSJdbcDataSource,我只是在我的Liberty server.xml中聲明瞭一個數據連接池。通過將我的應用程序部署到Liberty,該部署未能提供以下例外。 – Sergio

回答

0

我有足夠的理論,爲什麼,但這是我如何從根本上如何解決我的問題:

原來,在我的春節,XML架構配置,我有以下幾點:

<jee:jndi-lookup id="dataSource" jndi-name="jdbc/mydatasource" /> 

但我不得不將其轉換爲以下幾點:

<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> 
     <property name="jndiName" value="jdbc/mydatasource" /> 
     <property name="lookupOnStartup" value="false"/> 
     <property name="cache" value="true" /> 
     <property name="proxyInterface" value="javax.sql.DataSource" /> 
</bean> 

所以基本上的建議,我不得不強制執行增加了以下特性此配置更改:

<property name="proxyInterface" value="javax.sql.DataSource" 

希望這幫助別人那裏 感謝

0

我不是專家在這一點,但在這裏報告了類似的問題:

https://developer.ibm.com/answers/questions/9498/datasource-issue-on-liberty-in-spring-hibernate-application.html

該解決方案需要添加此到數據源:

<property name="resourceRef" value="true" /> 
<property name="expectedType" value="javax.sql.DataSource"/> 
+0

我也讀過這篇文章。它不幸地要求你把這兩行放在你的bean數據源bean定義(spring)中,但是我沒有使用jndi.JndiObjectFactoryBean聲明任何數據源bean。 – Sergio

+0

@Sergio應該聲明一個使用jndi.JndiObjectFactoryBean的數據源bean嗎? –

+0

@aguibert我沒有必要在我的Glassfish項目版本中聲明使用JndiObjectFactoryBean的bean。所以我不確定現在是否需要遷移到Liberty? – Sergio

相關問題