Source: http://blog.csdn.net/chaijunkun/article/details/4253905. For more information, see. I will sort out relevant blog posts from time to time and improve the relevant content. Therefore, we strongly recommend that you view this article in the original source.
Using Maven to develop web projects greatly facilitates jar package dependencies. during testing, you can also integrate servlet containers. Jetty is undoubtedly the best choice in terms of startup speed and magnitude, however, from 8. x. If your web project does not contain database access (or no Transaction Manager), the system will prompt that the transaction manager cannot be found at startup. The output information is as follows:
oejpw.PlusConfiguration:No Transaction manager found - if your webapp requires one, please configure one.
In addition, the startup process will be paused for more than 10 seconds, which is a waste of time when code debugging is repeated. After searching for information on the Internet for several days, a solution is finally found.
First, configure the plug-in POM. xml:
<plugin><groupId>org.mortbay.jetty</groupId><artifactId>jetty-maven-plugin</artifactId><version>8.1.15.v20140411</version><configuration><stopKey>stop</stopKey><stopPort>9999</stopPort><scanIntervalSeconds>1</scanIntervalSeconds><contextXml>${project.basedir}/src/main/resources/jetty-context.xml</contextXml><webApp><contextPath>/</contextPath></webApp><connectors><connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector"><port>80</port><maxIdleTime>60000</maxIdleTime></connector></connectors></configuration></plugin>
It is important to add the <contextxml> Configuration to configure the jetty server attributes. In this example, the configuration file is stored in/src/main/resources. (If you do not want to include this file when packaging, you can put it in/src/test/resources, change the configuration), file name: jetty-context.xml. The following is the configuration file:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure.dtd"><Configure class="org.eclipse.jetty.webapp.WebAppContext"><Call name="setAttribute"><Arg>org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern</Arg><Arg>.*/.*jsp-api-[^/]\.jar$|./.*jsp-[^/]\.jar$|./.*taglibs[^/]*\.jar$</Arg></Call></Configure>
I have not studied this configuration in depth. If you are interested, read the references.
References: http://jira.codehaus.org/browse/JETTY-1503