<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    @Resource definition in 3rd party library causes deployment failure
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/matt.drees">Matt Drees</a> in <i>JBoss AS7 Development</i> - <a href="http://community.jboss.org/message/608833#608833">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hi all,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Earlier snapshots of AS7 didn't give me this problem, but it's started showing up due to some recent changes regarding @Resource handling.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I use a library called Enunciate for help with a couple different webservice related things.&#160; One of its modules (org.codehaus.enunciate:enunciate-jersey-rt:1.21) <a class="jive-link-external-small" href="http://grepcode.com/file/repo1.maven.org/maven2/org.codehaus.enunciate/enunciate-jersey-rt/1.22/org/codehaus/enunciate/modules/jersey/EnunciateSpringComponentProviderFactory.java/">has a class named EnunciateSpringComponentProviderFactory</a> with a @Resource annotation in it defined like this:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code jive-java">&#160; @Resource ( name = <font color="red">"service-bean-interceptors"</font> )
&#160; <font color="navy"><b>public</b></font> <font color="navy"><b>void</b></font> setEnunciateInterceptors(List&lt;Object&gt; interceptors) <font color="navy">{</font>
&#160;&#160;&#160; this.interceptors = interceptors;
&#160; <font color="navy">}</font>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I believe this was intended to be used for Spring dependency wiring.&#160; 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 <a class="jive-link-external-small" href="http://grepcode.com/file/repo1.maven.org/maven2/org.codehaus.enunciate/enunciate-jersey-rt/1.22/org/codehaus/enunciate/modules/jersey/EnunciateJerseyServletContainer.java?av=f#149">should still work fine</a>.&#160; </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>However, AS7 seems to notice the @Resource declaration, and it tries to register EnunciateSpringComponentProviderFactory as an EE Component.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>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.&#160; So, I worked around the issue by adding that jar.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>However, AS7 (as of late) now fails to deploy my app, resulting in this stacktrace:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code">
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"
&#160;&#160;&#160; at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121)
&#160;&#160;&#160; at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1675)
&#160;&#160;&#160; at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_24]
&#160;&#160;&#160; at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_24]
&#160;&#160;&#160; 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
&#160;&#160;&#160; at org.jboss.as.ee.component.ResourceInjectionAnnotationParsingProcessor.process(ResourceInjectionAnnotationParsingProcessor.java:208)
&#160;&#160;&#160; at org.jboss.as.ee.component.ResourceInjectionAnnotationParsingProcessor.processMethodResource(ResourceInjectionAnnotationParsingProcessor.java:168)
&#160;&#160;&#160; at org.jboss.as.ee.component.ResourceInjectionAnnotationParsingProcessor.deploy(ResourceInjectionAnnotationParsingProcessor.java:119)
&#160;&#160;&#160; at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115)
&#160;&#160;&#160; ... 4 more


</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Is there any way I can tell AS7 to ignore this class?&#160; </p><p>Or perhaps AS7 is&#160; being a little too aggressive regarding its @Resource scanning/validating?&#160; Honestly I don't know the Java EE rules regarding @Resource, so maybe this behavior is correct.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>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.&#160; </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Oh, and also, the error message would be friendlier if it inlcuded the name of the class containing the offening @Resource declaration.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Thanks!</p><p>-Matt</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/608833#608833">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss AS7 Development at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>