Subscribed unsubscribe Subscribe Subscribe

玄箱ProでTomcat 再挑戦

Javaの環境から。
gijとかgcjとか、GNUJavaを入れてみたけど、どうもダメっぽい。
Chicken-Developer - 玄箱PRO-Tomcat
ここに書いてあるとおり、やはりfree-java-sdkか。
期間限定の評価版は、なんか悔しいから使いたくない。


で、Tomcat本体。
一応、最新版?のTomcat 6.0.16で試してみる。

kurobox:/home/work/apache-tomcat-6.0.16/logs# cat catalina.out
java.lang.UnsupportedClassVersionError
   at java.lang.VMClassLoader.nativeDefineClass (VMClassLoader.java)
   at java.lang.VMClassLoader.defineClass (VMClassLoader.java:130)
   at java.lang.ClassLoader.defineClass (ClassLoader.java:679)
   at java.security.SecureClassLoader.defineClass (SecureClassLoader.java:108)
   at java.net.URLClassLoader.findClass (URLClassLoader.java:955)
   at java.lang.ClassLoader.loadClass (ClassLoader.java:359)
   at java.lang.ClassLoader$1.loadClass (ClassLoader.java:1333)
   at java.lang.ClassLoader.loadClass (ClassLoader.java:310)
   at java.lang.VirtualMachine.main (VirtualMachine.java:99)

あ、Versionがやっぱりダメですか。
JDK 1.4 Compatability PackageがついているTomcat 5.5でいくしかなさそう。


apache-tomcat-5.5.26.tar.gz
apache-tomcat-5.5.26-compat.tar.gz
の2点を入手。compatが無いと少なくともこのfree-java-sdkでは動かない模様。

kurobox:/home/work# tar zvxf apache-tomcat-5.5.26.tar.gz
...
kurobox:/home/work# tar zvxf apache-tomcat-5.5.26-compat.tar.gz
...

で、展開。動かしてみる。

kurobox:/home/work# ./apache-tomcat-5.5.26/bin/startup.sh
Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program

Chicken-Developer - 玄箱PRO-Tomcat
ここの通り、startup.shを変更

kurobox:/home/work# cd apache-tomcat-5.5.26/bin/
kurobox:/home/work/apache-tomcat-5.5.26/bin# cp startup.sh startup.sh.org
kurobox:/home/work/apache-tomcat-5.5.26/bin# vi startup.sh
kurobox:/home/work/apache-tomcat-5.5.26/bin# diff startup.sh startup.sh.org
7c7
< export JRE_HOME=/usr
---
>
kurobox:/home/work/apache-tomcat-5.5.26/bin# ./startup.sh
Using CATALINA_BASE:   /home/work/apache-tomcat-5.5.26
Using CATALINA_HOME:   /home/work/apache-tomcat-5.5.26
Using CATALINA_TMPDIR: /home/work/apache-tomcat-5.5.26/temp
Using JRE_HOME:       /usr

これでどうだ。

kurobox:/home/work/apache-tomcat-5.5.26/bin# cat ../logs/catalina.out
...
WARNING: System property "java.util.logging.manager" should be the name of a subclass of java.util.logging.LogManager
Created MBeanServer with ID: [UID: 10163628,1215321228618,-32768]:kurobox:1
Jul 6, 2008 2:14:23 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: .
Jul 6, 2008 2:14:36 PM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jul 6, 2008 2:14:38 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 44133 ms
Jul 6, 2008 2:14:47 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jul 6, 2008 2:14:48 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.26
Jul 6, 2008 2:14:49 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Jul 6, 2008 2:15:57 PM org.apache.catalina.core.ApplicationContext log
INFO: org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
Jul 6, 2008 2:16:13 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Jul 6, 2008 2:16:13 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Jul 6, 2008 2:16:54 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Jul 6, 2008 2:16:54 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Jul 6, 2008 2:17:32 PM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jul 6, 2008 2:17:48 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Jul 6, 2008 2:17:49 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=2/4162  config=null
Jul 6, 2008 2:17:53 PM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
Jul 6, 2008 2:17:56 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 198059 ms

WARNING出てるけど・・・まぁ動いてくれるならいいか?
解決法が分かれば追記する。
とりあえずはhttp://<玄箱ProのIPアドレス>:8080/でつながった!!
起動までは3分強か・・・orz
さて、次は停止させてみる。こちらもshutdown.shを書き換える必要があるみたい。

kurobox:/home/work/apache-tomcat-5.5.26/bin# cp shutdown.sh shutdown.sh.org
kurobox:/home/work/apache-tomcat-5.5.26/bin# vi shutdown.sh
kurobox:/home/work/apache-tomcat-5.5.26/bin# diff shutdown.sh shutdown.sh.org
7c7
< export JRE_HOME=/usr
---
>
kurobox:/home/work/apache-tomcat-5.5.26/bin# ./shutdown.sh
Using CATALINA_BASE:   /home/work/apache-tomcat-5.5.26
Using CATALINA_HOME:   /home/work/apache-tomcat-5.5.26
Using CATALINA_TMPDIR: /home/work/apache-tomcat-5.5.26/temp
Using JRE_HOME:       /usr
WARNING: System property "java.util.logging.manager" should be the name of a subclass of java.util.logging.LogManager
Created MBeanServer with ID: [UID: 10163616,1215320063715,-32768]:kurobox:1

止まった・・・?

kurobox:/home/work/apache-tomcat-5.5.26/bin# cat ../logs/catalina.out
...
Jul 6, 2008 2:25:10 PM org.apache.coyote.http11.Http11BaseProtocol pause
INFO: Pausing Coyote HTTP/1.1 on http-8080
Jul 6, 2008 2:25:10 PM org.apache.jk.common.ChannelSocket acceptConnections
WARNING: Exception executing accept
Jul 6, 2008 2:25:11 PM org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
Jul 6, 2008 2:25:12 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextDestroyed()
Jul 6, 2008 2:25:12 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextDestroyed()
Jul 6, 2008 2:25:15 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextDestroyed()
Jul 6, 2008 2:25:15 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextDestroyed()
Jul 6, 2008 2:25:16 PM org.apache.coyote.http11.Http11BaseProtocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080
Jul 6, 2008 2:25:17 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: Failed shutdown of Apache Portable Runtime

あら。Failedって。停止できないんですか。

kurobox:/home/work/apache-tomcat-5.5.26/bin# ps -ef
...
root     28727     1 28 14:13 pts/3    00:04:13 /usr/bin/sablevm -Y --classpath=:/home/wor...
root     28791 28727  0 14:17 pts/3    00:00:00 /usr/bin/sablevm -Y --classpath=:/home/wor...
root     28814 28791  0 14:17 pts/3    00:00:01 /usr/bin/sablevm -Y --classpath=:/home/wor...
root     28842 28791  0 14:17 pts/3    00:00:00 /usr/bin/sablevm -Y --classpath=:/home/wor...
...

4つくらいプロセスが生き残っている。
どうしようもない。

kurobox:/home/work/apache-tomcat-5.5.26/bin# kill -9 `ps -ef | grep [s]ablevm | awk '{ print $2; }'`

成仏してくれ><