7、java web部署,pom文件配置

2017-08-10  本文已影响0人  ltjxwxz

1、几个错误:
(1)tomcat启动报错,can not load amd64
jdk用了32位和tomcat用了64位,版本不匹配

(2)linux上有多个jdk,多个tomcat,要为自己的tomcat指定jdk版本
tomat路径/bin/catalina.out, 在第一行添加:

export JAVA_HOME=/usr/java8

(3)jstl scope配置错误,设置成了provided,导致WEB-INF/lib包中没有 jstl-1.2.jar包
[java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.classes.views.index_jsp]
参考链接:http://www.cnblogs.com/bruceChan0018/p/5851828.html
正确配置如下:

        <dependency>
            <groupId>jstl</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
            <scope>provided</scope>
        </dependency>

2、知识点总结
(1)测试环境是aix6.1,unix下 tar.gz 解压命令跟linux下不同
linux解压tar.gz为:tar -zvxf file.tar.gz
unix 命令

压缩  # tar cvf - folder | gzip > filename.tar.gz
解压  # gunzip -c filename.tar.gz | tar -xvf -

(2)关闭端口

#netstat -Aan|grep 23
f1000200019ce398 tcp 0 0 *.23 *.* LISTEN
#rmsock f1000200019ce398 tcpcb
The socket 0x19ce008 is being held by proccess 185006 (inetd).
#kill -9 185006

(3)java web项目 把文件放到于根目录平行的以用户名命名的文件夹下
不能把文件放在项目的resource目录下,因为项目重新

// 项目根路径
String path = session.getServletContext().getRealPath("/");
File pathFile = new File(path + "../" + user.getRealname());
pathFile.mkdir();
logger.info("创建一个以用户名为真实名字的文件夹, pathFile:" + pathFile.getPath());
File saveFile = new File(pathFile + "/" + fileNameAll);
inputStream = (ByteArrayInputStream) multiReq.getFile("file").getInputStream();
outputStream = new FileOutputStream(saveFile);
........
上一篇下一篇

猜你喜欢

热点阅读