[
https://issues.jboss.org/browse/JBAS-8948?page=com.atlassian.jira.plugin....
]
Daniel Bevenius commented on JBAS-8948:
---------------------------------------
Thanks for the quick reply!
Yep, that workaround works for us. The only problem with this was that it requires us to
modify all our deployments which would also be required if we went with the
jboss-scanning.xml solution. But this is doable.
Do you think adding a configuration property is a valid enhancement that you might
consider adding to a future version?
Thanks,
/Daniel
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: JBoss Application Server
Issue Type: Enhancement
Security Level: Public(Everyone can see)
Affects Versions: 6.0.0.Final
Reporter: Daniel Bevenius
Assignee: jaikiran pai
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