http://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/core/ContainerBase.html
http://wiki.gentoo.org/wiki/Apache_Tomcat
http://www.searchman.info/java_eclipse/1040.html
$ cat /var/lib/tomcat-7-main/conf/Catalina/localhost/test001.xml <?xml version="1.0" encoding="UTF-8"?> <Context reloadable="true" backgroundProcessorDelay="1" > <WatchedResource>WEB-INF/web.xml</WatchedResource> </Context>
再起動が遅い。
reloadable="true"でも読み込みが遅い。10秒。
javac xxx.java => xxx.class で出力途中のファイルが読み込まれるとおかしくなる。メモリリーク。
意味は無いかもしれない。
javac -d ./tmp/ -classpath "/usr/share/tomcat-servlet-api-3.0/lib/servlet-api.jar" HelloWorld.java && mv -f ./tmp/HelloWorld.class .
jspは関係ないかもしれない。
eclipseを使うのが正解かもしれない。
$ grep -nriP "backgroundProcessorDelay\s*=" apache-tomcat-7.0.32-src/ apache-tomcat-7.0.32-src/java/org/apache/catalina/core/StandardEngine.java:76: backgroundProcessorDelay = 10; apache-tomcat-7.0.32-src/java/org/apache/catalina/core/ContainerBase.java:176: protected int backgroundProcessorDelay = -1; apache-tomcat-7.0.32-src/java/org/apache/catalina/core/ContainerBase.java:370: backgroundProcessorDelay = delay;
backgroundProcessorDelayはreloadable限定の設定ではないのでテスト以外で変な値にするとダメかもしれない。
$ grep -iP "java|tomcat" /var/lib/portage/world | while read pkgname; do eix -I $pkgname | grep -P "(^\[I\]\s)|(^\s*Installed versions:)"; done [I] dev-java/jdbc-mysql Installed versions: 5.1.18^t(08:14:30 08/22/13)(-c3p0 -log4j -source ELIBC="-FreeBSD") [I] dev-java/struts Installed versions: 1.2.9-r3(1.2)(05:50:48 04/06/13)(doc examples source ELIBC="-FreeBSD") [I] www-servers/tomcat Installed versions: 7.0.32(7)^t(06:25:34 04/06/13)(doc extra-webapps source -test ELIBC="-FreeBSD")
#$ sudo /usr/share/tomcat-7/gentoo/tomcat-instance-manager.bash --create #$ sudo /usr/share/tomcat-7/gentoo/tomcat-instance-manager.bash --remove $ sudo /usr/share/tomcat-7/gentoo/tomcat-instance-manager.bash --create --suffix main
$ cat /var/lib/tomcat-7-main/webapps/test001/WEB-INF/web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> <servlet> <servlet-name>hello</servlet-name> <servlet-class>HelloWorld</servlet-class> </servlet> <servlet-mapping> <servlet-name> hello </servlet-name> <url-pattern> /hello </url-pattern> </servlet-mapping> </web-app>
$ cat /var/lib/tomcat-7-main/webapps/test001/WEB-INF/classes/HelloWorld.java import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class HelloWorld extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { PrintWriter out = response.getWriter(); out.println("HelloWorld."); out.close(); } }
javac -d ./tmp/ -classpath "/usr/share/tomcat-servlet-api-3.0/lib/servlet-api.jar" HelloWorld.java && mv -f ./tmp/HelloWorld.class .
$ tail -n0 -f /var/log/tomcat-7-main/catalina.2013-08-23.log Aug 23, 2013 8:23:02 AM org.apache.catalina.core.StandardContext reload INFO: Reloading Context with name [/test001] has started Aug 23, 2013 8:23:02 AM org.apache.catalina.core.StandardContext reload INFO: Reloading Context with name [/test001] is completed
/var/lib/tomcat-7-main/conf/Catalina/localhost/test001.xml /var/lib/tomcat-7-main/webapps/test001/WEB-INF/classes/HelloWorld.java /var/lib/tomcat-7-main/webapps/test001/WEB-INF/web.xml
$ curl http://localhost:8080/test001/hello HelloWorld.1
0 件のコメント:
コメントを投稿