Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine implemented interfaces for jms connection factories using Spring 3.2.1, Jboss AS7, Aspectj 1.7.1 java 1.7?

We are developing a project in java 1.6 using JBOSS AS7 and we use among others: Aspectj and HornetQ. We need to upgrade to java 1.7 so we use ASpectj 1.7.1. During the deployment we get the following exception:

Caused by: org.springframework.beans.factory.BeanCreationException:
  Error creating bean with name 'eventsJmsTemplate' defined in class path resource [com/company/project/jms/jms.xml]: 
  Cannot resolve reference to bean 'jmsConnectionFactory' while setting bean property 'connectionFactory'; nested exception is
   org.springframework.beans.factory.BeanCreationException: 
  Error creating bean with name 'jmsConnectionFactory': 
  Post-processing of the FactoryBean's object failed; 
    nestedexception is java.lang.IllegalArgumentException: 
      warning can't determine implemented interfaces of missing type 
    com.company.project.aspects.MBeanAttributesAdvice [Xlint:cantFindType]

The mbean is:

<jee:jndi-lookup id="jmsConnectionFactory" jndi-name="java:/JmsXA" />

On other project, We had the same exception when we use a JPA datasource:

<jee:jndi-lookup id="dataSource" jndi-name="java:jboss/datasources/table" />
<bean id="jpaDialect" class="org.springframework.orm.jpa.vendor.HibernateJpaDialect" />

and we manage to solve the issue by adding on jboss-deployment-structure the module depedency: org.jboss.ironjacamar.jdbcadapters

<jboss-deployment-structure>
    <deployment>
        <exclusions>
            <module name="org.slf4j" />
            <module name="org.slf4j.impl" />
            <module name="org.apache.log4j" />
        </exclusions>
        <dependencies>
            <module name="org.jboss.ironjacamar.jdbcadapters" />
        </dependencies>
    </deployment>
</jboss-deployment-structure>

is there any module that we can add in order to pass this exception? or any other way to solve this issue?

like image 508
Ioannis Kanellopoulos Avatar asked Feb 21 '13 14:02

Ioannis Kanellopoulos


2 Answers

I would like to share with you the solution. Add the modules: org.hornetq, org.hornetq.ra , org.jboss.ejb3, org.jboss.ejb-client.

<jboss-deployment-structure>
    <deployment>
        <!-- Exclusions allow you to prevent the server from automatically adding 
            some dependencies -->
        <exclusions>
            <module name="org.slf4j" />
            <module name="org.slf4j.impl" />
            <module name="org.apache.log4j" />
        </exclusions>
        <dependencies>
            <module name="org.jboss.ironjacamar.jdbcadapters" />
            <module name="org.hornetq" />
            <module name="org.hornetq.ra" />
            <module name="org.jboss.ejb3" />
            <module name="org.jboss.ejb-client" />
        </dependencies>
    </deployment>
</jboss-deployment-structure>
like image 192
Ioannis Kanellopoulos Avatar answered Nov 24 '22 00:11

Ioannis Kanellopoulos


I would like to document what works for me, even if I'm late to this question.

I'm using JBoss 7.1.1 and Spring 3.2.4:

Using, say, annotation based Aspects in your Spring setup will cause the Aspect-Weaver try to go over all components you have, including those you got via JNDI-lookup. The Weaver will stumble over those components, since (I read that somewhere) the Classloader used to load them (JBoss' ModuleClassLoader in my case) will know nothing about my Aspect (living in my project's classloader) and fail with Xlint:cantFindType.

Proxying those components by something within the realm of the project's Classloader solves this problem.

For JDBC datasources:

<jee:jndi-lookup id="dataSource" jndi-name="java:jboss/datasources/myDS" proxy-interface="javax.sql.DataSource" />

For JMS ConnectionFactory

<jee:jndi-lookup id="connectionFactory" jndi-name="java:/JmsXA" proxy-interface="javax.jms.ConnectionFactory"/>

And so on.

This way I do not have to include any extra modules like org.jboss.ironjacamar.jdbcadapters and such.

like image 22
Simon Hellinger Avatar answered Nov 24 '22 00:11

Simon Hellinger