[jboss-jira] [JBoss JIRA] Commented: (JBAS-8948) Switchboard: Add configuration option to ResourceEnvRefProvider to not throw RuntimeException upon missing @Resource annotation

jaikiran pai (JIRA) jira-events at lists.jboss.org
Tue May 10 01:53:18 EDT 2011


    [ https://issues.jboss.org/browse/JBAS-8948?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12600878#comment-12600878 ] 

jaikiran pai commented on JBAS-8948:
------------------------------------

Daniel, let me know if you need any kind of help on this. Either drop me a mail or ping me on IRC (usually on #jboss-dev or #jboss-ejb3 on irc.freenode.net).


> Switchboard: Add configuration option to ResourceEnvRefProvider to not throw RuntimeException upon missing @Resource annotation
> -------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: JBAS-8948
>                 URL: https://issues.jboss.org/browse/JBAS-8948
>             Project: Legacy JBoss Application Server 6 
>          Issue Type: Enhancement
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 6.0.0.Final
>            Reporter: Daniel Bevenius
>            Assignee: Daniel Bevenius
>              Labels: open_to_community
>             Fix For: 6.1.0, Open To Community
>
>         Attachments: ResourceEnvRefProvider.java, ResourceEnvRefProviderTest.java
>
>
> 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:
> {code}
> import javax.annotation.Resource;
> public class AnnotatedClass
> {
>     @Resource
>     public void setterMethodWithAnnotation(SampleClass sample)
>     {
>     }
> }
> {code}
> And this class in packaged into a war and deployed the exception below will be thrown:
> {noformat}
> 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
> {noformat}
> 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.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list