-
Enhancement
-
Resolution: Obsolete
-
Major
-
6.0.0.Final
-
None
Using a javax.annotation.Resource that is not intended for JBoss MC, perhaps Spring is being used, causes a RuntimeException to be throw upon startup of JBoss AS 6.0.0.Final.
For example, if you have a class that looks like this:
import javax.annotation.Resource; public class AnnotatedClass { @Resource public void setterMethodWithAnnotation(SampleClass sample) { } }
And this class in packaged into a war and deployed the exception below will be thrown:
Caused by: java.lang.RuntimeException: Neither any mapped-name/lookup/jndi-name specified nor any ResourceProvider could process resource-env-ref named env/se.rl.pop.AnnotatedClass/terMethodWithAnnotation of type se.rl.pop.SampleClass at org.jboss.switchboard.mc.resource.provider.ResourceEnvRefProvider.provide(ResourceEnvRefProvider.java:136) [:1.0.0-alpha-16-SNAPSHOT] at org.jboss.switchboard.mc.resource.provider.ResourceEnvRefProvider.provide(ResourceEnvRefProvider.java:1) [:1.0.0-alpha-16-SNAPSHOT] at org.jboss.switchboard.mc.JndiEnvironmentProcessor.process(JndiEnvironmentProcessor.java:68) [:1.0.0-alpha-16-SNAPSHOT] at org.jboss.switchboard.mc.deployer.AbstractSwitchBoardDeployer.process(AbstractSwitchBoardDeployer.java:119) [:1.0.0-alpha-16-SNAPSHOT] at org.jboss.switchboard.mc.deployer.WebEnvironmentSwitchBoardDeployer.internalDeploy(WebEnvironmentSwitchBoardDeployer.java:66) [:1.0.0-alpha-16-SNAPSHOT] at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:55) [:2.2.0.GA] at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179) [:2.2.0.GA] ... 43 more
Resource scanning can be turned off by adding a jboss-scanning.xml to WEB-INF/META-INF but this jira suggests that a property be added to ResourceEnvRefProvider that configures if this class should throw a RuntimeException of just log a message. This would save users to have to add a jboss-scanning.xml to their deployments.