tomcat 的java项目运行不起来.
我做前端的不会java,但现在要搭建本地测试环境
目前环境 java7(1.7?) tomcat7 win10 远程sqlserver2008
项目是ext5+java+sqlserver.
我把项目csapp丢到安装好的webapps下 访问localhost:8080/csapp 是404提示
具体报错是
信息: Deploying web application directory D:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\csapp
七月 12, 2017 11:43:15 上午 org.apache.catalina.startup.TldConfig execute
信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
11:43:15,183 INFO ContextLoader:285 - Root WebApplicationContext: initialization started
11:43:15,261 INFO XmlWebApplicationContext:513 - Refreshing Root WebApplicationContext: startup date [Wed Jul 12 11:43:15 CST 2017]; root of context hierarchy
11:43:15,293 INFO XmlBeanDefinitionReader:316 - Loading XML bean definitions from ServletContext resource [/WEB-INF/classes/applicationContext.xml]
11:43:15,589 INFO PropertyPlaceholderConfigurer:172 - Loading properties file from class path resource [application.properties]
11:43:15,636 ERROR ContextLoader:331 - Context initialization failed
org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [com.keepsoft.ywswpt.service.DbService] for bean with name 'dbService' defined in file [D:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\csapp\WEB-INF\classes\com\keepsoft\ywswpt\service\DbService.class]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: com/keepsoft/ywswpt/service/DbService : Unsupported major.minor version 52.0 (unable to load class com.keepsoft.ywswpt.service.DbService)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1328)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:594)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1394)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:957)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:683)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5118)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5634)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1296)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2038)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.UnsupportedClassVersionError: com/keepsoft/ywswpt/service/DbService : Unsupported major.minor version 52.0 (unable to load class com.keepsoft.ywswpt.service.DbService)
at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:3209)
at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:1373)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1861)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:247)
at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:395)
at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1346)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1317)
... 22 more
七月 12, 2017 11:43:15 上午 org.apache.catalina.core.StandardContext startInternal
严重: One or more listeners failed to start. Full details will be found in the appropriate container log file
七月 12, 2017 11:43:15 上午 org.apache.catalina.core.StandardContext startInternal
严重: Context [/csapp] startup failed due to previous errors
七月 12, 2017 11:43:15 上午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory D:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\csapp has finished in 3,404 ms
七月 12, 2017 11:43:15 上午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\docs
七月 12, 2017 11:43:15 上午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory D:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\docs has finished in 62 ms
七月 12, 2017 11:43:15 上午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\manager
七月 12, 2017 11:43:15 上午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory D:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\manager has finished in 63 ms
七月 12, 2017 11:43:15 上午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\ROOT
七月 12, 2017 11:43:15 上午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory D:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\ROOT has finished in 31 ms
七月 12, 2017 11:43:15 上午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-bio-8080"]
七月 12, 2017 11:43:15 上午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-bio-8009"]
七月 12, 2017 11:43:15 上午 org.apache.catalina.startup.Catalina start
信息: Server startup in 3605 ms
我问别人说是 数据库连接不上的原因.
但我本地用sqlserver客户端连接远程数据库是正常的,把本地防火墙也关闭了.
我不知道从何入手.
另外在tomcat中webapps里随便建个测试项目demo/index.html 是可以访问的.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
war包用JDK1.8编译的,环境用的JDK7,报错
安装一个JDK8,配置JAVA_HOME等相关环境变量指向新的JDK8,
或者修改tomcat的配置,一般是修改tomcat bin目录setclasspath或者catalina,建议百度一下具体操作
看看开发环境打包环境和运行环境的jdk是不是一个版本
Unsupported major.minor version 52.0
52.0说明你用的是jdk1.8来编译。
Java Compiler里改成1.7或者用1.8跑tomcat
Jdk版本错误,看看给你的包用什么版本的Jdk。尽量统一用1.8。。。