接上篇:
tomcat有了, war包有了, 现在需要把 war包部署到 tomcat里面去了
ZXIAOYU-M-338S:apache-tomcat-9.0.0.M6 test$ cp /Users/test/sazhuo/websocketServer/target/websocketServer.war webapps/
ZXIAOYU-M-338S:apache-tomcat-9.0.0.M6 test$ cd bin/
ZXIAOYU-M-338S:bin test$ ./startup.sh
Using CATALINA_BASE: /Users/test/sazhuo/apache-tomcat-9.0.0.M6
Using CATALINA_HOME: /Users/test/sazhuo/apache-tomcat-9.0.0.M6
Using CATALINA_TMPDIR: /Users/test/sazhuo/apache-tomcat-9.0.0.M6/temp
Using JRE_HOME: /Library/Java/JavaVirtualMachines/Home
Using CLASSPATH: /Users/test/sazhuo/apache-tomcat-9.0.0.M6/bin/bootstrap.jar:/Users/test/sazhuo/apache-tomcat-9.0.0.M6/bin/tomcat-juli.jar
touch: /Users/test/sazhuo/apache-tomcat-9.0.0.M6/logs/catalina.out: Permission denied
/Users/test/sazhuo/apache-tomcat-9.0.0.M6/bin/catalina.sh: line 411: /Users/test/sazhuo/apache-tomcat-9.0.0.M6/logs/catalina.out: Permission denied
ZXIAOYU-M-338S:bin test$ sudo chmod 755 catalina.out
Password:
chmod: catalina.out: No such file or directory
ZXIAOYU-M-338S:bin test$ ps -A |grep java
8859 ttys002 0:00.01 grep java
5748 ttys003 0:13.46 /Library/Java/JavaVirtualMachines/Home/bin/java -Djava.util.logging.config.file=/Users/test/sazhuo/apache-tomcat-9.0.0.M6/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -classpath /Users/test/sazhuo/apache-tomcat-9.0.0.M6/bin/bootstrap.jar:/Users/test/sazhuo/apache-tomcat-9.0.0.M6/bin/tomcat-juli.jar -Dcatalina.base=/Users/test/sazhuo/apache-tomcat-9.0.0.M6 -Dcatalina.home=/Users/test/sazhuo/apache-tomcat-9.0.0.M6 -Djava.io.tmpdir=/Users/test/sazhuo/apache-tomcat-9.0.0.M6/temp org.apache.catalina.startup.Bootstrap start
ZXIAOYU-M-338S:bin test$ kill 5748
-bash: kill: (5748) - Operation not permitted
ZXIAOYU-M-338S:bin test$ sudo kill 5748
Password:
ZXIAOYU-M-338S:bin test$ cd ..
ZXIAOYU-M-338S:apache-tomcat-9.0.0.M6 test$ ls webapps/
ROOT docs examples host-manager manager websocketServer websocketServer.war
ZXIAOYU-M-338S:apache-tomcat-9.0.0.M6 test$ bin/startup.sh //启动tomcat
Using CATALINA_BASE: /Users/test/sazhuo/apache-tomcat-9.0.0.M6
Using CATALINA_HOME: /Users/test/sazhuo/apache-tomcat-9.0.0.M6
Using CATALINA_TMPDIR: /Users/test/sazhuo/apache-tomcat-9.0.0.M6/temp
Using JRE_HOME: /Library/Java/JavaVirtualMachines/Home
Using CLASSPATH: /Users/test/sazhuo/apache-tomcat-9.0.0.M6/bin/bootstrap.jar:/Users/test/sazhuo/apache-tomcat-9.0.0.M6/bin/tomcat-juli.jar
touch: /Users/test/sazhuo/apache-tomcat-9.0.0.M6/logs/catalina.out: Permission denied
/Users/test/sazhuo/apache-tomcat-9.0.0.M6/bin/catalina.sh: line 411: /Users/test/sazhuo/apache-tomcat-9.0.0.M6/logs/catalina.out: Permission denied
ZXIAOYU-M-338S:apache-tomcat-9.0.0.M6 test$ sudo chmod 755 /Users/test/sazhuo/apache-tomcat-9.0.0.M6/logs/catalina.out
ZXIAOYU-M-338S:apache-tomcat-9.0.0.M6 test$ bin/startup.sh
Using CATALINA_BASE: /Users/test/sazhuo/apache-tomcat-9.0.0.M6
Using CATALINA_HOME: /Users/test/sazhuo/apache-tomcat-9.0.0.M6
Using CATALINA_TMPDIR: /Users/test/sazhuo/apache-tomcat-9.0.0.M6/temp
Using JRE_HOME: /Library/Java/JavaVirtualMachines/Home
Using CLASSPATH: /Users/test/sazhuo/apache-tomcat-9.0.0.M6/bin/bootstrap.jar:/Users/test/sazhuo/apache-tomcat-9.0.0.M6/bin/tomcat-juli.jar
touch: /Users/test/sazhuo/apache-tomcat-9.0.0.M6/logs/catalina.out: Permission denied
/Users/test/sazhuo/apache-tomcat-9.0.0.M6/bin/catalina.sh: line 411: /Users/test/sazhuo/apache-tomcat-9.0.0.M6/logs/catalina.out: Permission denied
ZXIAOYU-M-338S:apache-tomcat-9.0.0.M6 test$ sudo chmod 777 /Users/test/sazhuo/apache-tomcat-9.0.0.M6/logs/catalina.out
ZXIAOYU-M-338S:apache-tomcat-9.0.0.M6 test$ bin/startup.sh
Using CATALINA_BASE: /Users/test/sazhuo/apache-tomcat-9.0.0.M6
Using CATALINA_HOME: /Users/test/sazhuo/apache-tomcat-9.0.0.M6
Using CATALINA_TMPDIR: /Users/test/sazhuo/apache-tomcat-9.0.0.M6/temp
Using JRE_HOME: /Library/Java/JavaVirtualMachines/Home
Using CLASSPATH: /Users/test/sazhuo/apache-tomcat-9.0.0.M6/bin/bootstrap.jar:/Users/test/sazhuo/apache-tomcat-9.0.0.M6/bin/tomcat-juli.jar
Tomcat started.
ZXIAOYU-M-338S:apache-tomcat-9.0.0.M6 test$ cd conf/
ZXIAOYU-M-338S:conf test$ ls
Catalina catalina.properties jaspic-providers.xml logging.properties tomcat-users.xml web.xml
catalina.policy context.xml jaspic-providers.xsd server.xml tomcat-users.xsd
ZXIAOYU-M-338S:conf test$ vi logging.properties
ZXIAOYU-M-338S:conf test$
部署上去了,还是跑不起来。 宝宝不嗨森。。。。。
20-May-2016 16:28:00.862 SEVERE [http-nio-8080-exec-10] org.apache.catalina.core.StandardHostValve.invoke Exception Processing /websocketServer/wsServlet
java.lang.NoClassDefFoundError: org/apache/catalina/websocket/WebSocketServlet
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2501)
at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:827)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1268)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1133)
at org.apache.catalina.core.StandardWrapper.servletSecurityAnnotationScan(StandardWrapper.java:1139)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:510)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:1102)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:788)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1485)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.apache.catalina.websocket.WebSocketServlet
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1299)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1133)
... 22 more
到了最后还是没调通。。。。在我换了Tomcat7之后也不行。。。。
先下班了, 回去再整