(PrimePush) com.sun.jersey.api.container.ContainerException: ResourceConfig instance does not contain root resource classes

I am new to PrimePush and want to try it. I followed this tutorial
However, when I ran the register.xhtml file, I got the error com.sun.jersey.api.container.ContainerException: the ResourceConfig instance does not contain root resource classes.

This is the jar that I have

  • atmosphere-Compat-jbossweb-1.0.1
  • atmosphere-compatible-1.0.1-cat
  • atmostphere-Compat-tomcat7-1.0.1
  • atmostphere-environment-1.0.1
  • primefaces-3.4.2
  • SLF4J-api-1.7.2
  • SLF4J-simple-1.7.2
  • JSF 2.1 (Mojarra 2.1.6)

I am using tomcat7 and jre7

This is web.xml

<?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_3_0.xsd" id="WebApp_ID" version="3.0"> <display-name>Test1</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> <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>*.jsf</url-pattern> </servlet-mapping> <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> <context-param> <param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name> <param-value>true</param-value> </context-param> <listener> <listener-class>com.sun.faces.config.ConfigureListener</listener-class> </listener> <context-param> <param-name>primefaces.PUSH_SERVER_URL</param-name> <param-value>http://localhost:8080</param-value> </context-param> <servlet> <servlet-name>Push Servlet</servlet-name> <servlet-class>org.primefaces.push.PushServlet</servlet-class> <init-param> <param-name>org.atmosphere.cpr.broadcasterCacheClass</param-name> <param-value>org.atmosphere.cache.HeaderBroadcasterCache</param-value> </init-param> <init-param> <param-name>org.atmosphere.cpr.broadcasterClass</param-name> <param-value>org.atmosphere.cpr.DefaultBroadcaster</param-value> </init-param> <init-param> <param-name>org.atmosphere.cpr.broadcastFilterClasses</param-name> <param-value>org.atmosphere.client.TrackMessageSizeFilter</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Push Servlet</servlet-name> <url-pattern>/primepush/*</url-pattern> </servlet-mapping> <servlet> <servlet-name>jersey-serlvet</servlet-name> <servlet-class> com.sun.jersey.spi.container.servlet.ServletContainer </servlet-class> <init-param> <param-name>com.sun.jersey.config.property.packages</param-name> <param-value>bean.PushBean</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>jersey-serlvet</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> </web-app> 

This is register.xhtml

 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:p="http://primefaces.org/ui" xmlns:h="http://java.sun.com/jsf/html"> <h:head> <title>Facelet Title</title> </h:head> <h:body> <h:form id="form"> <h:outputText id="out" value="#{pushBean.count}" styleClass="ui-widget display" /> <br /> <p:commandButton value="Click" actionListener="#{pushBean.increment}" /> </h:form> <p:socket onMessage="handleMessage" channel="/counter" /> <script type="text/javascript"> function handleMessage(data) { $('.display').html(data); } </script> </h:body> </html> 

This is PushBean.java

 package Bean; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; import org.primefaces.push.PushContext; import org.primefaces.push.PushContextFactory; @ManagedBean @SessionScoped public class PushBean implements java.io.Serializable { /** * */ private static final long serialVersionUID = 1L; public PushBean() { } private int count; public int getCount() { return count; } public void setCount(int count) { this.count = count; } public synchronized void increment() { count++; PushContext pushContext = PushContextFactory.getDefault().getPushContext(); pushContext.push("/counter", String.valueOf(count)); } } 

From this link it says:

Many causes of this "ResourceConfig" error message. A few solutions that I know:

  • com.sun.jersey.config.property.packages does not exist in your web.xml.
  • com.sun.jersey.config.property.packages has included a resource that does not include knitwear services. In the above case, "com.mkyong.rest" does not contain any knitted services.

So, I think that maybe bean.PushBean in web.xml is wrong? ?
However, I do not know how to change it (if bean.PushBean is a problem). From the eclipse project explorer, the PushBean.java path is Java resources β†’ src β†’ Bean β†’ PushBean.java

Please help me find a solution. Thanks in advance.

+4
source share

All Articles