There can be special cases where you may not able to deploy a web application in your application server because of the $subject exception but it may worked in Apache Tomcat. So you may misunderstand that its a bug in your web app or bug in the application server. Fortunately its not, but its a problem of your configuration. Will explain the solution later, but lets see how I get to the solution.
So in the first case I have no idea about this and I was digging in to bit further for a solution. As in the exception say it should be a problem of initialization of log4j. Hmmm.... what could be the course of this? In my case the web application was successfully deployed in Apache Tomcat, but not in WSO2 Application Server. Knowing the fact that WSO2 Application Server build on top of Apache Tomcat it should be something done to the web application archive by WSO2 Application Server before deploying it in the Apache Tomcat. So what is could be? Oh.. it is exploded....
Now I found the difference between deploy in the Apache Tomcat and Deploy in the WSO2 Server, So I need to find the solution how the exploding causing the above problem. Then I search on it and found the following.
In a web archive (.war), Tomcat expect everything to be at the same place. If it it exploded then all the files have their own paths. Tomcat itself explode the web archive, but before that it reads some of the configurations from the war file like log4j listeners.
When the war file have the following configuration in its web.xml,
<context-param> <param-name>log4jConfigLocation</param-name> <param-value>/WEB-INF/log4j.xml</param-value> </context-param>
Apache Tomcat expect log4.xml in its a war file in the given location. But since the war exploded it could not find the log4j.xml. So it fails.
Now what we need to be done is we need to change the configuration so that it will read from a file system. For that you need to change the above configuration to the following.
<context-param> <param-name>log4jExposeWebAppRoot</param-name> <param-value>false</param-value> </context-param>
My problem Solved... Hope you too solve yours...
Good point. I've got it. Thanks for your work.
ReplyDelete