Embedded Tomcat 7 slow compare to Tomcat 6
Perhaps it's slow due to classpath scanning which is required for annotation-based configuration of Servlet 3.0. If you don't need these features, try to add metadata-complete="true"
to your web.xml
.
How do you embed Tomcat in a java project?
While not exacting what you're asking for (Tomcat), I'd recommend including Jetty as a light-weight alternative. You can include it within your JAR as a Maven dependency & it's straight-forward to get a server up & running from your code.
From their example on their website, a server with a basic servlet could be done as easily as:
public class MinimalServlets {
public static void main(String[] args) throws Exception {
Server server = new Server(8080);
ServletHandler handler = new ServletHandler();
server.setHandler(handler);
handler.addServletWithMapping(HelloServlet.class, "/*");
server.start();
server.join();
}
public static class HelloServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
response.setStatus(HttpServletResponse.SC_OK);
response.getWriter().println("<h1>Hello SimpleServlet</h1>");
}
}
}
Deploy Spring Boot application in Tomcat 6 (Traditional deployment)
You are going against the Spring Boot requirements by trying to deploy to Tomcat 6. Even if you hack your application to start something might break later. Since you are on Spring Boot 1.5.9.RELEASE the docs mention it clearly:
Tomcat 7 & 8.0 work with Spring Boot, but the default is to use Tomcat 8.5. If you cannot use Tomcat 8.5 (for example, because you are using Java 1.6) you will need to change your classpath to reference a different version.
Tomcat 6 is legacy and running it's a security risk. It's security support ended on 31 December 2016 and you can't download it since 30 March 2017. Upgrade your Tomcat version.
configure Tomcat 6 with IntelliJ
You've defined tomcat's src folder instead of bin folder.
IntelliJ IDEA recognizes Tomcat 6 as predictable for me:
So, please download suitable distribution here:
https://archive.apache.org/dist/tomcat/tomcat-6/v6.0.9/bin/
Related Topics
Sha256Withrsa What Does It Do and in What Order
Rselenium Unknownerror - Java.Lang.Illegalstateexception with Google Chrome
Install Xlsx and Rjava on MACos Mavericks 10.9.5
Android Java.Net.Unknownhostexception: Host Is Unresolved (Strategy Question)
How to Highlight Multiple Words in Edittext
How to Script the Java Debugger Command-Line Tool (Jdb)
What Does a Java Static Method Look Like in Ruby
Svg/Vector Graphical Objects Boolean Operations (Union, Intersection, Subtraction)
Binary Xml File Line #0: Error Inflating Class Imageview
Boot_Completed Not Working on Android 10 Q API Level 29
Why Ruby Modulo Is Different from Java/Other Lang
How to Get from Jruby a Correctly Typed Ruby Implementation of a Java Interface
How to Adjust Microphone Sensitivity While Recording Audio in Android
Convert Normal Java Array or Arraylist to JSON Array in Android
How to Remove Specific Permission When Build Android App with Gradle