tags:

views:

170

answers:

1

I need to create a startup class in Websphere. This class is present in abc.jar. And also abc.jar requires log4j.jar at startup of server.

For above scenario, i have created the startup class with abc.jar in classpath in websphere console and I kept log4j.jar in ext folder of WAS. This works for me. But problem is that the other profiles share same ext folder of WAS and does not able to start up due to Log4j.jar. If I keep Log4j.jar in other place and keep that location in classpath. Startup class will not fails.Please help me.

A: 

I'm not very familiar with WebSphere and maybe I do not fully understand your problem - but how about deploying a webapp with a startup servlet defined in web.xml?

Here's what I mean:

  • create a abc.war with abc.jar and log4j.jar copied to abc.war/WEB-INF/lib
  • define your startup class in abc.war/WEB-INF/web.xml as follows:

<web-app id="WebApp">
<display-name>abc.war</display-name>
<servlet> 
    <servlet-name>ABCStartupServlet</servlet-name>
    <display-name>ABCStartupServlet</display-name>
    <servlet-class>abc.ABCStartupServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
 </servlet>
 ...

That way you have log4j.jar and abc.jar together in one place, you can use the WebSphere classloader settings if another log4j version causes problems and your class is called during the startup of the server.

pitpod