Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Making a request to Servlet from ServletContextListener:contextInitialized

 
vinodh rmahen
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to make a request to a servlet using HTTPClient within contextInitialized(ServletContextEvent event) of a ServletContextListener, but I get an exception saying that the web module has not yet been loaded.
I am trying this on IBM WebSphere Application Server 6.0.x

Is there any setting which can be used have the servlet initialized and ready to server requests when the call from contextInitialized(ServletContextEvent event) is made
Or
Is there any restriction in the Servlet Specification which prevents this from happening.

Here is the exception:

[4/30/09 8:13:28:782 EDT] 0000007f WebGroup A SRVE0169I: Loading Web Module: MyListener.
[4/30/09 8:13:28:891 EDT] 0000007f SystemOut O Inside MyListener:contextInitialized()
[4/30/09 8:13:29:110 EDT] 00000082 WebContainer E SRVE0232E: Internal Server Error.
Exception Message: [com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: /MyListener
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:233)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:210)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java(Compiled Code))
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java(Compiled Code))
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java(Compiled Code))
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java(Compiled Code))
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:288)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminaters(NewConnectionInitialReadCallback.java:207)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:109)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java(Compiled Code))
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java(Compiled Code))
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java(Compiled Code))
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java(Compiled Code))
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))
]
[4/30/09 8:13:29:110 EDT] 0000007f HttpMethodBas W Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.
[4/30/09 8:13:29:141 EDT] 0000007f SystemOut O <H1>SRVE0232E: Internal Server Error.
Exception Message: [Failed to load webapp: /MyListener]</H1>
<H3>Failed to load webapp: /MyListener</H3>
IBM WebSphere Application Server
[4/30/09 8:13:29:141 EDT] 0000007f VirtualHost I SRVE0250I: Web Module MyListener has been bound to default_host[*:80,*:10013,*:10010,*:10038,*:10035].
[4/30/09 8:13:29:157 EDT] 0000007f ApplicationMg A WSVR0221I: Application started: MyApp
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13056
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since calls to context listeners are part of the initialization process, initialization is NOT COMPLETE until all calls to listeners have returned. Therefore there is absolutely no reason to expect this to work.

You need to redesign - back up and try again.

Bill
 
vinodh rmahen
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for clarifying.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic