Cannot load servlet class: org.primefaces.resource.ResourceServlet

I am trying to build simple web app using primefaces 3.0.M2 version. I am using Mojarra JSF 2, Eclipse and Jboss 6 to deploy the application.

Whenever I try to deploy my application, JBoss log gives me following error :

20:56:24,661 INFO [TomcatDeployment] deploy, ctxPath=/admin-console 20:56:24,870 ERROR [MyfacesConfig] Both MyFaces and the RI are on your classpath. Please make sure to use only one of the two JSF-implementations. 20:56:25,348 WARN [LocaleUtils] Locale name in faces-config.xml null or empty, setting locale to default locale : en_IN 20:56:27,545 WARN [ASHelper] Cannot load servlet class: org.primefaces.resource.ResourceServlet java.lang.ClassNotFoundException: org.primefaces.resource.ResourceServlet from BaseClassLoader@74cbe891{VFSClassLoaderPolicy@7711c37e{name=vfszip:/C:/Shekhar/JEE_Softwares/jboss/server/default/deploy/HelloJSF.war/ domain=ClassLoaderDomain@515063db{name=vfszip:/C:/Shekhar/JEE_Softwares/jboss/server/default/deploy/HelloJSF.war/ parentPolicy=AFTER_BUT_JAVA_BEFORE parent=ClassLoaderDomain@4ec1a0eb{DefaultDomain}} roots=[MemoryContextHandler@792314436[path= context=vfsmemory://1de712r-dycdgc-grw68f5e-1-grw691pb-2c real=vfsmemory://1de712r-dycdgc-grw68f5e-1-grw691pb-2c], ZipEntryHandler@2030114452[path=HelloJSF.war/WEB-INF/classes context=file:/C:/Shekhar/JEE_Softwares/jboss/server/default/deploy/ real=file:/C:/Shekhar/JEE_Softwares/jboss/server/default/deploy/HelloJSF.war/WEB-INF/classes], DelegatingHandler@913411228[path=HelloJSF.war/WEB-INF/lib/jsf-api.jar context=file:/C:/Shekhar/JEE_Softwares/jboss/server/default/deploy/ real=file:/C:/Shekhar/JEE_Softwares/jboss/server/default/deploy/HelloJSF.war/WEB-INF/lib/jsf-api.jar], DelegatingHandler@1489400240[path=HelloJSF.war/WEB-INF/lib/jsf-impl.jar context=file:/C:/Shekhar/JEE_Softwares/jboss/server/default/deploy/ real=file:/C:/Shekhar/JEE_Softwares/jboss/server/default/deploy/HelloJSF.war/WEB-INF/lib/jsf-impl.jar], DelegatingHandler@1280444248[path=HelloJSF.war/WEB-INF/lib/jstl-api-1.2.jar context=file:/C:/Shekhar/JEE_Softwares/jboss/server/default/deploy/ real=file:/C:/Shekhar/JEE_Softwares/jboss/server/default/deploy/HelloJSF.war/WEB-INF/lib/jstl-api-1.2.jar], DelegatingHandler@492849549[path=HelloJSF.war/WEB-INF/lib/jstl-impl-1.2.jar context=file:/C:/Shekhar/JEE_Softwares/jboss/server/default/deploy/ real=file:/C:/Shekhar/JEE_Softwares/jboss/server/default/deploy/HelloJSF.war/WEB-INF/lib/jstl-impl-1.2.jar], DelegatingHandler@477943564[path=HelloJSF.war/WEB-INF/lib/primefaces-3.0.M2.jar context=file:/C:/Shekhar/JEE_Softwares/jboss/server/default/deploy/ real=file:/C:/Shekhar/JEE_Softwares/jboss/server/default/deploy/HelloJSF.war/WEB-INF/lib/primefaces-3.0.M2.jar]] delegates=null exported=[META-INF.resources.primefaces.idlemonitor, META-INF.resources.primefaces.rating, org.primefaces.component.password, META-INF.resources.primefaces.lightbox, org.primefaces.component.idlemonitor, META-INF.resources.primefaces.imagecropper, org.primefaces.component.tooltip, META-INF.resources.primefaces.resizable, org.primefaces.mobile.component.panelgrid, org.primefaces.event.data, org.primefaces.component.dock, com.sun.faces.application.annotation, META-INF.resources.primefaces.accordion, com.sun.faces.facelets.compiler, META-INF.resources.primefaces.galleria, META-INF.resources.primefaces.yui.paginator.assets, META-INF.resources.primefaces.toolbar, org.primefaces.component.selectmanymenu, META-INF.resources.primefaces.themes.sam.images, org.primefaces.application, org.primefaces.component.picklist, org.primefaces.model, com.sun.faces.el, META-INF.resources.primefaces.mousewheel, org.primefaces.component.graphicimage, org.apache.taglibs.standard.tag.rt.core, com.sun.faces.xhtml, org.primefaces.component.rowtoggler, META-INF.resources.primefaces.forms, META-INF.resources.primefaces.treetable.images, org.apache.taglibs.standard.tag.common.sql, org.primefaces.component.gmap, META-INF.resources.primefaces.dialog, com.sun.faces.config, META-INF.resources.primefaces.panel, org.apache.taglibs.standard.tag.common.fmt, META-INF.resources.primefaces.calendar, org.apache.taglibs.standard.lang.support, META-INF.resources.primefaces.progressbar, org.primefaces.model.filter, com.sun.faces.component.visit, META-INF.resources.primefaces.notificationbar, javax.faces.bean, com.sun.faces.ext.validator, org.primefaces.component.selectonelistbox, org.primefaces.component.datalist, javax.faces.component.behavior, META-INF.resources.primefaces.picklist, javax.faces.lifecycle, META-INF.resources.primefaces.gmap, META-INF.resources.primefaces.ring, org.primefaces.mobile.component.togglepanel, org.primefaces.component.growl, META-INF.resources.primefaces.treeview, org.primefaces.component.celleditor, com.sun.faces.metadata.taglib, org.primefaces.mobile.component.navbar, org.primefaces.component.colorpicker, org.primefaces.component.tagcloud, org.primefaces.component.filedownload, org.primefaces.component.spacer, org.primefaces.component.hotkey, META-INF.resources.primefaces.stack.assets, javax.faces.webapp, javax.faces.component.visit, javax.faces.convert, org.primefaces.mobile.component.commandbutton, org.apache.taglibs.standard.lang.jstl.parser, org.primefaces.event.map, org.primefaces.component.imageswitch, com.sun.faces.config.configprovider, com.sun.faces.facelets.tag.jstl.fn, org.primefaces.component.chart.pie, org.primefaces.component.inputtext, org.apache.taglibs.standard.resources, org.primefaces.component.captcha, org.apache.taglibs.standard.tag.el.sql, META-INF.resources.primefaces.colorpicker, META-INF.resources.primefaces.poll, META-INF.resources.primefaces.easing, org.primefaces.component.roweditor, META-INF.resources.primefaces.autocomplete, META-INF.resources.primefaces.growl.assets, META-INF.services, com.sun.faces.ext.render, org.primefaces.component.selectonemenu, org.primefaces.component.imagecompare, META-INF.resources.primefaces.datatable, org.primefaces.mobile.component.content, META-INF.resources.primefaces.password, META-INF.resources.primefaces.mobile.images, META-INF.resources.primefaces.ajaxstatus, org.primefaces.component.menu, org.primefaces.component.tabview, META-INF.resources.primefaces.jquery.ui, org.apache.taglibs.standard.functions, com.sun.faces.facelets.tag.ui, META-INF.resources.primefaces.scrollpanel, org.primefaces.mobile.component.view, META-INF.resources.primefaces.keyboard, javax.faces, META-INF.resources.primefaces.dashboard, META-INF.resources.primefaces.menu, org.primefaces.component.autocomplete, javax.faces.component, META-INF.resources.primefaces.dnd, org.primefaces.model.chart, javax.faces.el, org.primefaces.component.wizard, META-INF.resources.primefaces.lightbox.images, org.primefaces.webapp.filter, com.shekhar.jsf, META-INF.resources.primefaces.treetable, com.sun.faces.application, org.apache.taglibs.standard.tag.rt.xml, META-INF.resources.primefaces.fileupload, com.sun.faces.scripting.groovy, org.primefaces.component.inplace, META-INF.resources.primefaces.paginator, org.primefaces.mobile.component.slider, META-INF.resources.primefaces.button, org.primefaces.webapp, org.primefaces.component.spinner, org.primefaces.component.editor, org.primefaces.component.confirmdialog, javax.faces.component.html, META-INF.maven.org.primefaces.primefaces, org.primefaces.component.columns, com.sun.faces.taglib, org.primefaces.mobile.component.footer, org.primefaces.component.dialog, com.sun.faces.context, org.primefaces.component.ajaxstatus, org.apache.taglibs.standard.tag.el.fmt, com.sun.faces.component.validator, META-INF.resources.primefaces.tagcloud, META-INF.resources.primefaces.messages, org.primefaces.component.separator, com.sun.faces.application.view, META-INF.resources.primefaces.hotkey, META-INF.resources.primefaces.slider, org.primefaces.component.remotecommand, org.primefaces.component.button, META-INF.resources.primefaces.treeview.images, org.primefaces.component.messages, org.primefaces.json, org.primefaces.component.progressbar, com.sun.faces.renderkit, javax.faces.model, META-INF.resources.primefaces.mobile, org.primefaces.component.datatable, org.primefaces.component.watermark, org.apache.taglibs.standard.tag.el.xml, META-INF, org.primefaces.component.notificationbar, org.primefaces.component.focus, com.sun.faces.component, org.primefaces.component.dashboard, META-INF.maven.javax.servlet.jsp.jstl.jstl-api, META-INF.resources.primefaces.stack, com.sun.faces.facelets.el, org.primefaces.mobile.component.uiswitch, META-INF.maven.org.glassfish.web.jstl-impl, META-INF.resources.primefaces.growl, com.sun.faces.facelets.tag, org.primefaces.component.chart.bar, org.primefaces.component.scrollpanel, org.primefaces.component.ring, com.sun.faces.mgbean, org.apache.taglibs.standard, org.primefaces.component.stack, org.primefaces.component.inputmask, org.primefaces.component.effect, META-INF.resources.primefaces.log, META-INF.resources.primefaces.push, com.sun.faces, javax.faces.validator, javax.faces.application, META-INF.resources.primefaces.schedule, org.primefaces.component.keyboard, org.primefaces.mobile.component.listview, META-INF.resources.primefaces.printer, org.primefaces.component.layout, org.primefaces.component.media.player, org.apache.taglibs.standard.tag.common.core, org.primefaces.component.toolbar, META-INF.resources.primefaces.core, com.sun.faces.facelets, org.primefaces.component.media, com.sun.faces.lifecycle, META-INF.resources.primefaces.breadcrumb, META-INF.resources.primefaces.jquery, org.apache.taglibs.standard.tag.rt.sql, com.sun.faces.taglib.jsf_core, org.primefaces.mobile.component.buttongroup, org.primefaces.component.fileupload, org.primefaces.component.selectoneradio, org.primefaces.component.imagecropper, org.primefaces.component.contextmenu, META-INF.resources.primefaces.datalist, org.apache.taglibs.standard.tag.el.core, org.apache.taglibs.standard.lang.jstl.test, META-INF.resources.primefaces.fieldset, org.primefaces.comet, org.primefaces.component.slider, META-INF.resources.primefaces.editor, org.primefaces.component.calendar, META-INF.resources.primefaces.tabslider, org.apache.taglibs.standard.lang.jstl.test.beans, org.primefaces.component.treetable, META-INF.resources.javax.faces, META-INF.resources.primefaces.inplace, org.primefaces.component.log, com.sun.faces.facelets.tag.composite, META-INF.resources.primefaces.terminal, META-INF.resources.primefaces.yui.paginator, org.primefaces.component.printer, com.sun.faces.vendor, org.primefaces.component.message, META-INF.resources.primefaces.editor.images, org.primefaces.component.accordionpanel, org.primefaces.component.rating, org.primefaces.component.collector, org.primefaces.component.lightbox, com.sun.faces.taglib.html_basic, org.primefaces.model.tagcloud, org.primefaces.component.behavior.ajax, com.sun.faces.spi, com.sun.faces.ext.component, org.primefaces.mobile.component.header, META-INF.resources.primefaces.charts, META-INF.resources.primefaces.sheet, javax.faces.render, META-INF.resources.primefaces.layout, org.apache.taglibs.standard.tei, org.primefaces.component.datagrid, com.sun.faces.facelets.tag.jstl.core, META-INF.resources.primefaces.spinner, META-INF.resources.primefaces, javax.faces.event, org.primefaces.component.selectmanycheckbox, META-INF.resources.primefaces.imagecompare, org.primefaces.component.schedule, com.sun.faces.facelets.tag.jsf, com.sun.faces.renderkit.html_basic, META-INF.resources.primefaces.wizard, com.sun.faces.resources, com.sun.faces.context.flash, org.primefaces.component.api, org.apache.taglibs.standard.extra.spath, org.primefaces, org.primefaces.component.themeswitcher, org.apache.taglibs.standard.tlv, META-INF.resources.primefaces.themeswitcher, META-INF.resources.primefaces.themes.sam, com.sun.faces.facelets.component, com.sun.faces.io, org.primefaces.component.commandbutton, org.primefaces.component.chart.line, org.primefaces.component.breadcrumb, org.primefaces.component.carousel, org.primefaces.component.outputpanel, org.primefaces.component.column, META-INF.resources.primefaces.yui.utilities, org.primefaces.mobile.component.page, org.apache.taglibs.standard.tag.rt.fmt, META-INF.resources.primefaces.yui.paginator.assets.skins.sam, org.primefaces.component.terminal, META-INF.resources.primefaces.imageswitch, META-INF.resources.primefaces.dock, org.primefaces.event, org.apache.taglibs.standard.lang.jstl, org.primefaces.component.columngroup, org.primefaces.renderkit, org.primefaces.component.poll, META-INF.resources.primefaces.spacer, com.sun.faces.facelets.tag.jsf.html, com.sun.faces.facelets.impl, com.sun.faces.facelets.tag.jsf.core, org.primefaces.mobile.component.button, org.primefaces.component.fieldset, META-INF.resources.primefaces.carousel, META-INF.resources.primefaces.colorpicker.images, org.primefaces.component.resizable, com.sun.faces.component.behavior, org.primefaces.mobile.util, org.primefaces.context, org.primefaces.component.dnd, org.primefaces.component.row, javax.faces.view, org.primefaces.component.galleria, com.sun.faces.config.processor, org.primefaces.component.tree, com.sun.faces.ext.taglib, com.sun.faces.application.resource, org.primefaces.component.menubar, org.primefaces.component.rowexpansion, javax.faces.context, META-INF.resources.primefaces.contextmenu, META-INF.resources.primefaces.inputmask, org.primefaces.component.selectbooleancheckbox, META-INF.resources.primefaces.datagrid, org.primefaces.component.resources, org.primefaces.component.menuitem, org.primefaces.component.export, org.primefaces.component.chart, com.sun.faces.scripting, META-INF.resources.primefaces.tooltip, META-INF.resources.primefaces.tree, org.primefaces.component.submenu, org.primefaces.facelets, org.primefaces.mobile.component.field, org.primefaces.component.push, org.apache.taglibs.standard.tag.common.xml, META-INF.resources.primefaces.watermark, org.primefaces.component.panel, org.primefaces.model.map, com.sun.faces.facelets.util, javax.faces.view.facelets, org.primefaces.component.commandlink, com.sun.faces.util, org.primefaces.component.menubutton, META-INF.resources.primefaces.dock.assets, org.primefaces.component.divider, org.primefaces.component.inputtextarea, META-INF.resources.primefaces.tabview, org.primefaces.util, META-INF.resources.primefaces.wijmo, META-INF.resources.primefaces.confirmdialog] <IMPORT-ALL>NON_EMPTY}} at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:452) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) at org.jboss.webservices.integration.util.ASHelper.getEndpointClass(ASHelper.java:295) at org.jboss.webservices.integration.util.ASHelper.getWebServiceServlets(ASHelper.java:398) at org.jboss.webservices.integration.util.ASHelper.getJaxwsServlets(ASHelper.java:194) at org.jboss.webservices.integration.deployers.WSTypeDeployer.isJaxwsJseDeployment(WSTypeDeployer.java:153) at org.jboss.webservices.integration.deployers.WSTypeDeployer.internalDeploy(WSTypeDeployer.java:68) at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50) at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179) at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1448) at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1166) at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1107) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1633) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:823) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553) at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:783) at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:699) at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117) at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70) at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53) at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:403) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1633) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:775) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540) at org.jboss.system.server.profileservice.repository.AbstractProfileService.registerProfile(AbstractProfileService.java:308) at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:258) at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:97) at org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:860) at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:441) at java.lang.Thread.run(Thread.java:619) 20:56:27,808 INFO [TomcatDeployment] deploy, ctxPath=/HelloJSF 20:56:28,041 INFO [StandardContext] The listener "com.sun.faces.config.ConfigureListener" is already configured for this context. The duplicate definition has been ignored. 20:56:28,172 INFO [config] Initializing Mojarra 2.0.1 (FCS b02) for context '/HelloJSF' 20:56:33,146 SEVERE [application] JSF1029: The specified InjectionProvider implementation 'org.jboss.web.jsf.integration.injection.JBossInjectionProvider' does not implement the InjectionProvider interface. 20:56:33,147 INFO [application] JSF1048: PostConstruct/PreDestroy annotations present. ManagedBeans methods marked with these annotations will have said annotations processed. 20:56:33,937 INFO [Version] Hibernate Validator 4.0.2.GA 20:56:34,151 INFO [DefaultTraversableResolver] Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver. 20:56:39,200 INFO [PostConstructApplicationEventListener] Running on PrimeFaces 3.0.M2 20:56:39,281 INFO [TomcatDeployment] deploy, ctxPath=/ 20:56:39,476 INFO [TomcatDeployment] deploy, ctxPath=/jmx-console 20:56:39,633 INFO [ProfileServiceBootstrap] Loading profile: ProfileKey@52a00770[domain=default, server=default, name=default] 20:56:39,647 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080 20:56:39,723 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009 20:56:39,735 INFO [AbstractServer] JBossAS [6.0.0.M1 (build: SVNTag=JBoss_6_0_0_M1 date=200912040958)] Started in 1m:3s:377ms

My web.xml file looks like as follows :

<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>HelloJSF</display-name> <welcome-file-list> <welcome-file>index.jsp</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> <context-param> <param-name>com.sun.faces.injectionProvider</param-name> <param-value>org.jboss.web.jsf.integration.injection.JBossInjectionProvider</param-value> </context-param> <context-param> <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name> <param-value>true</param-value> </context-param> <servlet> <servlet-name>Resource Servlet</servlet-name> <servlet-class>org.primefaces.resource.ResourceServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Resource Servlet</servlet-name> <url-pattern>/primefaces_resource/*</url-pattern> </servlet-mapping> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>/faces/*</url-pattern> </servlet-mapping> <context-param> <param-name>primefaces.THEME</param-name> <param-value>none</param-value> </context-param> <context-param> <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>client</param-value> </context-param> <context-param> <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name> <param-value>resources.application</param-value> </context-param> <listener> <listener-class>com.sun.faces.config.ConfigureListener</listener-class> </listener> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.jsf</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.faces</url-pattern> </servlet-mapping> </web-app>

Where is the org.primefaces.resource.ResourceServlet class? I was not able to find it in jar downloaded from primefaces web site.

Any idea bout why this error comes and how to resolve this error?

Answer1:

The ResourceServlet was maintained as part of PrimeFaces 2.x. The 3.0 does not have it anymore. Perhaps you were reading documentation/guides targeted on PrimeFaces 2.x? The 3.0 does not require any entries in web.xml anymore. Just remove the ResourceServlet altogether from web.xml and pay attention that you're reading documentation/guides specific to PrimeFaces 3.0.

Answer2:

I had the same problem. Change the namespace http://primefaces.prime.com.tr/ui to http://primefaces.org/ui on prime 3.0

人吐槽 人点赞

Recommend

Comment

用户名: 密码:
验证码: 匿名发表

你可以使用这些语言

查看评论:Cannot load servlet class: org.primefaces.resource.ResourceServlet