SSM部署坑

  1. 项目所需JDK版本和tomcat的jdk版本不兼容,比如项目需要用JDK8但是tomcat版本为7

常见错误如Exception in thread “main” java.lang.UnsupportedClassVersionError: org/apache/catalina/startup/Bootstrap : Unsupported major.minor version 52.0

  1. 文件上传到服务器之后权限可能会被修改由此导致css,js等文件无法显示,此时上服务器更改文件权限即可
  2. web项目传到服务器的时候记得先建数据库
  3. 关闭tomcat的时候遇到这个错误

Using CATALINA_BASE: /home/ubuntu/apache-tomcat-9.0.0.M15

Using CATALINA_HOME: /home/ubuntu/apache-tomcat-9.0.0.M15

Using CATALINA_TMPDIR: /home/ubuntu/apache-tomcat-9.0.0.M15/temp

Using JRE_HOME: /home/ubuntu/jdk1.8.0_111/jre

Using CLASSPATH: /home/ubuntu/apache-tomcat-9.0.0.M15/bin/bootstrap.jar:/home/ubuntu/apache-tomcat-9.0.0.M15/bin/tomcat-juli.jar

Dec 24, 2016 2:08:37 PM org.apache.catalina.startup.Catalina stopServer

SEVERE: Could not contact localhost:8005. Tomcat may not be running.

Dec 24, 2016 2:08:37 PM org.apache.catalina.startup.Catalina stopServer

SEVERE: Catalina.stop:

java.net.ConnectException: Connection refused (Connection refused)

at java.net.PlainSocketImpl.socketConnect(Native Method)

at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)

at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)

at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

at java.net.Socket.connect(Socket.java:589)

at java.net.Socket.connect(Socket.java:538)

at java.net.Socket.(Socket.java:434)

at java.net.Socket.(Socket.java:211)

at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:476)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:408)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:497)

解决方案

(1)ps -ef | grep java 杀死java进程

(2)ps -ef | grep 8005 kill -9 pid杀死8005相关进程

(3)如果(1)(2)还行不通,直接把服务器的tomcat全删了,重新下载部署tomcat

  1. 如果遇到css,js解析不出来,可能是css和js的路径不对(通常是a标签的href属性错误)
  2. java web有三种部署方式部署到tomcat 第一种可以直接把项目(.war文件)放入webapps文件夹(可能需要修改conf文件夹下的server.xml配置文件改成autoDeploy=”true”)第二种就是在server.xml的标签中增加第三种就是在conf/Catalina/localhost文件夹下新建文件***.xml在这些文件里头加上
月月说要给我打赏,就还是放了二维码,😝