[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:55:18 EDT 2011
[ https://issues.jboss.org/browse/JBAS-8948?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12600879#comment-12600879 ]
jaikiran pai commented on JBAS-8948:
------------------------------------
Just as an FYI - I'll be fixing JBAS-8318 issue this week and that fix should cover most of the cases where @Resource (and other such annotations) were being picked up from non Java EE component classes. That should prevent issues like this one from showing up. I would also recommend that instead of starting work on this one immediately, let's wait for JBAS-8318 to be committed (I'm planning to do it today itself) and see if it also fixes your original issue. If it does, then we can lower the priority of this feature request and reconsider whether this is really needed.
> 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