myeclipse下Maven配置SSM框架出现的问题总结

来源:互联网 发布:centos安装cacti 编辑:程序博客网 时间:2024/05/02 04:22


1.严重: Resource read error: Could not load net/sf/jsqlparser/expression/operators/relational/ItemsListVisitor.class.
java.util.zip.ZipException: invalid LOC header (bad signature)

<span style="font-size:18px;">Resource read error: Could not load net/sf/jsqlparser/expression/operators/relational/ItemsListVisitor.class.java.util.zip.ZipException: invalid LOC header (bad signature)</span>


解决方案:找到Maven仓库如本机的是C:/Users/Administrator/.m2/repository/然后在里面找到对应失败的jar包的目录,将整个目录删除,
然后回到MyEclipse或者Eclipse中选中Maven4MyEclipse,然后Update Project,选中 Force Update Of .... 然后确定。

2.严重: Error configuring application listener of class com.sun.faces.config.ConfigureListener
java.lang.ClassNotFoundException: com.sun.faces.config.ConfigureListener
<span style="font-size:18px;">严重: Error configuring application listener of class com.sun.faces.config.ConfigureListenerjava.lang.ClassNotFoundException: com.sun.faces.config.ConfigureListener016-8-30 22:25:19 org.apache.catalina.core.StandardContext listenerStart严重: Skipped installing application listeners due to previous error(s)2016-8-30 22:25:19 org.apache.catalina.core.StandardContext startInternal严重: One or more listeners failed to start. Full details will be found in the appropriate container log file2016-8-30 22:25:19 org.apache.catalina.core.StandardContext startInternal严重: Context [/CookingShow] startup failed due to previous errors2016-8-30 22:25:19 org.apache.catalina.startup.HostConfig deployDirectory信息: Deployment of web application directory D:\tomcat\apache-tomcat-7.0.65\webapps\CookingShow has finished in 3,106 ms</span>



网上搜也是搜不到直接的解决办法,后来从别人的提示中发现问题可能有两种原因,

一个是缺少jsf.jar包,二是存在jar包冲突,第一种解决方法是在pom文件中配置

<span style="font-size:18px;"><dependency>              <groupId>com.sun.faces</groupId>              <artifactId>jsf-api</artifactId>              <version>2.0.2-b10</version>          </dependency>          <dependency>              <groupId>com.sun.faces</groupId>              <artifactId>jsf-impl</artifactId>              <version>2.0.2-b10</version>          </dependency> </span>

第二种了,关于冲突jar包后来发现自己在lib下放入了j2ee的jar包,这个里面本身已经包含了container实现类了和tomcat7的提供jar包存在冲突,这个去掉就ok,然后就不回报上述错误了。


3.java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:157)

最终解决方法:更换spring版本


bug详情:


这几天一直在被这个bug虐。所有的配置文件我和类文件都检查了N遍了都没问题。可就是开启包扫描后就报bug,关掉报扫描就没bug了。


部分错误:

<span style="font-size:18px;">17:02:37,149 ERROR TestContextManager:315 - Caught exception while allowing TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener@7692d9cc]  to prepare test instance [com.uujava.mbfy.test.TestMybatis@75f32542]java.lang.IllegalStateException: Failed to load ApplicationContextat org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:157)</span>



经过排查最终将3.2.0.RELEASE更换为3.2.4.RELEASE问题解决。


4.Missing artifact junit:junit:jar:4.0.1
这样的问题是明明你pom.xml文件中有
<span style="font-size:18px;"><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.0.1</version></dependency></span>



=-----因为也许没有这个版本的包,还有要是用Junit4,要保证你的Junit包是4以上,,我的是4.8.1


5.Java文件出现:The attribute value is undefined for the annotation type RunWith

<span style="font-size:18px;">The attribute value is undefined for the annotation type RunWith</span>

-----》是因为你import的文件不对,改成import org.junit.runner.RunWith;就可以了,注意参数要配置正确


6.严重: Resource read error: Could not load net/sf/jsqlparser/expression/operators/relational/ItemsListVisitor.class.
java.util.zip.ZipException: invalid LOC header (bad signature
<span style="font-size:18px;">2016-8-31 9:59:16 org.apache.catalina.loader.WebappClassLoaderBase findResourceInternal严重: Resource read error: Could not load net/sf/jsqlparser/expression/operators/relational/ItemsListVisitor.class.java.util.zip.ZipException: invalid LOC header (bad signature</span>


解决办法--》
<span style="font-size:18px;"><!-- https://mvnrepository.com/artifact/net.sf.jsqlparser/jsqlparser --><dependency>    <groupId>net.sf.jsqlparser</groupId>    <artifactId>jsqlparser</artifactId>    <version>0.8.0</version></dependency></span>


 7.Project configuration is not up-to-date with pom.xml. Run project configuration updateCookingShow Maven Webappline 1Maven Configuration Problem
 项目文件没有什么错,但是图标一直有一个!号,也运行不了
 日志中的错误信息是:
<span style="font-size:18px;"> DescriptionResourcePathLocationTypeProject configuration is not up-to-date with pom.xml. Run project configuration updateCookingShow Maven Webappline 1Maven Configuration Problem</span>


----》解决办法项目--》右键-》maven--》update configuration




啊啊啊,暂时就这么多了,终于搭好了....................

0 0
原创粉丝点击