Maven中使用tomcat:run出现错误org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
2017-10-26 13:43
531 查看
Maven中使用tomcat:run出现错误org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
这几天在学习maven,跟着视频上学maven,看到人家直接tomcat:run就成功部署了项目,所以自己也尝试了一下,但是项目可以正常部署,但是访问的时候servlet访问正常。jsp访问出现编译错误。1.使用maven:tomcat发布项目成功。
2.servlet访问一切正常。jsp访问出现org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException的错误
3.查看编译路径下没有对应的.class文件
分析原因:
1.pom.xml文件是正常,编译不存在jar包冲突
2.配置是正常的。查阅资料以后说是jdk版本什么的问题。多方修改没有任何改观。
换一个思路去查询tomcat:run怎么运行。原来适合maven整合因此可以得知在pom文件中加入插件所以在pom.xml文件中加入如下配置
<build> <plugins> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration> <port>9999</port> <uriEncoding>UTF-8</uriEncoding> </configuration> </plugin> </plugins> </build>
这里的port可以自定义端口不在和其它8080端口冲突
这时当你再次使用tomcat:run的时候发现还是和刚才一样。是因为他还是沿用了上一次的tomcat插件(默认是6)所以运行的时候使用 tomcat7:run
这样配置生效,通过地址去访问
效果如下:
希望对你们能有帮助。
相关文章推荐
- maven整合struts: Compilation error org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
- Compilation error org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
- org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
- 严重: Compilation error org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
- org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
- 严重: Compilation error org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
- org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
- Compilation error org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
- org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
- org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException异常怎么解决?
- org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
- Maven使用tomcat7-maven-plugin插件run时出现错误: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component
- eclipse下tomcat运行maven出现ClassNotFoundException错误
- Eclipse运行Maven的SpringMVC项目Run on Server时出现错误:Error configuring application listener of class org.springframework.web.context.ContextLoaderListener的问题解决
- eclipse使用maven,启动工程tomcat报错:java.lang.ClassNotFoundException: org.springframework.web.context.Contex
- 错误:java.lang.NoSuchMethodError: org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()
- 真正解决问题:maven eclipse tomcat java.lang.ClassNotFoundException: org.springframework.web.context.Contex
- 出现 org.apache.tomcat.xxx.ClassFormatException: Invalid byte tag in constant pool: 15 异常的原因及解决方法
- 安装maven出现错误:Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/maven/cli/
- Tomcat中使用commons-io-2.5发生的错误java.lang.ClassNotFoundException: org.apache.commons.io.IOUtils