FAQ

[ServiceMix-users] Failed to convert property value to required type 'org.aopalliance.aop.Advice' for property 'advice'

Srini
Oct 8, 2012 at 5:06 pm
Hi, I am facing issues with migrating servicemix3 SA (JBI based) to
servicemix 4.4.2.

Servicemix4 is throwing errors while loading Spring configurations of an SU
whch is using interceptors.
Error: Error creating bean with name 'retryInterceptor' defined in URL
[file:C:/spring-config.xml]: Initialization of bean failed; nested exception
is org.springframework.beans.ConversionNotSupportedException: Failed to
convert property value of type 'my.DAOInterceptor' to required type
'org.aopalliance.aop.Advice' for property 'advice'; nested exception is
java.lang.IllegalStateException: Cannot convert value of type
[my.DAOInterceptor] to required type [org.aopalliance.aop.Advice] for
property 'advice': no matching editors or conversion strategy found
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)

Additional Details:
1. I am trying to deploy smx3 SA(zip file) as-is after installing JBI
feature in smx4.
2. my.DAOInterceptor is implementing
org.aopalliance.intercept.MethodInterceptor;
3. Configuration in spring-config.xml:
<bean id="retryDAOInterceptor" class="my.DAOInterceptor"/>
<bean id="retryInterceptor"
class="org.springframework.aop.support.RegexpMethodPointcutAdvisor">
<property name="advice" ref="retryDAOInterceptor"/>
<property name="pattern">
<value>.*</value>
</property>
</bean>
4. Project is using spring 2.5.6. I have tried with spring 3.0.6 but getting
same error.
5. It does not appear to be an issue with multiple jars in classpath, as
removing aopalliance-1.0.jar from the SA is resulting in ClassNotFound
exception during deployment.
6. The same SA deploys successfully in smx3.3

Any help would be greatly appreciated.
reply

Search Discussions

9 responses

  • Srini at Oct 8, 2012 at 5:41 pm
    Hi, I am facing issues with migrating servicemix3 SA (JBI based) to
    servicemix 4.4.2.

    Servicemix4 is throwing errors while loading Spring configurations of an SU
    whch is using interceptors.
    Error: Error creating bean with name 'retryInterceptor' defined in URL
    [file:C:/spring-config.xml]: Initialization of bean failed; nested exception
    is org.springframework.beans.ConversionNotSupportedException: Failed to
    convert property value of type 'my.DAOInterceptor' to required type
    'org.aopalliance.aop.Advice' for property 'advice'; nested exception is
    java.lang.IllegalStateException: Cannot convert value of type
    [my.DAOInterceptor] to required type [org.aopalliance.aop.Advice] for
    property 'advice': no matching editors or conversion strategy found
    at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
    at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)

    Additional Details:
    1. I am trying to deploy smx3 SA(zip file) as-is after installing JBI
    feature in smx4.
    2. my.DAOInterceptor is implementing
    org.aopalliance.intercept.MethodInterceptor;
    3. Configuration in spring-config.xml:
    <bean id="retryDAOInterceptor" class="my.DAOInterceptor"/>
    <bean id="retryInterceptor"
    class="org.springframework.aop.support.RegexpMethodPointcutAdvisor">
    <property name="advice" ref="retryDAOInterceptor"/>
    <property name="pattern">
    <value>.*</value>
    </property>
    </bean>

    --my.DAOInterceptor is implementing
    org.aopalliance.intercept.MethodInterceptor.
    4. Project is using spring 2.5.6. I have tried with spring 3.0.6 but getting
    same error.
    5. It does not appear to be an issue with multiple jars in classpath, as
    removing aopalliance-1.0.jar from the SA is resulting in ClassNotFound
    exception during deployment.
    6. The same SA deploys successfully in smx3.3

    Any help would be greatly appreciated.
  • Freeman Fang at Oct 9, 2012 at 12:51 am
    Hi,

    The SMX 4.x is an OSGi container basically so it use use very different classloader mechanism with SMX 3.x.
    This error means can't cast org.aopalliance.intercept.MethodInterceptor to org.aopalliance.aop.Advice, this generally means org.aopalliance.intercept.MethodInterceptor and org.aopalliance.aop.Advice are loaded from different classloaders.
    In SMX 4.x we install aopalliance bundle for the container OOTB, but your SA also include aopalliance-1.0.jar, this is the problem.
    You need remove aopalliance-1.0.jar from your SA, and add
    <classpath>
    <library>osgi:org.apache.servicemix.bundles.aopalliance</library>
    </classpath>

    for your SU xbean.xml, this way your SA/SU can use aopalliance bundle from the container level, take a look at [1] to get more details, the "New in ServiceMix 4.2.0" chapter.

    [1]http://servicemix.apache.org/classloaders.html
    Freeman
    -------------
    Freeman Fang

    Red Hat, Inc.
    FuseSource is now part of Red Hat
    Web: http://fusesource.com | http://www.redhat.com/
    Twitter: freemanfang
    Blog: http://freemanfang.blogspot.com
    http://blog.sina.com.cn/u/1473905042
    weibo: http://weibo.com/u/1473905042
    On 2012-10-9, at 上午1:40, srini wrote:

    Hi, I am facing issues with migrating servicemix3 SA (JBI based) to
    servicemix 4.4.2.

    Servicemix4 is throwing errors while loading Spring configurations of an SU
    whch is using interceptors.
    Error: Error creating bean with name 'retryInterceptor' defined in URL
    [file:C:/spring-config.xml]: Initialization of bean failed; nested exception
    is org.springframework.beans.ConversionNotSupportedException: Failed to
    convert property value of type 'my.DAOInterceptor' to required type
    'org.aopalliance.aop.Advice' for property 'advice'; nested exception is
    java.lang.IllegalStateException: Cannot convert value of type
    [my.DAOInterceptor] to required type [org.aopalliance.aop.Advice] for
    property 'advice': no matching editors or conversion strategy found
    at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
    at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)

    Additional Details:
    1. I am trying to deploy smx3 SA(zip file) as-is after installing JBI
    feature in smx4.
    2. my.DAOInterceptor is implementing
    org.aopalliance.intercept.MethodInterceptor;
    3. Configuration in spring-config.xml:
    <bean id="retryDAOInterceptor" class="my.DAOInterceptor"/>
    <bean id="retryInterceptor"
    class="org.springframework.aop.support.RegexpMethodPointcutAdvisor">
    <property name="advice" ref="retryDAOInterceptor"/>
    <property name="pattern">
    <value>.*</value>
    </property>
    </bean>

    --my.DAOInterceptor is implementing
    org.aopalliance.intercept.MethodInterceptor.
    4. Project is using spring 2.5.6. I have tried with spring 3.0.6 but getting
    same error.
    5. It does not appear to be an issue with multiple jars in classpath, as
    removing aopalliance-1.0.jar from the SA is resulting in ClassNotFound
    exception during deployment.
    6. The same SA deploys successfully in smx3.3

    Any help would be greatly appreciated.



    --
    View this message in context: http://servicemix.396122.n5.nabble.com/Failed-to-convert-property-value-to-required-type-org-aopalliance-aop-Advice-for-property-advice-tp5714672.html
    Sent from the ServiceMix - User mailing list archive at Nabble.com.
  • Srini at Oct 9, 2012 at 4:40 am
    Hi Freeman, Thanks for the response. I have tried this option but still
    facing problems:

    None of the beans are loading and the error is:
    nested exception is java.lang.NoClassDefFoundError:
    org/aopalliance/aop/Advice
    ...
    Caused by: java.lang.ClassNotFoundException: org.aopalliance.aop.Advice in
    classloader
    org.apache.xbean.spring.context.FileSystemXmlApplicationContext@1ef55fb
    at
    org.apache.xbean.classloader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:206)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    xbeans and spring config files are not inside SA zip file. They are referred
    from xbeans inside SA through import tag -- <import
    resource="file:c:/module/xbean.xml/>

    Could you please help?
    There are 2 flavours of smx4 available for download on apache website --
    default assmebly and JBI assembly. I have tried on both with no luck. Pls
    advise if I should be using only JBI assembly version.
  • Freeman Fang at Oct 9, 2012 at 4:51 am
    Hi,

    My comment inline
    -------------
    Freeman Fang

    Red Hat, Inc.
    FuseSource is now part of Red Hat
    Web: http://fusesource.com | http://www.redhat.com/
    Twitter: freemanfang
    Blog: http://freemanfang.blogspot.com
    http://blog.sina.com.cn/u/1473905042
    weibo: http://weibo.com/u/1473905042
    On 2012-10-9, at 下午12:40, srini wrote:

    Hi Freeman, Thanks for the response. I have tried this option but still
    facing problems:

    None of the beans are loading and the error is:
    nested exception is java.lang.NoClassDefFoundError:
    org/aopalliance/aop/Advice
    ...
    Caused by: java.lang.ClassNotFoundException: org.aopalliance.aop.Advice in
    classloader
    org.apache.xbean.spring.context.FileSystemXmlApplicationContext@1ef55fb
    at
    org.apache.xbean.classloader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:206)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    xbeans and spring config files are not inside SA zip file. They are referred
    from xbeans inside SA through import tag -- <import
    resource="file:c:/module/xbean.xml/>
    You should always put xbean.xml in the SU which use it, so that the SA/SU bundle is self-contained or "Self standing", this is a good practice.
    Anyway, did you already add
    <classpath>
    <library>osgi:org.apache.servicemix.bundles.aopalliance</library>
    </classpath>
    in file:c:/module/xbean.xml as I mentioned before?
    You better remove $SMX_HOME/data folder and restart smx so that any change could get picked up.
    Could you please help?
    There are 2 flavours of smx4 available for download on apache website --
    default assmebly and JBI assembly. I have tried on both with no luck. Pls
    advise if I should be using only JBI assembly version.
    Yes, you should use JBI assembly version in your case.
    Freeman
  • Srini at Oct 9, 2012 at 5:32 am
    Hi, I have added classpath entry in c:/module1/xbeans.XML. I have also tried
    with classpath/location option.
    Also tried Deleting data folder and restarting SMx. I have verified that
    aopalliance bundle is present and is in active status.

    Pls guide me with any other options that I can explore.
  • Freeman Fang at Oct 9, 2012 at 5:44 am
    Hi,

    Could you embed xbeans.xml into SA/SU to see if it helps?

    -------------
    Freeman Fang

    Red Hat, Inc.
    FuseSource is now part of Red Hat
    Web: http://fusesource.com | http://www.redhat.com/
    Twitter: freemanfang
    Blog: http://freemanfang.blogspot.com
    http://blog.sina.com.cn/u/1473905042
    weibo: http://weibo.com/u/1473905042
    On 2012-10-9, at 下午1:32, srini wrote:

    Hi, I have added classpath entry in c:/module1/xbeans.XML. I have also tried
    with classpath/location option.
    Also tried Deleting data folder and restarting SMx. I have verified that
    aopalliance bundle is present and is in active status.

    Pls guide me with any other options that I can explore.





    --
    View this message in context: http://servicemix.396122.n5.nabble.com/Failed-to-convert-property-value-to-required-type-org-aopalliance-aop-Advice-for-property-advice-tp5714672p5714677.html
    Sent from the ServiceMix - User mailing list archive at Nabble.com.
  • Srini at Oct 10, 2012 at 1:30 am
    Hi Freeman,

    I have added the classpath in xbeans.xml of SA zip and the earlier error
    seems to be resolved. Many thanks for the help.

    SA has started without any issues but I am getting one of the below
    exceptions when querying DB2 8.x database:

    1. Caused by: java.sql.SQLException:
    com.mchange.v2.c3p0.ComboPooledDataSource [
    java.beans.IntrospectionException:
    java.lang.reflect.InvocationTargetException
    [numThreadsAwaitingCheckoutDefaultUser] ] has been closed() -- you can no
    longer use it.
    at
    com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.assertCpds(AbstractPoolBackedDataSource.java:447)[c3p0-0.9.1.2.jar:0.9.1.2]
    at
    com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getPoolManager(AbstractPoolBackedDataSource.java:459)[c3p0-0.9.1.2.jar:0.9.1.2]
    at
    com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)[c3p0-0.9.1.2.jar:0.9.1.2]
    at
    org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:200)[spring-2.5.6.jar:2.5.6]

    Below is my datasource bean definition:
    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
    destroy-method="close" lazy-init="default" autowire="default"
    dependency-check="default">
    <property name="driverClass" value="com.ibm.db2.jcc.DB2Driver"/>
    <property name="jdbcUrl" value="jdbc:db2://server:port/DB"/>
    <property name="user" value="username"/>
    <property name="password" value="password"/>
    <property name="initialPoolSize" value="2"/>
    <property name="minPoolSize" value="5"/>
    <property name="maxPoolSize" value="10"/>
    <property name="acquireIncrement" value="1"/>
    <property name="acquireRetryDelay" value="60000"/>
    <property name="debugUnreturnedConnectionStackTraces" value="true"/>
    <property name="maxIdleTime" value="30"/>
    <property name="unreturnedConnectionTimeout" value="300000"/>
    <property name="checkoutTimeout" value="300000"/>
    <property name="idleConnectionTestPeriod" value="600000"/>
    <property name="numThreadsAwaitingCheckoutDefaultUser" value="10"/>
    </bean>

    2.
    21:24:41,112 | ERROR | rovider-thread-3 | DefaultComponent |
    172 - servicemix-common - 2011.02.0 | Error processing exchange
    org.apache.servicemix.jbi.runtime.impl.InOnlyImpl@168cd47
    java.lang.Error: SQLWarning chain holds value that is not a SQLWarning
    at java.sql.SQLWarning.getNextWarning(SQLWarning.java:184)[:1.6.0_34]
    at
    org.springframework.jdbc.core.JdbcTemplate.handleWarnings(JdbcTemplate.java:1220)
    at
    org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:592)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:641)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:670)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:678)
    at
    org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:721)
    at
    org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:732)
    at
    org.springframework.jdbc.core.JdbcTemplate.queryForInt(JdbcTemplate.java:759)

    I am getting different error when i delete the data folder and restart smx4.

    I think it is not even getting the db connection. Could you please suggest?
  • Freeman Fang at Oct 10, 2012 at 2:33 am
    Hi,

    Most likely you run into a well-known issue when use JDBC driver in OSGi container, that said, you try to pass a JDBC driver class name com.ibm.db2.jcc.DB2Driver to the c3p0 connection pool, but c3p0 bundle can't see class com.ibm.db2.jcc.DB2Driver as it doesn't import this package, you can take a look at [1] to get more details and find the solution there.
    The only weird thing is that I can't see the ClassNotFoundException from the stacktrace you posted here, did you omit it or possibly the c3p0 swallow it?

    [1]http://freemanfang.blogspot.com/2012/03/how-to-use-jdbc-driver-in-osgi.html
    -------------
    Freeman Fang

    Red Hat, Inc.
    FuseSource is now part of Red Hat
    Web: http://fusesource.com | http://www.redhat.com/
    Twitter: freemanfang
    Blog: http://freemanfang.blogspot.com
    http://blog.sina.com.cn/u/1473905042
    weibo: http://weibo.com/u/1473905042
    On 2012-10-10, at 上午9:30, srini wrote:

    Hi Freeman,

    I have added the classpath in xbeans.xml of SA zip and the earlier error
    seems to be resolved. Many thanks for the help.

    SA has started without any issues but I am getting one of the below
    exceptions when querying DB2 8.x database:

    1. Caused by: java.sql.SQLException:
    com.mchange.v2.c3p0.ComboPooledDataSource [
    java.beans.IntrospectionException:
    java.lang.reflect.InvocationTargetException
    [numThreadsAwaitingCheckoutDefaultUser] ] has been closed() -- you can no
    longer use it.
    at
    com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.assertCpds(AbstractPoolBackedDataSource.java:447)[c3p0-0.9.1.2.jar:0.9.1.2]
    at
    com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getPoolManager(AbstractPoolBackedDataSource.java:459)[c3p0-0.9.1.2.jar:0.9.1.2]
    at
    com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)[c3p0-0.9.1.2.jar:0.9.1.2]
    at
    org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:200)[spring-2.5.6.jar:2.5.6]

    Below is my datasource bean definition:
    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
    destroy-method="close" lazy-init="default" autowire="default"
    dependency-check="default">
    <property name="driverClass" value="com.ibm.db2.jcc.DB2Driver"/>
    <property name="jdbcUrl" value="jdbc:db2://server:port/DB"/>
    <property name="user" value="username"/>
    <property name="password" value="password"/>
    <property name="initialPoolSize" value="2"/>
    <property name="minPoolSize" value="5"/>
    <property name="maxPoolSize" value="10"/>
    <property name="acquireIncrement" value="1"/>
    <property name="acquireRetryDelay" value="60000"/>
    <property name="debugUnreturnedConnectionStackTraces" value="true"/>
    <property name="maxIdleTime" value="30"/>
    <property name="unreturnedConnectionTimeout" value="300000"/>
    <property name="checkoutTimeout" value="300000"/>
    <property name="idleConnectionTestPeriod" value="600000"/>
    <property name="numThreadsAwaitingCheckoutDefaultUser" value="10"/>
    </bean>

    2.
    21:24:41,112 | ERROR | rovider-thread-3 | DefaultComponent |
    172 - servicemix-common - 2011.02.0 | Error processing exchange
    org.apache.servicemix.jbi.runtime.impl.InOnlyImpl@168cd47
    java.lang.Error: SQLWarning chain holds value that is not a SQLWarning
    at java.sql.SQLWarning.getNextWarning(SQLWarning.java:184)[:1.6.0_34]
    at
    org.springframework.jdbc.core.JdbcTemplate.handleWarnings(JdbcTemplate.java:1220)
    at
    org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:592)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:641)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:670)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:678)
    at
    org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:721)
    at
    org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:732)
    at
    org.springframework.jdbc.core.JdbcTemplate.queryForInt(JdbcTemplate.java:759)

    I am getting different error when i delete the data folder and restart smx4.

    I think it is not even getting the db connection. Could you please suggest?



    --
    View this message in context: http://servicemix.396122.n5.nabble.com/Failed-to-convert-property-value-to-required-type-org-aopalliance-aop-Advice-for-property-advice-tp5714672p5714685.html
    Sent from the ServiceMix - User mailing list archive at Nabble.com.
  • Srini at Oct 11, 2012 at 4:22 am
    Hi Freeman, ClassNotFoundException is not there in the stack trace.

    I am trying to setup application logs as suggested in
    http://fusenotes.blogspot.ca/2011/02/logging-per-application-in-servicemix-4.html.

    Application log file is getting created but none of the normal (INFO/DEBUG
    level) log statements present in the app are coming up in the log file.
    Only logs from servicemix libraries and all exceptions are logged to the log
    file.

    Also tried below configurations in the org.ops4j.pax.logging.cfg:

    log4j.logger.mypackage.subpackage=DEBUG, x
    log4j.appender.x=org.apache.log4j.RollingFileAppender
    log4j.appender.x.layout=org.apache.log4j.PatternLayout
    log4j.appender.x.layout.ConversionPattern=%d{ABSOLUTE} | %-5.5p | %-16.16t |
    %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n
    log4j.appender.x.file=${karaf.data}/log/yyy.log
    log4j.appender.x.append=true
    log4j.appender.x.maxFileSize=10MB
    log4j.appender.x.maxBackupIndex=10

    I have tried both Spring and java code approach mentioned in above link.

    I am not sure if it is class loader issue as the code is proceeding to query
    the db after getting db connection (from below stack trace). I have added
    logger statements in the code but unable to setup proper logging.
    java.lang.Error: SQLWarning chain holds value that is not a SQLWarning
    at java.sql.SQLWarning.getNextWarning(SQLWarning.java:184)[:1.6.0_34]
    at
    org.springframework.jdbc.core.JdbcTemplate.handleWarnings(JdbcTemplate.java:1260)
    at
    org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:587)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:636)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:665)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:673)
    at
    org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:728)
    at
    org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:744)
    at
    org.springframework.jdbc.core.JdbcTemplate.queryForInt(JdbcTemplate.java:775)

Related Discussions

Discussion Navigation
viewthread | post

2 users in discussion

Srini: 6 posts Freeman Fang: 4 posts