Details
Description
When both tomcat http and https connector gbeans are unloaded, java.net.MalformedURLException occurs while running tomcat module startup.
This configuration is, for example, a typical case that other web server ( Apache HTTP Server, IIS, etc. ) connects geronimo server and processes all http requests firstly as the main http server.
Tomcat module setting in config.xml:
<module name="org.apache.geronimo.configs/tomcat6/2.0-M6/car">
<gbean name="TomcatResources"/>
<gbean load="false" name="TomcatWebConnector">
<attribute name="host">${PlanServerHostname}</attribute>
<attribute name="port">${PlanHTTPPortPrimary + portOffset}</attribute>
<attribute name="redirectPort">${PlanHTTPSPortPrimary + portOffset}</attribute>
</gbean>
<gbean name="TomcatAJPConnector">
<attribute name="host">${PlanServerHostname}</attribute>
<attribute name="port">${PlanAJPPortPrimary + portOffset}</attribute>
<attribute name="redirectPort">${PlanHTTPSPortPrimary + portOffset}</attribute>
</gbean>
<gbean load="false" name="TomcatWebSSLConnector">
<attribute name="host">${PlanServerHostname}</attribute>
<attribute name="port">${PlanHTTPSPortPrimary + portOffset}</attribute>
</gbean>
</module>
Stack trace in geronimo log:
18:30:41,156 ERROR [TomcatWebAppContext] Bad URL to connect to web app
java.net.MalformedURLException: unknown protocol: ajp
at java.net.URL.<init>(URL.java:574)
at java.net.URL.<init>(URL.java:464)
at java.net.URL.<init>(URL.java:413)
at org.apache.geronimo.tomcat.TomcatWebAppContext.getURLFor(TomcatWebAppContext.java:383)
at org.apache.geronimo.tomcat.TomcatWebAppContext$$FastClassByCGLIB$$776c85b4.invoke(<generated>)
at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
at org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
at org.apache.geronimo.gbean.runtime.GBeanAttribute.getValue(GBeanAttribute.java:390)
at org.apache.geronimo.gbean.runtime.GBeanInstance.getAttribute(GBeanInstance.java:689)
at org.apache.geronimo.kernel.basic.BasicKernel.getAttribute(BasicKernel.java:178)
at org.apache.geronimo.deployment.plugin.local.CommandSupport.addWebURLs(CommandSupport.java:295)
at org.apache.geronimo.deployment.plugin.jmx.JMXDeploymentManager.getModules(JMXDeploymentManager.java:177)
at org.apache.geronimo.deployment.plugin.jmx.JMXDeploymentManager.getAvailableModules(JMXDeploymentManager.java:118)
at org.apache.geronimo.deployment.hot.DirectoryHotDeployer.doStart(DirectoryHotDeployer.java:160)
at org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance(GBeanInstance.java:994)
at org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:268)
at org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:102)
at org.apache.geronimo.gbean.runtime.GBeanInstanceState.startRecursive(GBeanInstanceState.java:124)
at org.apache.geronimo.gbean.runtime.GBeanInstance.startRecursive(GBeanInstance.java:551)
at org.apache.geronimo.kernel.basic.BasicKernel.startRecursiveGBean(BasicKernel.java:379)
at org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:442)
at org.apache.geronimo.kernel.config.KernelConfigurationManager.start(KernelConfigurationManager.java:188)
at org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:530)
at org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:511)
at org.apache.geronimo.kernel.config.SimpleConfigurationManager$$FastClassByCGLIB$$ce77a924.invoke(<generated>)
at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
at org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:127)
at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:828)
at org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57)
at org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke(RawOperationInvoker.java:35)
at org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept(ProxyMethodInterceptor.java:96)
at org.apache.geronimo.kernel.config.EditableConfigurationManager$$EnhancerByCGLIB$$6e667324.startConfiguration(<generated>)
at org.apache.geronimo.system.main.EmbeddedDaemon.doStartup(EmbeddedDaemon.java:150)
at org.apache.geronimo.system.main.EmbeddedDaemon.execute(EmbeddedDaemon.java:71)
at org.apache.geronimo.kernel.util.MainConfigurationBootstrapper.main(MainConfigurationBootstrapper.java:45)
at org.apache.geronimo.cli.AbstractCLI.executeMain(AbstractCLI.java:67)
at org.apache.geronimo.cli.daemon.DaemonCLI.main(DaemonCLI.java:30)
18:30:41,203 ERROR [GBeanInstanceState] Error while starting; GBean is now in the FAILED state: abstractName="org.apache.geronimo.configs/hot-deployer/2.0-M6-rc1/car?ServiceModule=org.apache.geronimo.configs/hot-deployer/2.0-M6-rc1/car,j2eeType=GBean,name=HotDeployer"
javax.enterprise.deploy.spi.exceptions.TargetException
at org.apache.geronimo.deployment.plugin.jmx.JMXDeploymentManager.getModules(JMXDeploymentManager.java:180)
at org.apache.geronimo.deployment.plugin.jmx.JMXDeploymentManager.getAvailableModules(JMXDeploymentManager.java:118)
at org.apache.geronimo.deployment.hot.DirectoryHotDeployer.doStart(DirectoryHotDeployer.java:160)
at org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance(GBeanInstance.java:994)
at org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:268)
at org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:102)
at org.apache.geronimo.gbean.runtime.GBeanInstanceState.startRecursive(GBeanInstanceState.java:124)
at org.apache.geronimo.gbean.runtime.GBeanInstance.startRecursive(GBeanInstance.java:551)
at org.apache.geronimo.kernel.basic.BasicKernel.startRecursiveGBean(BasicKernel.java:379)
at org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:442)
at org.apache.geronimo.kernel.config.KernelConfigurationManager.start(KernelConfigurationManager.java:188)
at org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:530)
at org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:511)
at org.apache.geronimo.kernel.config.SimpleConfigurationManager$$FastClassByCGLIB$$ce77a924.invoke(<generated>)
at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
at org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:127)
at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:828)
at org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57)
at org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke(RawOperationInvoker.java:35)
at org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept(ProxyMethodInterceptor.java:96)
at org.apache.geronimo.kernel.config.EditableConfigurationManager$$EnhancerByCGLIB$$6e667324.startConfiguration(<generated>)
at org.apache.geronimo.system.main.EmbeddedDaemon.doStartup(EmbeddedDaemon.java:150)
at org.apache.geronimo.system.main.EmbeddedDaemon.execute(EmbeddedDaemon.java:71)
at org.apache.geronimo.kernel.util.MainConfigurationBootstrapper.main(MainConfigurationBootstrapper.java:45)
at org.apache.geronimo.cli.AbstractCLI.executeMain(AbstractCLI.java:67)
at org.apache.geronimo.cli.daemon.DaemonCLI.main(DaemonCLI.java:30)
Caused by: java.lang.NullPointerException
at org.apache.geronimo.deployment.plugin.local.CommandSupport.addWebURLs(CommandSupport.java:295)
at org.apache.geronimo.deployment.plugin.jmx.JMXDeploymentManager.getModules(JMXDeploymentManager.java:177)
... 26 more
The root cause of this exception is that the TomcatWebAppContext#getURLFor method returns null.
Needless to say, java.net.URL class does not support local protocol like "ajp".
A workaround is that tomcat module loads either its http or https connector gbean.
However, most users will not want to open needless network service.