Matt Drees [
http://community.jboss.org/people/matt.drees] created the discussion
"@Resource definition in 3rd party library causes deployment failure"
To view the discussion, visit:
http://community.jboss.org/message/608833#608833
--------------------------------------------------------------
Hi all,
Earlier snapshots of AS7 didn't give me this problem, but it's started showing up
due to some recent changes regarding @Resource handling.
I use a library called Enunciate for help with a couple different webservice related
things. One of its modules (org.codehaus.enunciate:enunciate-jersey-rt:1.21)
http://grepcode.com/file/repo1.maven.org/maven2/org.codehaus.enunciate/en...
has a class named EnunciateSpringComponentProviderFactory with a @Resource annotation in
it defined like this:
@Resource ( name = "service-bean-interceptors" )
public void setEnunciateInterceptors(List<Object> interceptors) {
this.interceptors = interceptors;
}
I believe this was intended to be used for Spring dependency wiring. This class is
intended to be an 'optional' class, in that it adds Spring support to
Enunciate's Jersey integration, but if Spring doesn't exist on the classpath, the
Enunciate-Jersey integration
http://grepcode.com/file/repo1.maven.org/maven2/org.codehaus.enunciate/en...
should still work fine.
My app doesn't use Spring, and I don't need this class to be used by Enunciate or
noticed in any way by Jboss.
However, AS7 seems to notice the @Resource declaration, and it tries to register
EnunciateSpringComponentProviderFactory as an EE Component.
Now, this first caused me a little irritation because AS7 tried to load this class, which
failed with a Linkage error because I don't have the jersey-spring integration jar in
my app. So, I worked around the issue by adding that jar.
However, AS7 (as of late) now fails to deploy my app, resulting in this stacktrace:
13:07:07,388 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed
to start service jboss.deployment.unit."ccp.war".PARSE:
org.jboss.msc.service.StartException in service
jboss.deployment.unit."ccp.war".PARSE: Failed to process phase PARSE of
deployment "ccp.war"
at
org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121)
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1675)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
[:1.6.0_24]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
[:1.6.0_24]
at java.lang.Thread.run(Thread.java:680) [:1.6.0_24]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: Can't
handle @Resource for ENC name: service-bean-interceptors since it's missing a
"lookup" (or "mappedName") value and isn't of any known type
at
org.jboss.as.ee.component.ResourceInjectionAnnotationParsingProcessor.process(ResourceInjectionAnnotationParsingProcessor.java:208)
at
org.jboss.as.ee.component.ResourceInjectionAnnotationParsingProcessor.processMethodResource(ResourceInjectionAnnotationParsingProcessor.java:168)
at
org.jboss.as.ee.component.ResourceInjectionAnnotationParsingProcessor.deploy(ResourceInjectionAnnotationParsingProcessor.java:119)
at
org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115)
... 4 more
Is there any way I can tell AS7 to ignore this class?
Or perhaps AS7 is being a little too aggressive regarding its @Resource
scanning/validating? Honestly I don't know the Java EE rules regarding @Resource, so
maybe this behavior is correct.
I do imagine, however, that the current behavior will be really irritating to people who
use Spring and use @Resource to declare Spring injection points.
Oh, and also, the error message would be friendlier if it inlcuded the name of the class
containing the offening @Resource declaration.
Thanks!
-Matt
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/608833#608833]
Start a new discussion in JBoss AS7 Development at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]