Reputation: 750
I created maven parent module with two maven children. It is web based application in war output that is deployed to Tomcat directory.The problem is that for testing war file I have to start Tomcat and test the app. For this scenario I decided to use jetty maven plugin in parent POM.xml file. Here is how it looks like:
<modules>
<module>hellojavaworld</module>
<module>application</module>
</modules>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.11.v20150529</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webApp>
<contextPath>/hellojavaworld</contextPath>
</webApp>
<war>c:\apache-tomcat-7.0.64\webapps\hellojavaworld.war</war>
</configuration>
</plugin>
If I start Tomcat manually and use http://localhost:8080/hellojavaworld it works fine. On the other hand when used
mvn jetty:run-war
it works,but got stucks on error:
HTTP ERROR 500
Problem accessing /hellojavaworld/HelloServlet. Reason:
Server Error
Caused by:
java.lang.NoClassDefFoundError: org/apache/log4j/Level
I know this problem is very common,because of the missing jars. I know that these jars are placed in c:\apache-tomcat-7.0.64\lib\ folder.
So the question is how to tell the jetty to use this folder as external jars for my war file?
Note: for the Tomcat itself it runs,there is just problem with jetty.
Upvotes: 0
Views: 135
Reputation: 49462
Jetty doesn't use log4j.
Why would you expect the Web Container to provide your WebApp logging outside of the servlet spec?
See the various
ServletContext.log()
methods for actual servlet spec logging
Suggestion: Put your log4j jar files in your webapp's WEB-INF/lib/
Upvotes: 1