views:

64

answers:

1

I'm packaging a couple JMX MBeans inside a JBoss SAR file. However, when I try to introduce Spring (3.0.2.RELEASE) into the project by marking the class as @Configurable and one of the dependencies as @Autowired, I get the following error during deployment:

java.lang.ClassNotFoundException: org.springframework.beans.factory.aspectj.ConfigurableObject

I've tried both compile-time and load-time weaving, both give me this error. I've also confirmed that spring-aspects.jar is included as a dependency and is showing up in the SARs lib folder.

I'm also including these Spring dependencies:

  • aspectjrt
  • spring-core
  • spring-context
  • spring-aop
  • spring-tx

What other gotchas do I need to worry about when mixing Spring, AspectJ, and SARs?

A: 

The org.springframework.beans.factory.aspectj.ConfigurableObject is located in the Spring Aspects module. The error message says you don't have the jar file in your classpath. Sounds strange..

If you are totally stuck, you can test the Spring functionality without a WEB container, then in Tomcat. (JBoss's WEB container)

Else, Spring Aspects has required dependencies to:

  • Spring Beans
  • Spring Core
  • Apache Commons Logging

I guess you have already added Apache Commons Logging, but I can't see Spring Beans in your list above.

Espen
I confirmed that all of those dependencies are there. It seems that for some reason, when the code is packaged as a SAR, the dependencies don't show up on the classpath. On the other hand, if I package them as a JAR, ConfigurableObject is found and the JMX objects show up in the JMX console so that's how I'm going to proceed.
Matt Pfefferle