You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by "Jarek Gawor (JIRA)" <ji...@apache.org> on 2008/10/15 19:26:44 UTC
[jira] Created: (GERONIMO-4361) Resource injection of simple env.
entry types
Resource injection of simple env. entry types
---------------------------------------------
Key: GERONIMO-4361
URL: https://issues.apache.org/jira/browse/GERONIMO-4361
Project: Geronimo
Issue Type: Bug
Security Level: public (Regular issues)
Components: deployment
Affects Versions: 2.1.3, 2.2
Reporter: Jarek Gawor
Assignee: Jarek Gawor
There are a couple problems with @Resource injection of simple env. types:
1) If @Resource.mappedName attribute is specified, it becomes the env-entry value. For example, if we have @Resource(mappedName = "java:comp/env/bar") String foo, the injected value of "foo" will be "java:comp/env/bar". That's incorrect.
2) Right now, @Resource String foo = "bar". without a corresponding env-entry in the DD will cause a deployment (injection) exception (since there is no entry for it in the JNDI context). However, according to the Java EE 5 spec, section EE.5.4.1.3, "... the container must only inject a value for this resource if the deployer has specified a value to override the default value" and since the generated DD entry for this resource will have no env-entry-value element, the injection should not happen (and so the application should deploy without an error).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (GERONIMO-4361) Resource injection of simple env.
entry types
Posted by "Jarek Gawor (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/GERONIMO-4361?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jarek Gawor resolved GERONIMO-4361.
-----------------------------------
Resolution: Fixed
Fix Version/s: 2.2
2.1.4
Committed fixes for these issues to trunk (revision 704968) and branches/2.1 (revision 704978).
> Resource injection of simple env. entry types
> ---------------------------------------------
>
> Key: GERONIMO-4361
> URL: https://issues.apache.org/jira/browse/GERONIMO-4361
> Project: Geronimo
> Issue Type: Bug
> Security Level: public(Regular issues)
> Components: deployment
> Affects Versions: 2.1.3, 2.2
> Reporter: Jarek Gawor
> Assignee: Jarek Gawor
> Fix For: 2.1.4, 2.2
>
>
> There are a couple problems with @Resource injection of simple env. types:
> 1) If @Resource.mappedName attribute is specified, it becomes the env-entry value. For example, if we have @Resource(mappedName = "java:comp/env/bar") String foo, the injected value of "foo" will be "java:comp/env/bar". That's incorrect.
> 2) Right now, @Resource String foo = "bar". without a corresponding env-entry in the DD will cause a deployment (injection) exception (since there is no entry for it in the JNDI context). However, according to the Java EE 5 spec, section EE.5.4.1.3, "... the container must only inject a value for this resource if the deployer has specified a value to override the default value" and since the generated DD entry for this resource will have no env-entry-value element, the injection should not happen (and so the application should deploy without an error).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (GERONIMO-4361) Resource injection of simple env.
entry types
Posted by "Jarek Gawor (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/GERONIMO-4361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12643491#action_12643491 ]
Jarek Gawor commented on GERONIMO-4361:
---------------------------------------
If you have @Resource annotation without the "name" attribute, the matching env-entry name in the DD for the injected resource should be something like:
<env-entry-name>org.apache.geronimo.samples.slsb.calculator.Calculator/myString</env-entry-name>
So you either need to change the env-entry-name to match the injected resource or add "name" attribute to the @Resource annotation.
> Resource injection of simple env. entry types
> ---------------------------------------------
>
> Key: GERONIMO-4361
> URL: https://issues.apache.org/jira/browse/GERONIMO-4361
> Project: Geronimo
> Issue Type: Bug
> Security Level: public(Regular issues)
> Components: deployment
> Affects Versions: 2.1.3, 2.2
> Reporter: Jarek Gawor
> Assignee: Jarek Gawor
> Fix For: 2.1.4, 2.2
>
>
> There are a couple problems with @Resource injection of simple env. types:
> 1) If @Resource.mappedName attribute is specified, it becomes the env-entry value. For example, if we have @Resource(mappedName = "java:comp/env/bar") String foo, the injected value of "foo" will be "java:comp/env/bar". That's incorrect.
> 2) Right now, @Resource String foo = "bar". without a corresponding env-entry in the DD will cause a deployment (injection) exception (since there is no entry for it in the JNDI context). However, according to the Java EE 5 spec, section EE.5.4.1.3, "... the container must only inject a value for this resource if the deployer has specified a value to override the default value" and since the generated DD entry for this resource will have no env-entry-value element, the injection should not happen (and so the application should deploy without an error).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (GERONIMO-4361) Resource injection of simple env.
entry types
Posted by "Jürgen Weber (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/GERONIMO-4361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12643450#action_12643450 ]
Jürgen Weber commented on GERONIMO-4361:
----------------------------------------
Another Problem: attributes are not overridden.
For
@Resource
private String myString = "foo";
<env-entry>
<env-entry-name>myString</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>bar</env-entry-value>
</env-entry>
at runtime myString is "foo" instead of "bar".
I understand "the container must only inject a value for this resource if the deployer has specified a value to override the default value" means "do it if there is a env-entry.
I took the calculator sample
http://cwiki.apache.org/GMOxDOC21/calculator-using-ejb-30-functions.html
@Stateless(name = "Calculator")
public class Calculator implements CalculatorRemote, CalculatorLocal {
@Resource
private String myString = "foo";
......
<enterprise-beans>
<session>
<ejb-name>Calculator</ejb-name>
<env-entry>
<env-entry-name>myString</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>bar</env-entry-value>
</env-entry>
</session>
</enterprise-beans>
> Resource injection of simple env. entry types
> ---------------------------------------------
>
> Key: GERONIMO-4361
> URL: https://issues.apache.org/jira/browse/GERONIMO-4361
> Project: Geronimo
> Issue Type: Bug
> Security Level: public(Regular issues)
> Components: deployment
> Affects Versions: 2.1.3, 2.2
> Reporter: Jarek Gawor
> Assignee: Jarek Gawor
> Fix For: 2.1.4, 2.2
>
>
> There are a couple problems with @Resource injection of simple env. types:
> 1) If @Resource.mappedName attribute is specified, it becomes the env-entry value. For example, if we have @Resource(mappedName = "java:comp/env/bar") String foo, the injected value of "foo" will be "java:comp/env/bar". That's incorrect.
> 2) Right now, @Resource String foo = "bar". without a corresponding env-entry in the DD will cause a deployment (injection) exception (since there is no entry for it in the JNDI context). However, according to the Java EE 5 spec, section EE.5.4.1.3, "... the container must only inject a value for this resource if the deployer has specified a value to override the default value" and since the generated DD entry for this resource will have no env-entry-value element, the injection should not happen (and so the application should deploy without an error).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.