Re: JOnAS 5.1.5 and JSR-250 annotations with Spring 3.0.5

Florent BENOIT <[email protected]> Wed, 14 Sep 2011 16:10:47 +0200
Newsgroups gmane.comp.java.objectweb.jonas
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------020604000403080207070209
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

     Hi,

@Resource annotation in JOnAS only injects Java EE managed resources. 
(JMS, JDBC, etc)
Spring resources are not handled because this is not a Java EE managed 
resource so it won't be injected.

If you need to inject external resources, you may use 
@Resource(mappedName="....") with a link to the JNDI name where your 
bean is available.
Or you could use @OSGiResource annotation in order to inject the OSGi 
bundleContext (if your spring bean is also exposed as an OSGi service)

Regards,

Florent

On 09/13/2011 10:11 PM, Celinio Fernandes wrote:
> Hi,
> I am trying to inject some Spring managed beans in some classes using 
> the @Resource annotation, that is part of the JSR-250.
>
>     @Resource
>     ManageTrace manageTraceApplication;
>
> In my Spring XML file, I have definied the managed bean :
>
> <bean id="manageTraceApplication"
>         class="com.aa.bb.cc.application.impl.ManageTraceImpl"
>         scope="singleton" />
>
> I keep getting the following error :
> org.ow2.jonas.deployment.web.WebContainerDeploymentDescException: 
> jonas-resource missing for res-ref-name 
> com.aa.bb.cc.presentation.server.ManageDemandeDelegate/manageTraceApplication: 
> jonas-resource missing for res-ref-name 
> com.aa.bb.cc.presentation.server.ManageDemandeDelegate/manageTraceApplication
>
> It's like it's looking for an environment variable 
> manageTraceApplication in the JNDI registry.
>
> Do i need to modify something in Jonas to avoid that ?
> Any clue ?
>
> Thanks for helping.


--------------020604000403080207070209
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    &nbsp;&nbsp;&nbsp; Hi,<br>
    <br>
    @Resource annotation in JOnAS only injects Java EE managed
    resources. (JMS, JDBC, etc)<br>
    Spring resources are not handled because this is not a Java EE
    managed resource so it won't be injected.<br>
    <br>
    If you need to inject external resources, you may use
    @Resource(mappedName="....") with a link to the JNDI name where your
    bean is available.<br>
    Or you could use @OSGiResource annotation in order to inject the
    OSGi bundleContext (if your spring bean is also exposed as an OSGi
    service)<br>
    <br>
    Regards,<br>
    <br>
    Florent<br>
    <br>
    On 09/13/2011 10:11 PM, Celinio Fernandes wrote:
    <blockquote
      cite="mid:[email protected]"
      type="cite">
      <div style="color:#000; background-color:#fff; font-family:times
        new roman, new york, times, serif;font-size:12pt">
        <div>Hi,<br>
          I am trying to inject some Spring managed beans in some
          classes using the @Resource annotation, that is part of the
          JSR-250.<br>
          <br>
          &nbsp;&nbsp;&nbsp; @Resource<br>
          &nbsp;&nbsp;&nbsp; ManageTrace manageTraceApplication;<br>
          <br>
          In my Spring XML file, I have definied the managed bean :<br>
          <br>
          &nbsp;&nbsp;&nbsp; &lt;bean id="manageTraceApplication"<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; class="com.aa.bb.cc.application.impl.ManageTraceImpl"<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; scope="singleton" /&gt;<br>
          <br>
          I keep getting the following error :<br>
          org.ow2.jonas.deployment.web.WebContainerDeploymentDescException:
          jonas-resource missing for res-ref-name
          com.aa.bb.cc.presentation.server.ManageDemandeDelegate/manageTraceApplication:
          jonas-resource missing for res-ref-name
com.aa.bb.cc.presentation.server.ManageDemandeDelegate/manageTraceApplication<br>
          <br>
          It's like it's looking for an environment variable
          manageTraceApplication in the JNDI registry.<br>
          <br>
          Do i need to modify something in Jonas to avoid that ?<br>
          Any clue ?<br>
          <br>
          Thanks for helping.</div>
      </div>
    </blockquote>
    <br>
  </body>
</html>

--------------020604000403080207070209--