How to change dispatcherServlet for HTTP-Gateway
qpool.char Apr 14, 2011 12:31 PMHello,
with JbossESB 4.9 and Jboss AS 4.2.3 i could change the dispatcherServlet of the http-gateway like this:
<jbossesb parameterReloadSecs="5"
xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.1.0.xsd" >
[...]
<service ...>
<listeners>
<http-listener name="A1-HTTP" busidref="HTTP-1" maxThreads="100" is-gateway="true">
<property name="dispatch_servlet" value="de.test.MyHTTPServlet" />
</http-listener>
</listeners>
[...]
This worked well.
However, with JbossESB 4.9 and Jboss AS 5.1 (SOA-P-5.1) i get the following exception:
18:03:33,712 ERROR [AbstractKernelController] Error installing to Start: name=jboss.esb.vfsfile:/C:/work/JavaStuff/jboss-soa-p-standalone-5/
jboss-esb/server/default/deploy/sample.esb/ state=Create
org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException: Failed to start Http gateway listener
at org.jboss.soa.esb.listeners.gateway.HttpGatewayListener.doStart(HttpGatewayListener.java:247)
at org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle.start(AbstractManagedLifecycle.java:173)
at org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleController.startInstances(ManagedLifecycleController.java:136)
at org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleController.start(ManagedLifecycleController.java:67)
at org.jboss.soa.esb.listeners.deployers.mc.EsbDeployment.start(EsbDeployment.java:232)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[...]
Caused by: java.lang.NullPointerException
at org.apache.catalina.core.StandardContext.engineBase(StandardContext.java:4765)
at org.apache.catalina.core.StandardContext.getBasePath(StandardContext.java:4853)
at org.apache.catalina.core.StandardContext.getServletContext(StandardContext.java:1745)
at org.jboss.soa.esb.listeners.gateway.HttpGatewayListener.initWebappDefaults(HttpGatewayListener.java:452)
at org.jboss.soa.esb.listeners.gateway.HttpGatewayListener.startHttpServer(HttpGatewayListener.java:330)
at org.jboss.soa.esb.listeners.gateway.HttpGatewayListener.doStart(HttpGatewayListener.java:245)
... 58 more
I could not figure it out, so i though ok, lets go on with some new options provided by new jboss-esb.xsd
So i tried:
<jbossesb parameterReloadSecs="5"
xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd" >
[...]
<service ...>
<listeners>
<http-gateway name="Http" urlPattern="esb-cars/*">
<property name="dispatch_servlet" value="de.test.MyHTTPServlet" />
</http-gateway>
</listeners>
[...]
The esb-service is now deployed and provided correctly, however the dispatcher-servlet is not changed. I had a look at class org.jboss.soa.esb.listeners.gateway.HttpGatewayListener, in which you can find the code-fragment
/**The tag used to read the dispatch servlet class name value from configuration */
public static final String DISPATCH_SERVLET_CLASS = "dispatch_servlet";
[...]
if (config.getAttribute(DISPATCH_SERVLET_CLASS) != null) {
dispatchServletClassName = config.getAttribute(DISPATCH_SERVLET_CLASS);
}
[...]
but nothing happens. It still loads the standard dispatcherServlet.
Can you show me a way to replace this servlet in http-gateway? Is it possible?
Thanks in advance!