PF 5.1 AtmosphereFramework not found in class loader

UI Components for JSF
Post Reply
prasadrpm
Posts: 1
Joined: 27 Sep 2014, 07:26

01 Oct 2014, 23:15

This is my first post and we are trying to make use of the gr8 push framework with PF5.1 and Mojarra 2.1.25.

I am trying to make the counter example work in our environment. But couldn't. We are using Spring 3.2.4 with Hibernate/JPA on Tomcat 7.0.27.

Since we are using Spring as DI framework, we followed the procedure mentioned in this link..https://github.com/Atmosphere/atmospher ... -Injection

SpringWebObjectFactory.java

Code: Select all


import org.atmosphere.cpr.AtmosphereFramework;
import org.atmosphere.cpr.AtmosphereObjectFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

public class SpringWebObjectFactory implements AtmosphereObjectFactory {
	private final Logger logger  = LoggerFactory.getLogger(SpringWebObjectFactory.class); 

	@Override
	public <T, U extends T> T newClassInstance(AtmosphereFramework framework,
            Class<T> classType, Class<U> classToInstantiate) throws InstantiationException, IllegalAccessException {
			
			logger.info("inside  newClassInstance() ");
			
			WebApplicationContext parent =                      WebApplicationContextUtils.getWebApplicationContext(framework.getServletContext());
		 	AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
		 	logger.info("context-->{}",context);
	        context.setParent(parent);
	        context.register(classToInstantiate);
	        logger.info("classToInstantiate-->{}",classToInstantiate);
	        context.refresh();
	        U t = context.getBean(classToInstantiate);
	        if (t == null) {
	            logger.info("Unable to find {}. Creating the object directly."
	                    + classToInstantiate.getName());
	            return classToInstantiate.newInstance();
	        }
	        //logger.info("Instance is -->{}",t);
	        return t;
	}

}
But unfortunately the log shows that AtmosphereFramework itself is not found in the classpath and BroadcasterCache not recognized as well. Added default broadcaster cache in web.xml as mentioned - https://github.com/Atmosphere/atmospher ... asterCache

Code: Select all


    <servlet>
        <servlet-name>Push Servlet</servlet-name>
        <servlet-class>org.primefaces.push.PushServlet</servlet-class>        
        <init-param>
	  		<param-name>org.atmosphere.cpr.objectFactory</param-name>
	  		<param-value>com.rcent.sample.SpringWebObjectFactory</param-value>
	</init-param>
 	<init-param>
        	<param-name>org.atmosphere.cpr.broadcasterCache</param-name>
        	<param-value>org.atmosphere.cache.UUIDBroadcasterCache</param-value>        	
        </init-param>
	<load-on-startup>1</load-on-startup> 
        </servlet>
Also added the annotation processor as well just in case if it is not recognized. Per the link - https://github.com/Atmosphere/atmospher ... -it-inside

Here is the gradle dependencies that I have in our project.

Code: Select all


compile "org.atmosphere:atmosphere-runtime:2.2.1"
compile "org.atmosphere:atmosphere-spring:2.2.0"
compile "eu.infomas:annotation-detector:3.0.1"


Log output:

Code: Select all


WARN  o.a.u.IOUtils.readServiceFile META-INF/services/org.atmosphere.cpr.AtmosphereFramework not found in class loader
INFO  c.r.s.SpringWebObjectFactory.newClassInstance inside  newClassInstance() 
INFO  c.r.s.SpringWebObjectFactory.newClassInstance context-->org.springframework.context.annotation.AnnotationConfigApplicationContext@5abc9d17: startup date [Wed Dec 31 18:00:00 CST 1969]; root of context hierarchy
INFO  c.r.s.SpringWebObjectFactory.newClassInstance classToInstantiate-->class org.atmosphere.cpr.DefaultAnnotationProcessor
INFO  c.r.s.SpringWebObjectFactory.newClassInstance inside  newClassInstance() 
INFO  c.r.s.SpringWebObjectFactory.newClassInstance context-->org.springframework.context.annotation.AnnotationConfigApplicationContext@6e2178eb: startup date [Wed Dec 31 18:00:00 CST 1969]; root of context hierarchy
INFO  c.r.s.SpringWebObjectFactory.newClassInstance classToInstantiate-->class org.atmosphere.annotation.AtmosphereInterceptorServiceProcessor
INFO  c.r.s.SpringWebObjectFactory.newClassInstance inside  newClassInstance() 
INFO  c.r.s.SpringWebObjectFactory.newClassInstance context-->org.springframework.context.annotation.AnnotationConfigApplicationContext@6115ba28: startup date [Wed Dec 31 18:00:00 CST 1969]; root of context hierarchy
INFO  c.r.s.SpringWebObjectFactory.newClassInstance classToInstantiate-->class org.primefaces.push.impl.PushEndpointInterceptor
INFO  c.r.s.SpringWebObjectFactory.newClassInstance inside  newClassInstance() 
INFO  c.r.s.SpringWebObjectFactory.newClassInstance context-->org.springframework.context.annotation.AnnotationConfigApplicationContext@205d5d5c: startup date [Wed Dec 31 18:00:00 CST 1969]; root of context hierarchy
INFO  c.r.s.SpringWebObjectFactory.newClassInstance classToInstantiate-->class org.atmosphere.annotation.EndpointMapperServiceProcessor
INFO  c.r.s.SpringWebObjectFactory.newClassInstance inside  newClassInstance() 
INFO  c.r.s.SpringWebObjectFactory.newClassInstance context-->org.springframework.context.annotation.AnnotationConfigApplicationContext@d005875: startup date [Wed Dec 31 18:00:00 CST 1969]; root of context hierarchy
INFO  c.r.s.SpringWebObjectFactory.newClassInstance classToInstantiate-->class org.primefaces.push.impl.PushEndpointMapper
INFO  c.r.s.SpringWebObjectFactory.newClassInstance inside  newClassInstance() 
INFO  c.r.s.SpringWebObjectFactory.newClassInstance context-->org.springframework.context.annotation.AnnotationConfigApplicationContext@607959f7: startup date [Wed Dec 31 18:00:00 CST 1969]; root of context hierarchy
INFO  c.r.s.SpringWebObjectFactory.newClassInstance classToInstantiate-->class org.atmosphere.websocket.protocol.SimpleHttpProtocol
INFO  c.r.s.SpringWebObjectFactory.newClassInstance inside  newClassInstance() 
INFO  c.r.s.SpringWebObjectFactory.newClassInstance context-->org.springframework.context.annotation.AnnotationConfigApplicationContext@29dbbf10: startup date [Wed Dec 31 18:00:00 CST 1969]; root of context hierarchy
INFO  c.r.s.SpringWebObjectFactory.newClassInstance classToInstantiate-->class org.atmosphere.interceptor.CorsInterceptor
INFO  c.r.s.SpringWebObjectFactory.newClassInstance inside  newClassInstance() 
INFO  c.r.s.SpringWebObjectFactory.newClassInstance context-->org.springframework.context.annotation.AnnotationConfigApplicationContext@17eb3424: startup date [Wed Dec 31 18:00:00 CST 1969]; root of context hierarchy
INFO  c.r.s.SpringWebObjectFactory.newClassInstance classToInstantiate-->class org.atmosphere.interceptor.CacheHeadersInterceptor
INFO  c.r.s.SpringWebObjectFactory.newClassInstance inside  newClassInstance() 
INFO  c.r.s.SpringWebObjectFactory.newClassInstance context-->org.springframework.context.annotation.AnnotationConfigApplicationContext@283c1f70: startup date [Wed Dec 31 18:00:00 CST 1969]; root of context hierarchy
INFO  c.r.s.SpringWebObjectFactory.newClassInstance classToInstantiate-->class org.atmosphere.interceptor.PaddingAtmosphereInterceptor
INFO  c.r.s.SpringWebObjectFactory.newClassInstance inside  newClassInstance() 
INFO  c.r.s.SpringWebObjectFactory.newClassInstance context-->org.springframework.context.annotation.AnnotationConfigApplicationContext@272d3df7: startup date [Wed Dec 31 18:00:00 CST 1969]; root of context hierarchy
INFO  c.r.s.SpringWebObjectFactory.newClassInstance classToInstantiate-->class org.atmosphere.interceptor.AndroidAtmosphereInterceptor
INFO  c.r.s.SpringWebObjectFactory.newClassInstance inside  newClassInstance() 
INFO  c.r.s.SpringWebObjectFactory.newClassInstance context-->org.springframework.context.annotation.AnnotationConfigApplicationContext@227abd9b: startup date [Wed Dec 31 18:00:00 CST 1969]; root of context hierarchy
INFO  c.r.s.SpringWebObjectFactory.newClassInstance classToInstantiate-->class org.atmosphere.interceptor.HeartbeatInterceptor
INFO  c.r.s.SpringWebObjectFactory.newClassInstance inside  newClassInstance() 
INFO  c.r.s.SpringWebObjectFactory.newClassInstance context-->org.springframework.context.annotation.AnnotationConfigApplicationContext@106db585: startup date [Wed Dec 31 18:00:00 CST 1969]; root of context hierarchy
INFO  c.r.s.SpringWebObjectFactory.newClassInstance classToInstantiate-->class org.atmosphere.interceptor.SSEAtmosphereInterceptor
INFO  c.r.s.SpringWebObjectFactory.newClassInstance inside  newClassInstance() 
INFO  c.r.s.SpringWebObjectFactory.newClassInstance context-->org.springframework.context.annotation.AnnotationConfigApplicationContext@12fff2d6: startup date [Wed Dec 31 18:00:00 CST 1969]; root of context hierarchy
INFO  c.r.s.SpringWebObjectFactory.newClassInstance classToInstantiate-->class org.atmosphere.interceptor.JSONPAtmosphereInterceptor
INFO  c.r.s.SpringWebObjectFactory.newClassInstance inside  newClassInstance() 
INFO  c.r.s.SpringWebObjectFactory.newClassInstance context-->org.springframework.context.annotation.AnnotationConfigApplicationContext@69ecf4c7: startup date [Wed Dec 31 18:00:00 CST 1969]; root of context hierarchy
INFO  c.r.s.SpringWebObjectFactory.newClassInstance classToInstantiate-->class org.atmosphere.interceptor.JavaScriptProtocol
INFO  c.r.s.SpringWebObjectFactory.newClassInstance inside  newClassInstance() 
INFO  c.r.s.SpringWebObjectFactory.newClassInstance context-->org.springframework.context.annotation.AnnotationConfigApplicationContext@461ee405: startup date [Wed Dec 31 18:00:00 CST 1969]; root of context hierarchy
INFO  c.r.s.SpringWebObjectFactory.newClassInstance classToInstantiate-->class org.atmosphere.interceptor.WebSocketMessageSuspendInterceptor
INFO  c.r.s.SpringWebObjectFactory.newClassInstance inside  newClassInstance() 
INFO  c.r.s.SpringWebObjectFactory.newClassInstance context-->org.springframework.context.annotation.AnnotationConfigApplicationContext@9c6e916: startup date [Wed Dec 31 18:00:00 CST 1969]; root of context hierarchy
INFO  c.r.s.SpringWebObjectFactory.newClassInstance classToInstantiate-->class org.atmosphere.interceptor.OnDisconnectInterceptor
INFO  c.r.s.SpringWebObjectFactory.newClassInstance inside  newClassInstance() 
INFO  c.r.s.SpringWebObjectFactory.newClassInstance context-->org.springframework.context.annotation.AnnotationConfigApplicationContext@668ade35: startup date [Wed Dec 31 18:00:00 CST 1969]; root of context hierarchy
INFO  c.r.s.SpringWebObjectFactory.newClassInstance classToInstantiate-->class org.atmosphere.interceptor.IdleResourceInterceptor
WARN  o.a.c.AtmosphereFramework.info No BroadcasterCache configured. Broadcasted message between client reconnection will be LOST. It is recommended to configure the org.atmosphere.cache.UUIDBroadcasterCache
INFO  c.r.s.SpringWebObjectFactory.newClassInstance inside  newClassInstance() 
INFO  c.r.s.SpringWebObjectFactory.newClassInstance context-->org.springframework.context.annotation.AnnotationConfigApplicationContext@43b31d29: startup date [Wed Dec 31 18:00:00 CST 1969]; root of context hierarchy
INFO  c.r.s.SpringWebObjectFactory.newClassInstance classToInstantiate-->class org.atmosphere.cpr.DefaultBroadcaster
ERROR o.p.p.PushServlet.configureFramework No Annotated class using @PushEndpoint found. Push will not work.

Am I missing anything here. ?

Thanks
Prasad
PF 5.1, Spring 3.2, Hibernate/JPA 2, Tomcat 7

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 30 guests