geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jarek Gawor (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (GERONIMO-3548) unable to inject DataSource into EJB using @Resource
Date Wed, 24 Oct 2007 03:50:50 GMT

     [ https://issues.apache.org/jira/browse/GERONIMO-3548?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jarek Gawor resolved GERONIMO-3548.
-----------------------------------

    Resolution: Invalid
      Assignee: Jarek Gawor

That warning message is really misleading and maybe it should be eliminated. 

The main issue in this case that the code was accessing the injected resource in the constructor.
But the resources are injected _after_ the object is created. So you have to move the code
that uses the injected resources from the constructor into some @PostConstruct annotated method.
I updated the code to do so (hope that's ok). 



> unable to inject DataSource into EJB using @Resource
> ----------------------------------------------------
>
>                 Key: GERONIMO-3548
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-3548
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>          Components: OpenEJB
>    Affects Versions: 2.1
>         Environment: windows
>            Reporter: Viet Hung Nguyen
>            Assignee: Jarek Gawor
>         Attachments: mrc-server-ear-1.0-SNAPSHOT.ear
>
>
> I have a DataSource that I am deploying along with my EAR. I tried to inject this DataSource
into my EJB code with the following snippet:
> @Resource(name="ActiveDS") private DataSource ds;
> However, I get the following warning:
> [INFO] 17:29:18,953 WARN  [ResourceRefBuilder] Failed to build reference to resource
reference [] defined in plan file, reason - corresponding entry in deployment descriptor missing.
> The data source is not injected properly. I did a simple check to see if my 'ds' was
null, and it was.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message