The jetty plug-in of Maven prompts no transaction manager found to solve the problem of slow startup.

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.