[jboss-jira] [JBoss JIRA] Commented: (JBAS-9303) @Resource(lookup="java:module/ModuleName") doesnt work

Felix Ullrich (JIRA) jira-events at lists.jboss.org
Fri Apr 15 11:03:33 EDT 2011


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

Felix Ullrich commented on JBAS-9303:
-------------------------------------

I've found the mistake and you can close the ticket. 

Following this [blog-entry|http://jaitechwriteups.blogspot.com/2011/02/resource-and-new-lookup-attribute-how.html] from your mate to get rid of the compile errors because of the old @Resource-Annotation in the jdk I added the following dependency in my maven-script. 

{code}
<!-- javax.annotation.* dependency -->
<dependency>
    <groupId>org.jboss.spec.javax.annotation</groupId>
    <artifactId>jboss-annotations-api_1.1_spec</artifactId>
    <version>1.0.0.Final</version>
</dependency>
{code}

The problem was the missing scope.
{code}
    <scope>provided</scope>
{code}

With every compile I got the annotation-api packaged in my ear-file and because of that the @Resource-injection was not working at all.


cya

>  @Resource(lookup="java:module/ModuleName") doesnt work
> -------------------------------------------------------
>
>                 Key: JBAS-9303
>                 URL: https://issues.jboss.org/browse/JBAS-9303
>             Project: JBoss Application Server
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: EJB
>    Affects Versions: 6.0.0.Final
>            Reporter: Felix Ullrich
>            Assignee: Carlo de Wolf
>
> I cant inject the current application- or modulename with the resource-annotation in an EJB
> This doesnt work:
> {code:}
> @Resource(lookup="java:module/ModuleName")
> private String moduleName;
>       
> @Resource(lookup="java:app/AppName")
> private String appName;
> {code}

--
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