Adam Ruggles 写道: > Ok I figured it out. I was using the snapshot from the guiceyfruit > maven repositories and it looks the jar file wasn't packaged with the > plugin xml file. > > On Oct 20, 11:34 pm, "Haulyn R. Jason" <[EMAIL PROTECTED]> wrote: > >> Adam Ruggles 写道: >> >> >>> I'm using struts 2.1.2 >>> >>> here is my struts.xml file >>> <?xml version="1.0" encoding="UTF-8" ?> >>> <!DOCTYPE struts PUBLIC >>> "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" >>> "http://struts.apache.org/dtds/struts-2.0.dtd"> >>> >>> <struts> >>> <!-- Constant Settings --> >>> <constant name="struts.enable.DynamicMethodInvocation" value="false" /> >>> <constant name="struts.codebehind.pathPrefix" value="/WEB-INF/pages/"/> >>> <constant name="struts.url.includeParams" value="none" /> >>> <constant name="struts.custom.i18n.resources" value="global-messages" /> >>> <constant name="struts.objectFactory" value="guice" /> >>> >>> <!-- Development Settings "Change these when going to production" --> >>> <constant name="struts.devMode" value="true" /> >>> <constant name="struts.i18n.reload" value="true" /> >>> <constant name="struts.configuration.xml.reload" value="true" /> >>> >>> <!-- Action Mapping Files --> >>> <include file="struts-mappings.xml"/> >>> >>> </struts> >>> >>> I'm not using a struts.properties file. I'm using Tomcat 6.0.18 on >>> windows and servlet 2.4 in my web.xml. There's nothing special about >>> my config. >>> >>> On Mon, Oct 20, 2008 at 11:15 PM, Haulyn R. Jason >>> <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote: >>> >>> Adam Ruggles : >>> > Has anyone had any problems using the latest guice 2.0 snapshot with >>> > struts2? >>> >>> > I added the following libraries: >>> > struts2-guice-plugin.jar >>> > guice-servlet.jar >>> > guice.jar >>> >>> > added the following to struts.xml: >>> > <constant name="struts.objectFactory" value="guice" /> >>> >>> > I have the following web.xml configuration: >>> > <filter> >>> > <filter-name>guice</filter-name> >>> > <filter-class>com.google.inject.servlet.GuiceFilter</filter-class> >>> > </filter> >>> > <filter> >>> > <filter-name>struts2</filter-name> >>> >>> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter- >>> > class> >>> > <init-param> >>> > <param-name>actionPackages</param-name> >>> > <param-value>kiff.action</param-value> >>> > </init-param> >>> > </filter> >>> > <filter-mapping> >>> > <filter-name>guice</filter-name> >>> > <url-pattern>/*</url-pattern> >>> > </filter-mapping> >>> > <filter-mapping> >>> > <filter-name>struts2</filter-name> >>> > <url-pattern>/*</url-pattern> >>> > </filter-mapping> >>> >>> > And I'm getting the following error in my tomcat 6 logs: >>> > SEVERE: Exception starting filter struts2 >>> > Unable to load configuration. - [unknown location] >>> > at >>> >>> >>> com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java: >>> > 58) >>> > at >>> >>> >>> org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java: >>> > 371) >>> > at >>> org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:424) >>> > at >>> >>> >>> org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java: >>> > 213) >>> > at >>> >>> >>> org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java: >>> > 275) >>> > at >>> >>> >>> org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java: >>> > 397) >>> > at >>> >>> >>> org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java: >>> > 108) >>> > at >>> >>> >>> org.apache.catalina.core.StandardContext.filterStart(StandardContext.java: >>> > 3709) >>> > at >>> > org.apache.catalina.core.StandardContext.start(StandardContext.java: >>> > 4363) >>> > at org.apache.catalina.core.ContainerBase.start(ContainerBase.java: >>> > 1045) >>> > at >>> org.apache.catalina.core.StandardHost.start(StandardHost.java:719) >>> > at org.apache.catalina.core.ContainerBase.start(ContainerBase.java: >>> > 1045) >>> > at >>> org.apache.catalina.core.StandardEngine.start(StandardEngine.java: >>> > 443) >>> > at >>> > org.apache.catalina.core.StandardService.start(StandardService.java: >>> > 516) >>> > at >>> org.apache.catalina.core.StandardServer.start(StandardServer.java: >>> > 710) >>> > at org.apache.catalina.startup.Catalina.start(Catalina.java:578) >>> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>> > at >>> >>> >>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: >>> > 39) >>> > at >>> >>> >>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: >>> > 25) >>> > at java.lang.reflect.Method.invoke(Method.java:597) >>> > at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) >>> > at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) >>> > Caused by: Cannot locate the chosen ObjectFactory implementation: >>> > guice - [unknown location] >>> > at >>> >>> >>> org.apache.struts2.config.BeanSelectionProvider.alias(BeanSelectionProvider.java: >>> > 279) >>> > at >>> >>> >>> org.apache.struts2.config.BeanSelectionProvider.alias(BeanSelectionProvider.java: >>> > 250) >>> > at >>> >>> >>> org.apache.struts2.config.BeanSelectionProvider.register(BeanSelectionProvider.java: >>> > 197) >>> > at >>> >>> >>> com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java: >>> > 156) >>> > at >>> >>> >>> com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java: >>> > 55) >>> > ... 21 more >>> >>> > Any ideas? >>> >>> Hi, I use struts2.1.2Beta and Guice snapshot version, everything works >>> well. I am not sure why you met this problem, but I know struts2 and >>> guice2.0 snapshot work well with each other on my production >>> environment. >>> >>> I use servlet 2.5 and tomcat 6.x, you should publish more information >>> about configuration, including struts.xml or struts.properties. >>> >>> -- >>> >>> Thanks! >>> >>> Mobile: +086-15864011231 >>> Website:http://www.openmotel.cn >>> http://www.vvthumb.com >>> GTalk:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> >>> Skype:saharabear >>> >>> Haulyn Runner Jason >>> >> I think you need to satisfy guice.module to your web application module. >> this is my code: >> guice.module=cn.openmotel.lorenzo.demo.config.ApplicationModule >> I use struts.properties, you should change to struts.xml and try again. >> good luck! >> >> -- >> >> Thanks! >> >> Mobile: +086-15864011231 >> Website:http://www.openmotel.cn >> http://www.vvthumb.com >> GTalk:[EMAIL PROTECTED] >> Skype:saharabear >> >> Haulyn Runner Jason >> > > > > ok, cool.
-- Thanks! Mobile: +086-15864011231 Website:http://www.openmotel.cn http://www.vvthumb.com GTalk:[EMAIL PROTECTED] Skype:saharabear Haulyn Runner Jason --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "google-guice" group. 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 -~----------~----~----~----~------~----~------~--~---
