vaadin / framework

Vaadin 6, 7, 8 is a Java framework for modern Java web applications.
http://vaadin.com/
Other
1.78k stars 730 forks source link

WARNING: More than one Universe configured #8292

Closed Artur- closed 7 years ago

Artur- commented 7 years ago

Every time you start a 8.0.0.beta1 application, the log contains

Jan 20, 2017 1:53:50 PM org.atmosphere.cpr.Universe broadcasterFactory
WARNING: More than one Universe configured. Universe class will gives wrong object reference org.atmosphere.cpr.DefaultBroadcasterFactory@7d11bf62
Jan 20, 2017 1:53:50 PM org.atmosphere.cpr.Universe resourceFactory
WARNING: More than one Universe configured. Universe class will gives wrong object reference org.atmosphere.cpr.DefaultAtmosphereResourceFactory@762173c2
Jan 20, 2017 1:53:50 PM org.atmosphere.cpr.Universe sessionResourceFactory
WARNING: More than one Universe configured. Universe class will gives wrong object reference org.atmosphere.cpr.DefaultAtmosphereResourceSessionFactory@164a220b
Jan 20, 2017 1:53:50 PM org.atmosphere.cpr.Universe framework
WARNING: More than one Universe configured. Universe class will gives wrong object reference com.vaadin.server.communication.PushRequestHandler$1@583cd54e

Although I don't have a case that is broken, it certainly looks like something is wrong

Flamenco commented 7 years ago

This still happens on 8.0.6 as well.

tripvdm commented 7 years ago

May be libraries included in your war package that should not be packed, i.e some parts of jetty you could use.

Flamenco commented 7 years ago

@VadimLi I am using OSGi.

My classpath is rock-solid in that regard.

Flamenco commented 7 years ago

After some research, 2 circumstances lead to this.

Cause 1 I am using OSGi. These 2 annotations are used on my Servlet. @Component(service = VaadinServlet.class) @WebServlet(urlPatterns = "/*", name = "MyUIServlet", asyncSupported = true)

These cause VaadinServlet.init to be called twice, both leading to atmosphere.init(...) First by the WebApp (WebServlet), before the servlet CTOR is called while creating the default context. Then it is called by the DS OSGi component system. The servlet is created and then init is called again.

Cause 2 2 UI's using push, both leading to atmosphere.init(...). The Universe has static members and has already cached the members.

From Universe.java...

 * Universe contains static reference to Atmosphere's Factories.
 * </p>
 * PLEASE DO NOT USE THIS CLASS IF YOUR APPLICATION CONTAINS WEBFRAGMENTS OR MORE THAN ONCE ATMOSPHERE SERVLET DEFINED
 * AS THIS CLASS IS USING STATIC INSTANCE.
 * </p>
 * <p/>
 * This is ugly, only here to save your buts, Atmosphere users!