1
Liunx部署J2EE项目 ---问题 概述
近期有一个自己写的项目需要发布到阿里云服务器,因而将其打包为war发布到阿里云上,但是在部署的过程中产生了很费解的问题。
查看 linux上 tomcat的日志输出查看错误代码:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75org.springframework.web.context.ContextLoader.initWebApplicationContext Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/config/DaoContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.util.ArrayList] to required type [java.lang.Class[]] for property 'annotatedClasses'; nested exception is java.lang.IllegalArgumentException: Error loading class [org.common.RBAC.domain.Account]: problem with class file or dependent class. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:753) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4745) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:952) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1823) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.util.ArrayList] to required type [java.lang.Class[]] for property 'annotatedClasses'; nested exception is java.lang.IllegalArgumentException: Error loading class [org.common.RBAC.domain.Account]: problem with class file or dependent class. at org.springframework.beans.AbstractNestablePropertyAccessor.convertIfNecessary(AbstractNestablePropertyAccessor.java:596) at org.springframework.beans.AbstractNestablePropertyAccessor.convertForProperty(AbstractNestablePropertyAccessor.java:603) at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:204) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1527) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1486) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1226) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543) ... 24 more Caused by: java.lang.IllegalArgumentException: Error loading class [org.common.RBAC.domain.Account]: problem with class file or dependent class. at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:290) at org.springframework.beans.propertyeditors.ClassEditor.setAsText(ClassEditor.java:63) at org.springframework.beans.TypeConverterDelegate.doConvertTextValue(TypeConverterDelegate.java:464) at org.springframework.beans.TypeConverterDelegate.doConvertValue(TypeConverterDelegate.java:437) at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:195) at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:143) at org.springframework.beans.TypeConverterDelegate.convertToTypedArray(TypeConverterDelegate.java:475) at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:212) at org.springframework.beans.AbstractNestablePropertyAccessor.convertIfNecessary(AbstractNestablePropertyAccessor.java:576) ... 30 more Caused by: java.lang.UnsupportedClassVersionError: org/common/RBAC/domain/Account : Unsupported major.minor version 52.0 (unable to load class [org.common.RBAC.domain.Account]) at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2280) at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:811) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1254) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119) at org.springframework.util.ClassUtils.forName(ClassUtils.java:250) at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:284) ... 38 more 01-Jun-2017 15:45:32.014 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file 01-Jun-2017 15:48:39.130 INFO [localhost-startStop-1] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [187,115] milliseconds. 01-Jun-2017 15:48:39.131 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Context [/dftsms-web] startup failed due to previous errors 01-Jun-2017 15:48:39.146 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/home/liushengliang/tomcat/tomcat/webapps/dftsms-web.war] has finished in [194,966] ms 01-Jun-2017 15:48:39.147 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/home/liushengliang/tomcat/tomcat/webapps/docs] 01-Jun-2017 15:48:39.198 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/home/liushengliang/tomcat/tomcat/webapps/docs] has finished in [50] ms 01-Jun-2017 15:48:39.198 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/home/liushengliang/tomcat/tomcat/webapps/test] 01-Jun-2017 15:48:39.250 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/home/liushengliang/tomcat/tomcat/webapps/test] has finished in [51] ms 01-Jun-2017 15:48:39.253 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/home/liushengliang/tomcat/tomcat/webapps/examples] 01-Jun-2017 15:48:39.537 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/home/liushengliang/tomcat/tomcat/webapps/examples] has finished in [284] ms 01-Jun-2017 15:48:39.538 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/home/liushengliang/tomcat/tomcat/webapps/manager] 01-Jun-2017 15:48:39.603 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/home/liushengliang/tomcat/tomcat/webapps/manager] has finished in [65] ms 01-Jun-2017 15:48:39.603 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/home/liushengliang/tomcat/tomcat/webapps/ROOT] 01-Jun-2017 15:48:39.647 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/home/liushengliang/tomcat/tomcat/webapps/ROOT] has finished in [44] ms 01-Jun-2017 15:48:39.649 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/home/liushengliang/tomcat/tomcat/webapps/host-manager] 01-Jun-2017 15:48:39.698 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/home/liushengliang/tomcat/tomcat/webapps/host-manager] has finished in [49] ms 01-Jun-2017 15:48:39.704 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"] 01-Jun-2017 15:48:39.725 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"] 01-Jun-2017 15:48:39.728 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 195694 ms
分析:
1Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/config/DaoContext.xml]:
1Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException:
1Failed to convert property value of type [java.util.ArrayList] to required type [java.lang.Class[]] for property 'annotatedClasses';
1nested exception is java.lang.IllegalArgumentException: Error loading class [org.common.RBAC.domain.Account]:
1problem with class file or dependent class.
1
大体意思是说:springframework 无法把 ArrayList 转换为所需要的class[]数组的形式,annotationClasses是我的Hibernate配置的实体类。如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15<property name="annotatedClasses"> <list> <!-- common模块中的持久化类 --> <value>org.common.RBAC.domain.Account</value> <value>org.common.RBAC.domain.Role</value> <value>org.common.RBAC.domain.Power</value> <value>org.common.RBAC.domain.Pictures</value> <value>org.common.FDBK.domain.Store</value> <value>org.common.FDBK.domain.Address</value> <value>org.common.FDBK.domain.Province_addr</value> <value>org.common.FDBK.domain.City_addr</value> <value>org.common.FDBK.domain.Areacounty_addr</value> <value>org.common.FDBK.domain.Goods</value> </list> </property>
就是说上面这个list无法转换。
解决方法:在google上搜索发现解决办法:
点击打开链接 https://stackoverflow.com/questions/26367159/initialization-of-bean-failed-nested-exception-is-org-springframework-beans
说是要把
1<property name="annotatedClasses"> 改为 packagesToScan ,h试试呗。
1改完之后,这个问题是解决了,但是又有问题:
1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74org.springframework.web.context.ContextLoader.initWebApplicationContext Context initialization failed org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.common.RBAC.dao.impl.AccountDaoImpl] for bean with name 'accountDao' defined in ServletContext resource [/WEB-INF/config/CommonsBeans.xml]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: org/common/RBAC/dao/impl/AccountDaoImpl : Unsupported major.minor version 52.0 (unable to load class [org.common.RBAC.dao.impl.AccountDaoImpl]) at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1355) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:628) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:597) at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1445) at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:975) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:752) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4745) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:952) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1823) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.UnsupportedClassVersionError: org/common/RBAC/dao/impl/AccountDaoImpl : Unsupported major.minor version 52.0 (unable to load class [org.common.RBAC.dao.impl.AccountDaoImpl]) at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2280) at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:811) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1254) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119) at org.springframework.util.ClassUtils.forName(ClassUtils.java:250) at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:394) at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1397) at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1344) ... 23 more 02-Jun-2017 15:46:48.342 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file 02-Jun-2017 15:49:46.633 INFO [localhost-startStop-1] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [178,290] milliseconds. 02-Jun-2017 15:49:46.633 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Context [/dftsms-web] startup failed due to previous errors 02-Jun-2017 15:49:46.643 WARNING [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [dftsms-web] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. 02-Jun-2017 15:49:46.644 WARNING [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [dftsms-web] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.lang.Object.wait(Native Method) java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:135) com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:64) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) java.lang.Thread.run(Thread.java:745) 02-Jun-2017 15:49:46.650 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/home/liushengliang/tomcat/tomcat/webapps/dftsms-web.war] has finished in [187,494] ms 02-Jun-2017 15:49:46.653 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/home/liushengliang/tomcat/tomcat/webapps/docs] 02-Jun-2017 15:49:46.785 INFO [20] org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading Illegal access: this web application instance has been stopped already. Could not load []. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access. java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load []. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access. at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1305) at org.apache.catalina.loader.WebappClassLoaderBase.getResource(WebappClassLoaderBase.java:986) at com.mysql.jdbc.AbandonedConnectionCleanupThread.checkContextClassLoaders(AbandonedConnectionCleanupThread.java:90) at com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:63) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) 02-Jun-2017 15:49:46.787 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/home/liushengliang/tomcat/tomcat/webapps/docs] has finished in [134] ms 02-Jun-2017 15:49:46.787 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/home/liushengliang/tomcat/tomcat/webapps/test] 02-Jun-2017 15:49:46.827 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/home/liushengliang/tomcat/tomcat/webapps/test] has finished in [40] ms 02-Jun-2017 15:49:46.833 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/home/liushengliang/tomcat/tomcat/webapps/examples] 02-Jun-2017 15:49:47.025 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/home/liushengliang/tomcat/tomcat/webapps/examples] has finished in [192] ms 02-Jun-2017 15:49:47.025 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/home/liushengliang/tomcat/tomcat/webapps/manager] 02-Jun-2017 15:49:47.060 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/home/liushengliang/tomcat/tomcat/webapps/manager] has finished in [35] ms 02-Jun-2017 15:49:47.065 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/home/liushengliang/tomcat/tomcat/webapps/ROOT] 02-Jun-2017 15:49:47.101 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/home/liushengliang/tomcat/tomcat/webapps/ROOT] has finished in [36] ms 02-Jun-2017 15:49:47.105 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/home/liushengliang/tomcat/tomcat/webapps/host-manager] 02-Jun-2017 15:49:47.141 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/home/liushengliang/tomcat/tomcat/webapps/host-manager] has finished in [36] ms 02-Jun-2017 15:49:47.159 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"] 02-Jun-2017 15:49:47.173 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"] 02-Jun-2017 15:49:47.176 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 188166 ms
解决办法:
上面两个问题都有cause by : 原因都指向java 版本问题 ,意思是说: 高版本jdk编译的项目运行在了低版本环境上,因而
出现错误。
一、错误现象:
当改变了jdk版本时,在编译java时,会遇到Unsupported major.minor version错误。
错误信息如下 :
Unsupported major.minor version 50.0
Unsupported major.minor version 49.0 (我在jdk1.4 和1.5切换时就遇到了这个错误)
Unsupported major.minor version 48.0
二、错误原因:
类似错误均属于Java版本问题,即JDK版本过低,只要选择相对应的JDK版本编译即可。
48,49,50是Java编译器内部的版本号:
Unsupported major.minor version 50.0 对应于 JDK1.6(JRE1.6)
Unsupported major.minor version 49.0 对应于 JDK1.5(JRE1.5)
Unsupported major.minor version 48.0 对应于 JDK1.4(JRE1.4)
查看阿里云服务器java version:
分析: java 版本没有问题 ,都是jdk1. 8 , 但是为什么报错。
之后:把项目再次部署到服务器,查看启动日志: 再次搜索错误原因,由下面的问题得到灵感:
分析: 想到,问题原因是 高版本编译的项目使用了低版本的jdk来编译,但是linux 的 jdk
java 环境 确实是jdk 1.8 。由上面的问题可以看出,在项目部署到Tomcat后,tomcat默认的jre
或许并不是 jdk 1.8,因为我的 linux服务器安装了两个jdk。因而查看之,
果然:linux自带jdk1.8,但是我的tomcat所使用的jre是自己安装的jdk1.7。
我的tomcat的jre编译环境是 /home/liushenliang/java/jdk,查看后发现:
该jre环境是jdk1.7,问题找到:
解决方法:
修改tomcat 的文件 setclasspath.sh 为:
修改tomcat 编译环境为jdk1.8完成,重新部署,成功。
最后
以上就是感性戒指最近收集整理的关于Linux部署J2EE---问题的全部内容,更多相关Linux部署J2EE---问题内容请搜索靠谱客的其他文章。
发表评论 取消回复