1

I'm converting a glassfish project over to IBM WAS Liberty, with much difficulty I am presently having an issue accessing my connection pool configured in Liberty (server.xml) utilizing jndi (jdbc/dataphile).

I contuinually get a missing type com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource error.

Here is some more added detail:

<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>

My stack trace is below;

[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
Andy Guibert
  • 41,446
  • 8
  • 38
  • 61
Sergio
  • 95
  • 9
  • Why do you need `WSJdbcDataSource`, it is internal class and you shouldn't be needing to use that? Attach code fragment where you are using it. – Gas Nov 19 '15 at 21:45
  • Can you post your stack trace and features you have enabled on your server.xml? And as Gas mentioned, are you actually trying to access `WSJdbcDataSource` somehow? Or are you just seeing that from internal code. – Andy Guibert Nov 20 '15 at 00:08
  • Please understand, I'm not explicitly using or calling WSJdbcDataSource, I'm simply declaring a data connection pool in my Liberty server.xml. By just deploying my application to Liberty, the deployment fails giving the following exception. – Sergio Nov 20 '15 at 18:39
  • My stack trace is below:Caused by: org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldException: warning can't determine modifiers of missing type com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource [Xlint:cantFindType] – Sergio Nov 20 '15 at 18:41
  • @Sergio that is only the exception cause, not the full stack trace. Also, you will need to update your original post with more information about how your deployment process. The information you provided is not enough to determine the problem. – Andy Guibert Nov 20 '15 at 18:44
  • @aguibert I can and am willing to post the entire stack trace, however it will not fit in these comment windows as there is a text limit. Please advise – Sergio Nov 20 '15 at 19:04
  • @Sergio edit your original post =) much easier to see it there anyways since it has proper formatting and people don't have to dig through comments. – Andy Guibert Nov 20 '15 at 20:15
  • @aguibert I have added the stack trace into the original post as per your suggestion. – Sergio Nov 20 '15 at 20:17

3 Answers3

0

I am not an expert on this but a similar problem was reported here:

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

The solution required adding this to the datasource:

<property name="resourceRef" value="true" />
<property name="expectedType" value="javax.sql.DataSource"/>
mmulholl
  • 281
  • 2
  • 7
  • I have read this post also. it unfortunately asks you to place those two lines in your bean datasource bean definition (spring), but I have not declared any datasource bean utilizing jndi.JndiObjectFactoryBean. – Sergio Nov 20 '15 at 18:50
  • @Sergio should you be declaring a datasource bean that uses jndi.JndiObjectFactoryBean? – Andy Guibert Nov 22 '15 at 17:17
  • @aguibert I have not needed to declare any bean that utilizes JndiObjectFactoryBean in my Glassfish project version. So I'm not certain if now that is required to port to Liberty? – Sergio Nov 23 '15 at 14:45
0

Try creating META-INF/aop.xml file as described in the following post: Why aspect j can't weave show Xlint cantFindType and exclude the com.ibm.ws.rsadapter.jdbc.* classes or better yet, include only your application classes.

Community
  • 1
  • 1
jgawor
  • 96
  • 3
0

I do have enough theory as to why, but this is how I fundamentally how to fix my issue:

Originally, in my Spring XML schema configuration, I had the following:

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

But I had to convert it to the following:

<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>

So essentially as suggested I had to enforce this configuration change which added the following properties:

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

Hopefully that help someone else out there Thanks

Sergio
  • 95
  • 9