Geronimo
  1. Geronimo
  2. GERONIMO-5346

infer jndi type from injection target; check type consistency

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.0
    • Fix Version/s: 3.0.0
    • Component/s: deployment, naming
    • Security Level: public (Regular issues)
    • Labels:
      None

      Description

      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.

        Activity

        Hide
        Jarek Gawor added a comment -

        You are getting this exception because the web.xml is using servlet 2.4 xsd and the <env-entry-type> is commented out. In servlet 2.4 xsd the <env-entry-type> element is required. It is not required in sevlet 2.5 xsd and greater.

        Please open a separate jira for this NPE but this is definitely not a critical problem.

        Show
        Jarek Gawor added a comment - You are getting this exception because the web.xml is using servlet 2.4 xsd and the <env-entry-type> is commented out. In servlet 2.4 xsd the <env-entry-type> element is required. It is not required in sevlet 2.5 xsd and greater. Please open a separate jira for this NPE but this is definitely not a critical problem.
        Hide
        viola.lu added a comment - - edited

        I updated @Resource to @Resource(name="welcomeMessage"), it's deployed successfully, but failed to start the deployed helloworld, errors:
        2010-09-13 12:16:19,296 ERROR [GBeanInstanceState] Error while starting; GBean is now in the FAILED state: abstractName="org.apache.test/helloworld/1.0/car?J2EEApplication=null,j2eeType=WebModule,name=org.apache.test/helloworld/1.0/car"
        java.lang.NullPointerException
        at java.util.Hashtable.put(Hashtable.java:394)
        at org.apache.catalina.deploy.NamingResources.addEnvironment(NamingResources.java:233)
        at org.apache.catalina.deploy.WebXml.configureContext(WebXml.java:1169)
        at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1288)
        at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:875)
        at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:313)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4632)
        at org.apache.geronimo.tomcat.GeronimoStandardContext.access$101(GeronimoStandardContext.java:99)
        at org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:711)
        at org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:47)
        at org.apache.geronimo.tomcat.valve.ProtectedTargetValve.invoke(ProtectedTargetValve.java:53)
        at org.apache.geronimo.tomcat.GeronimoStandardContext.startInternal(GeronimoStandardContext.java:459)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:137)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:777)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:755)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:558)
        at org.apache.geronimo.tomcat.TomcatContainer.addContext(TomcatContainer.java:334)
        at org.apache.geronimo.tomcat.TomcatWebAppContext.doStart(TomcatWebAppContext.java:610)
        at org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance(GBeanInstance.java:975)
        at org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:269)
        at org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:103)
        at org.apache.geronimo.gbean.runtime.GBeanInstance.start(GBeanInstance.java:546)
        at org.apache.geronimo.gbean.runtime.GBeanDependency.attemptFullStart(GBeanDependency.java:110)
        at org.apache.geronimo.gbean.runtime.GBeanDependency.addTarget(GBeanDependency.java:145)
        at org.apache.geronimo.gbean.runtime.GBeanDependency$1.running(GBeanDependency.java:119)
        at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.fireRunningEvent(BasicLifecycleMonitor.java:175)
        at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.access$300(BasicLifecycleMonitor.java:44)
        at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor$RawLifecycleBroadcaster.fireRunningEvent(BasicLifecycleMonitor.java:253)
        at org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:295)
        at org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:103)
        at org.apache.geronimo.gbean.runtime.GBeanInstance.start(GBeanInstance.java:546)
        at org.apache.geronimo.gbean.runtime.GBeanDependency.attemptFullStart(GBeanDependency.java:110)
        at org.apache.geronimo.gbean.runtime.GBeanDependency.addTarget(GBeanDependency.java:145)
        at org.apache.geronimo.gbean.runtime.GBeanDependency$1.running(GBeanDependency.java:119)
        at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.fireRunningEvent(BasicLifecycleMonitor.java:175)
        at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.access$300(BasicLifecycleMonitor.java:44)
        at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor$RawLifecycleBroadcaster.fireRunningEvent(BasicLifecycleMonitor.java:253)
        at org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:295)
        at org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:103)
        at org.apache.geronimo.gbean.runtime.GBeanInstanceState.startRecursive(GBeanInstanceState.java:125)
        at org.apache.geronimo.gbean.runtime.GBeanInstance.startRecursive(GBeanInstance.java:560)
        at org.apache.geronimo.kernel.basic.BasicKernel.startRecursiveGBean(BasicKernel.java:386)
        at org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:460)
        at org.apache.geronimo.kernel.config.KernelConfigurationManager.start(KernelConfigurationManager.java:224)
        at org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:698)
        at org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:677)
        at org.apache.geronimo.deployment.plugin.local.StartCommand.run(StartCommand.java:67)
        at java.lang.Thread.run(Thread.java:619)
        2010-09-13 12:16:19,328 INFO [KernelContextGBean] unbound gbean org.apache.test/helloworld/1.0/car?J2EEApplication=null,WebModule=org.apache.test/helloworld/1.0/car,j2eeType=ValidatorFactory,name=ValidatorFactory at name org.apache.test/helloworld/ValidatorFactory/ValidatorFactory
        2010-09-13 12:16:19,375 ERROR [DeploymentPortlet] The application was not successfully started.
        start of org.apache.test/helloworld/1.0/car failed
        org.apache.geronimo.kernel.config.LifecycleException: start of org.apache.test/helloworld/1.0/car failed
        at org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:714)
        at org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:677)
        at org.apache.geronimo.deployment.plugin.local.StartCommand.run(StartCommand.java:67)
        at java.lang.Thread.run(Thread.java:619)
        Caused by: org.apache.geronimo.kernel.config.InvalidConfigException: Unknown start exception
        at org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:522)
        at org.apache.geronimo.kernel.config.KernelConfigurationManager.start(KernelConfigurationManager.java:224)
        at org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:698)
        ... 3 more
        Caused by: org.apache.geronimo.gbean.InvalidConfigurationException: Configuration org.apache.test/helloworld/1.0/car failed to start due to the following reasons:
        The service J2EEApplication=null,j2eeType=WebModule,name=org.apache.test/helloworld/1.0/car did not start for an unknown reason

        at org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:488)
        ... 5 more

        Show
        viola.lu added a comment - - edited I updated @Resource to @Resource(name="welcomeMessage"), it's deployed successfully, but failed to start the deployed helloworld, errors: 2010-09-13 12:16:19,296 ERROR [GBeanInstanceState] Error while starting; GBean is now in the FAILED state: abstractName="org.apache.test/helloworld/1.0/car?J2EEApplication=null,j2eeType=WebModule,name=org.apache.test/helloworld/1.0/car" java.lang.NullPointerException at java.util.Hashtable.put(Hashtable.java:394) at org.apache.catalina.deploy.NamingResources.addEnvironment(NamingResources.java:233) at org.apache.catalina.deploy.WebXml.configureContext(WebXml.java:1169) at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1288) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:875) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:313) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4632) at org.apache.geronimo.tomcat.GeronimoStandardContext.access$101(GeronimoStandardContext.java:99) at org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:711) at org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:47) at org.apache.geronimo.tomcat.valve.ProtectedTargetValve.invoke(ProtectedTargetValve.java:53) at org.apache.geronimo.tomcat.GeronimoStandardContext.startInternal(GeronimoStandardContext.java:459) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:137) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:777) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:755) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:558) at org.apache.geronimo.tomcat.TomcatContainer.addContext(TomcatContainer.java:334) at org.apache.geronimo.tomcat.TomcatWebAppContext.doStart(TomcatWebAppContext.java:610) at org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance(GBeanInstance.java:975) at org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:269) at org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:103) at org.apache.geronimo.gbean.runtime.GBeanInstance.start(GBeanInstance.java:546) at org.apache.geronimo.gbean.runtime.GBeanDependency.attemptFullStart(GBeanDependency.java:110) at org.apache.geronimo.gbean.runtime.GBeanDependency.addTarget(GBeanDependency.java:145) at org.apache.geronimo.gbean.runtime.GBeanDependency$1.running(GBeanDependency.java:119) at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.fireRunningEvent(BasicLifecycleMonitor.java:175) at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.access$300(BasicLifecycleMonitor.java:44) at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor$RawLifecycleBroadcaster.fireRunningEvent(BasicLifecycleMonitor.java:253) at org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:295) at org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:103) at org.apache.geronimo.gbean.runtime.GBeanInstance.start(GBeanInstance.java:546) at org.apache.geronimo.gbean.runtime.GBeanDependency.attemptFullStart(GBeanDependency.java:110) at org.apache.geronimo.gbean.runtime.GBeanDependency.addTarget(GBeanDependency.java:145) at org.apache.geronimo.gbean.runtime.GBeanDependency$1.running(GBeanDependency.java:119) at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.fireRunningEvent(BasicLifecycleMonitor.java:175) at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.access$300(BasicLifecycleMonitor.java:44) at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor$RawLifecycleBroadcaster.fireRunningEvent(BasicLifecycleMonitor.java:253) at org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:295) at org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:103) at org.apache.geronimo.gbean.runtime.GBeanInstanceState.startRecursive(GBeanInstanceState.java:125) at org.apache.geronimo.gbean.runtime.GBeanInstance.startRecursive(GBeanInstance.java:560) at org.apache.geronimo.kernel.basic.BasicKernel.startRecursiveGBean(BasicKernel.java:386) at org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:460) at org.apache.geronimo.kernel.config.KernelConfigurationManager.start(KernelConfigurationManager.java:224) at org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:698) at org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:677) at org.apache.geronimo.deployment.plugin.local.StartCommand.run(StartCommand.java:67) at java.lang.Thread.run(Thread.java:619) 2010-09-13 12:16:19,328 INFO [KernelContextGBean] unbound gbean org.apache.test/helloworld/1.0/car?J2EEApplication=null,WebModule=org.apache.test/helloworld/1.0/car,j2eeType=ValidatorFactory,name=ValidatorFactory at name org.apache.test/helloworld/ValidatorFactory/ValidatorFactory 2010-09-13 12:16:19,375 ERROR [DeploymentPortlet] The application was not successfully started. start of org.apache.test/helloworld/1.0/car failed org.apache.geronimo.kernel.config.LifecycleException: start of org.apache.test/helloworld/1.0/car failed at org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:714) at org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:677) at org.apache.geronimo.deployment.plugin.local.StartCommand.run(StartCommand.java:67) at java.lang.Thread.run(Thread.java:619) Caused by: org.apache.geronimo.kernel.config.InvalidConfigException: Unknown start exception at org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:522) at org.apache.geronimo.kernel.config.KernelConfigurationManager.start(KernelConfigurationManager.java:224) at org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:698) ... 3 more Caused by: org.apache.geronimo.gbean.InvalidConfigurationException: Configuration org.apache.test/helloworld/1.0/car failed to start due to the following reasons: The service J2EEApplication=null,j2eeType=WebModule,name=org.apache.test/helloworld/1.0/car did not start for an unknown reason at org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:488) ... 5 more
        Jarek Gawor made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Jarek Gawor added a comment -

        The error message is correct. The problem is that the JNDI name of the env-entry in the deployment descriptor does not match the JNDI name of @Resource annotation. To make them match change @Resource to @Resource(name="welcomeMessage").

        Show
        Jarek Gawor added a comment - The error message is correct. The problem is that the JNDI name of the env-entry in the deployment descriptor does not match the JNDI name of @Resource annotation. To make them match change @Resource to @Resource(name="welcomeMessage").
        viola.lu made changes -
        Attachment helloworld.zip [ 12454375 ]
        Hide
        viola.lu added a comment -

        Here is my test application source.

        Show
        viola.lu added a comment - Here is my test application source.
        viola.lu made changes -
        Resolution Fixed [ 1 ]
        Status Closed [ 6 ] Reopened [ 4 ]
        Hide
        viola.lu added a comment -

        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.WebModule@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.WebModule@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.

        Show
        viola.lu added a comment - 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.WebModule@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.WebModule@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.
        David Jencks made changes -
        Field Original Value New Value
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]
        Hide
        David Jencks added a comment -

        seems to be working.

        Show
        David Jencks added a comment - seems to be working.
        Hide
        David Jencks added a comment -

        rev 952718 allows subclasses to be type-compatible.

        Show
        David Jencks added a comment - rev 952718 allows subclasses to be type-compatible.
        Hide
        David Jencks added a comment -

        resources rev 948266

        Show
        David Jencks added a comment - resources rev 948266
        Hide
        David Jencks added a comment -

        env entries rev 947954

        Show
        David Jencks added a comment - env entries rev 947954
        David Jencks created issue -

          People

          • Assignee:
            David Jencks
            Reporter:
            David Jencks
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development