Hi All,

We are using Jetty embedded and reuse lots of classes in a common lib that 
require guice.

Usually what we do in our GuiceFilter of each web app is:

public class GuiceConfig extends GuiceServletContextListener {
    @Override
    protected Injector getInjector() {
        final Map<String, String> params = new HashMap<String, String>();
          params.put(PackagesResourceConfig.PROPERTY_PACKAGES, 
"com.company.app.resources");

        return Guice.createInjector(new ServletModule() {
            @Override
            protected void configureServlets() {
                serve("/*").with(GuiceContainer.class, params);
            }
        });
    }
}


Our problem is that when we are deploying the applications the following 
warning happens:

! GuiceFilter.setPipeline:87                      Multiple Servlet 
injectors detected. This is a warning indicating that you have more than 
one GuiceFilter running in your web application. If this is deliberate, you 
may safely ignore this message. If this is NOT deliberate however, your 
application may not work as expected.

And only one application is working after the server startup. Is there any 
other way to solve the problem rather than having the guice jar in each web 
app ? (this is not an option for us, because then we get lots of class cast 
exceptions due to our commons libs not being in the same classloader)

Cheers
 

On Saturday, February 5, 2011 9:10:29 PM UTC, Evan Ruff wrote:
>
> Guy guys!
>
> I'm making some progress with the Guice. I've successfully implemented 
> guice in all of my applications and have even migrated everything over to 
> gwt-dispatch! I'm really beginning to get the hang of it and I'm starting 
> to understand just how powerful it is. Now, I'm starting to push GIN down 
> into all the GWT stuff... exciting! 
>
> Everything is looking good (no turtles!) in development. I'm running into 
> one (simple?) issue with deployment. I am running a single Tomcat 7 server 
> for staging. I have two hosts (stage and admin) and am deploying three 
> webapps (moose.war, charts.war, sem.war). These are 
> all independent contexts. moose.war goes to the admin virtual host as ROOT, 
> and the other two go to the stage host. When I deploy the first WAR to the 
> server, it works great. As soon as I deploy the other, I get a WARNING in 
> the log:
>
> WARNING: Multiple Servlet injectors detected. This is a warning indicating 
> that you have more than one GuiceFilter running in your web application. If 
> this is deliberate, you may safely ignore this message. If this is NOT 
> deliberate however, your application may not work as expected.
>
> Now, if I go to access a servlet from either WAR, they both give 404s! 
> They're using similar web.xml files with:
> <filter>
> <filter-name>guiceFilter</filter-name>
> <filter-class>com.google.inject.servlet.GuiceFilter</filter-class>
> </filter>
>
> <filter-mapping>
> <filter-name>guiceFilter</filter-name>
> <url-pattern>/*</url-pattern>
> </filter-mapping>
>
> <listener>
> <listener-class>com.hs.***MY.LISTENER.HERE***</listener-class>
> </listener>
>
> I have tried altering the filter url-pattern but nothing seems to be 
> helping the conflict. If I use Tomcat Manager to turn the hosts on/off as 
> well as the various contexts, I can make them each work individually, but 
> none at a time.
>
> Is there a scoping issue somewhere? How can I get around this?!
>
> Thanks!!
>
> E
>
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-guice/-/dqZKSYO44tcJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to