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

viola.lu reopened GERONIMO-5346:
--------------------------------


Hi, David:
 I created a test application to test this function, but got errors like below:
No way to determine type of env-entry java:comp/env/welcomeMessage in component 
org.apache.geronimo.j2ee.deployment.webmod...@a0c5734b
org.apache.geronimo.common.DeploymentException: No way to determine type of 
env-entry java:comp/env/welcomeMessage in component 
org.apache.geronimo.j2ee.deployment.webmod...@a0c5734b
        at 
org.apache.geronimo.naming.deployment.AbstractNamingBuilder.inferAndCheckType(AbstractNamingBuilder.java:374)
        at 
org.apache.geronimo.naming.deployment.EnvironmentEntryBuilder.buildNaming(EnvironmentEntryBuilder.java:133)
        at 
org.apache.geronimo.j2ee.deployment.NamingBuilderCollection.buildNaming(NamingBuilderCollection.java:69)
        at 
org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder.configureBasicWebModuleAttributes(AbstractWebModuleBuilder.java:671)
        at 
org.apache.geronimo.tomcat.deployment.TomcatModuleBuilder.addGBeans(TomcatModuleBuilder.java:422)
        at 
org.apache.geronimo.j2ee.deployment.SwitchingModuleBuilder.addGBeans(SwitchingModuleBuilder.java:174)
        at 
org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfiguration(EARConfigBuilder.java:704)
        at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:250)
        at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:138)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at 
org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
        at 
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:131)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:872)
        at 
org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:245)
        at 
org.apache.geronimo.deployment.plugin.local.AbstractDeployCommand.doDeploy(AbstractDeployCommand.java:116)
        at 
org.apache.geronimo.deployment.plugin.local.DistributeCommand.run(DistributeCommand.java:61)
        at java.lang.Thread.run(Thread.java:619)

Here is my test scenario:
1. disable entry type in web.xml:
<servlet>
<servlet-name>Hello</servlet-name>
<servlet-class>org.apache.helloworld.HelloWorld</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Hello</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping>
<env-entry>
    <env-entry-name>welcomeMessage</env-entry-name>
    <!--<env-entry-type>java.lang.String</env-entry-type>-->
    <env-entry-value>Hello World from env-entry!</env-entry-value>
</env-entry>

2. Lookup this entry via @Resource annotation, 
package org.apache.helloworld;

import java.io.*;

import javax.annotation.Resource;
import javax.servlet.ServletException;
import java.lang.reflect.Method;
import javax.servlet.http.*;


public class HelloWorld extends HttpServlet {
    private static final long serialVersionUID = 1L;
    private @Resource String welcomeMessage;

    public void doGet(HttpServletRequest request, HttpServletResponse response) 
throws ServletException, IOException {
        PrintWriter out = response.getWriter();
        out.println(welcomeMessage);
    }
}

If any invalid setting, pls figure me out, thanks in advance!
So reopen it.

> infer jndi type from injection target; check type consistency
> -------------------------------------------------------------
>
>                 Key: GERONIMO-5346
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-5346
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>          Components: deployment, naming
>    Affects Versions: 3.0
>            Reporter: David Jencks
>            Assignee: David Jencks
>             Fix For: 3.0
>
>
> Not sure if this was required in ee5, but ee6 requires that if a naming entry 
> type is missing, it be determined from the injection target type, and that 
> all these be consistent.

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

Reply via email to