关于Eclipse+Maven+JavaServerFaces->ClassNotFoundException:StartupServletContextListener的问题就给大家分享到这里,感谢
关于Eclipse + Maven + JavaServer Faces-> ClassNotFoundException:StartupServletContextListener的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于ContextLoaderListener ClassNotFoundException、eclipse tomcat 运行报错 ClassNotFoundException ContextLoaderListener、Eclipse报错:java.lang.ClassNotFoundException: ContextLoaderListener、Eclipse报错:java.lang.ClassNotFoundException: ContextLoaderListener(转载的)等相关知识的信息别忘了在本站进行查找喔。
本文目录一览:- Eclipse + Maven + JavaServer Faces-> ClassNotFoundException:StartupServletContextListener
- ContextLoaderListener ClassNotFoundException
- eclipse tomcat 运行报错 ClassNotFoundException ContextLoaderListener
- Eclipse报错:java.lang.ClassNotFoundException: ContextLoaderListener
- Eclipse报错:java.lang.ClassNotFoundException: ContextLoaderListener(转载的)
Eclipse + Maven + JavaServer Faces-> ClassNotFoundException:StartupServletContextListener
摘要
当我尝试从Eclipse内(在Tomcat 7.0上)运行JSF 2.0应用程序时,出现以下异常:
Problem: SEVERE: Error configuring application listener of class org.apache.myfaces.webapp.StartupServletContextListenerjava.lang.ClassNotFoundException: org.apache.myfaces.webapp.StartupServletContextListener
细节
我正在学习使用Eclipse开发JSF应用程序。我从一个预先配置的Eclipse项目开始:File-> New-> Dynamic Web
Project-> JavaServer Face v2.0
Project。使用此方法,Eclipse提供了所有依赖项。但我想真正地了解一切。我想删除“魔术”,所以我将项目转换为Maven项目:配置->转换为Maven项目。
然后,我创建了pom.xml(基于http://myfaces.apache.org/build-tools/archetypes/myfaces-
archetype-helloworld20/index.html),其中包含以下内容:
<build> <finalName>jsf-facelets-tutorial</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <configuration> <webXml>WebContent/WEB-INF/web.xml</webXml> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins></build><dependencies> <dependency> <groupId>javax.el</groupId> <artifactId>el-api</artifactId> <version>1.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.0</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.myfaces.core</groupId> <artifactId>myfaces-api</artifactId> <version>2.0.5</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.apache.myfaces.core</groupId> <artifactId>myfaces-impl</artifactId> <version>2.0.5</version> <scope>runtime</scope> </dependency></dependencies>
但是因为我不熟悉JSF,并且因为这是Eclipse“动态Web项目”,所以项目结构对我来说是新的,而且我很难理解哪些依赖项来自Maven,哪些依赖项是由Eclipse提供的。
”。
在Eclipse中,我的项目结构如下:
ProjectName JAX-WS Web Services <-- CAN I REMOVE THIS??? Deployment Descriptor Java Resources src/main Libraries Apache Tomcat v7.0 el-api.jar jsp-api.jar [more...] JSF 2.0 (Apache MyFaces JSF Core-2.0 API 2.0.2) <-- I REMOVED THIS!!! EAR Libraries JRE System Library Maven Dependencies el-api-1.0.jar myfaces-api-2.0.5.jar myfaces-impl-2.0.5.jar [more...] Web App Libraries
问题 我的(非常基本的)应用程序(登录页面和欢迎页面)不再运行。当我执行以下操作时:
(1) Right click on WebContent/login.xhtml(2) Run as -> Run on Server(3) Apache Tomcat v7.0 - JDK6 at localhost
我得到例外:
Problem: SEVERE: Error configuring application listener of class org.apache.myfaces.webapp.StartupServletContextListenerjava.lang.ClassNotFoundException: org.apache.myfaces.webapp.StartupServletContextListener
我觉得这很容易解决,但是我对这些框架不熟悉,无法解决。
如果我需要提供其他详细信息(web.xml,faces-config-xml,login.xhtml),请告诉我,我将添加它们。
谢谢!
编辑
WEB-INF /
lib始终为空。据我了解,有必要将所有依赖项复制到此文件夹中,这在运行时是必需的,而Web容器未提供。我的人为空的原因是:(1)我不知道我在那里需要什么(2)我不知道如何自动化将.jar文件放入那里的过程
答案1
小编典典在蚀项目属性下,从导航菜单中选择“部署程序集”,该菜单定义了“此Java EE Web应用程序项目的打包结构”。确保在此处添加了所有项目依赖项。
或者查看工作区/.metadata/.plugins/org.eclipse.wst.server.core\tmp0下的Web服务器目录,以检查罐子是否已复制到catalina基座。
ContextLoaderListener ClassNotFoundException
在初学使用maven构建javaWeb的项目的时候,启动tomcat加载时,总是提示如下错误,辛苦一番终于找到解决办法。严重: Error configuring application listener of class org.springframework.web.context.ContextLoaderListenerJava.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
根本原因:jar文件没有同步发布到自己项目的lib目录中
解决办法:项目点击右键 点击 Properties 选择Deployment Assembly
再点击右边的Add按钮 选择Java Build Path Entries后点击Next按钮 然后选择你的Maven Dependencies 确定即可
servlet-api.jar不同,使用的tomcat版本也不同,总结如下:
tomcat7.x ,tomcat8.X支持servlet-api-3.jar
tomcat6.x ,tomcat5.X支持servlet-api-2.5.jar
如果你的项目中用的是servlet-api-2.5.jar, 而你的tomcat用的是7或者8,也会出现上述的异常!这也是笔者耗费了一天的时间总结出来的,希望能帮到遇到相同问题的Java开发者
eclipse tomcat 运行报错 ClassNotFoundException ContextLoaderListener
eclipse server tomcat报错误:
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
原因
Deployment Assembly中没有Maven Dependencies
解决办法
properties -> Deployment Assembly - > add -> maven dedependencies ->
Eclipse报错:java.lang.ClassNotFoundException: ContextLoaderListener
转自:http://chenzhou123520.iteye.com/blog/1836987
Eclipse中tomcat部署工程启动后报错:
严重: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
问题背景:
工程为maven工程,ContextLoaderListener类位于spring-web-3.1.0.RELEASE.jar包中。检查了 maven的pom.xml,依赖引入正常。在工程Maven Dependencies视图中也能看到spring-web-3.1.0.RELEASE.jar包被正常引入进来了。
错误原因:
进入到tomcat的部署路径.metadata\.plugins\org.eclipse.wst.server.core\tmp0 \wtpwebapps\下检查了一下,发现工程部署后在WEB-INF文件夹下没有生成lib目录,正常情况下,会生成lib目录并把工程的所有依赖 jar包都部署到该目录下。
解决方案:
1.右键点击项目--选择Properties
选择Deployment Assembly,在右边点击Add按钮,在弹出的窗口中选择Java Build Path Entries。如下图所示:
2.点击Next,选择Maven Dependencies
3.点击Finish,然后可以看到已经把Maven Dependencies添加到Web应用结构中了
操作完后,重新部署工程,不再报错了。然后我们再到.metadata\.plugins \org.eclipse.wst.server.core\tmp0\wtpwebapps\目录下,发现工程WEB-INF目录下自动生成了lib目录,并且所有的依赖jar包也都已经部署进来。问题因此解决。
Eclipse报错:java.lang.ClassNotFoundException: ContextLoaderListener(转载的)
Eclipse中tomcat部署工程启动后报错:Shell代码 收藏代码
严重: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:415)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:397)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4660)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
问题背景:
工程为maven工程,ContextLoaderListener类位于spring-web-3.1.0.RELEASE.jar包中。检查了maven的pom.xml,依赖引入正常。在工程Maven Dependencies视图中也能看到spring-web-3.1.0.RELEASE.jar包被正常引入进来了。
错误原因:
进入到tomcat的部署路径.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\下检查了一下,发现工程部署后在WEB-INF文件夹下没有生成lib目录,正常情况下,会生成lib目录并把工程的所有依赖jar包都部署到该目录下。
解决方案:
1.右键点击项目--选择Properties
选择Deployment Assembly,在右边点击Add按钮,在弹出的窗口中选择Java Build Path Entries。如下图所示:
2.点击Next,选择Maven Dependencies
3.点击Finish,然后可以看到已经把Maven Dependencies添加到Web应用结构中了
操作完后,重新部署工程,不再报错了。然后我们再到.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\目录下,发现工程WEB-INF目录下自动生成了lib目录,并且所有的依赖jar包也都已经部署进来。问题因此解决。
关于Eclipse + Maven + JavaServer Faces-> ClassNotFoundException:StartupServletContextListener的问题我们已经讲解完毕,感谢您的阅读,如果还想了解更多关于ContextLoaderListener ClassNotFoundException、eclipse tomcat 运行报错 ClassNotFoundException ContextLoaderListener、Eclipse报错:java.lang.ClassNotFoundException: ContextLoaderListener、Eclipse报错:java.lang.ClassNotFoundException: ContextLoaderListener(转载的)等相关内容,可以在本站寻找。
本文标签: