Have you tried a clean + build? It looks like the class is not being copied into WEB-INF/classes
On Wed, Jun 10, 2009 at 12:16 PM, Dariusz Borowski <[email protected]>wrote: > In the attachment you can see my application structure. Maybe it helps to > understand. > > Thanks already in advance!! > > > > > On Wed, Jun 10, 2009 at 9:11 PM, Dariusz <[email protected]> wrote: > >> >> I realized, that I had an error in my web.xml. >> >> The listener wasn't pointing to my GuiceServletConfig. I changed it >> to: >> >> >> <listener> >> >> <listener-class>com.test.servlet.MyGuiceServletConfig</listener- >> class> >> </listener> >> >> but still the same problem. >> >> >> >> On Jun 10, 9:09 pm, Dariusz <[email protected]> wrote: >> > Thanks for your response! >> > >> > Now, when I start the app I am getting the following error: >> > >> > 10-Jun-2009 21:07:13 org.apache.catalina.core.StandardContext >> > listenerStart >> > SEVERE: Error configuring application listener of class >> > com.test.servlet.MyGuiceServletConfig >> > java.lang.ClassNotFoundException: >> > com.test.servlet.MyGuiceServletConfig >> > at org.apache.catalina.loader.WebappClassLoader.loadClass >> > (WebappClassLoader.java:1387) >> > at org.apache.catalina.loader.WebappClassLoader.loadClass >> > (WebappClassLoader.java:1233) >> > at org.apache.catalina.core.StandardContext.listenerStart >> > (StandardContext.java:3786) >> > at org.apache.catalina.core.StandardContext.start >> > (StandardContext.java:4342) >> > 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(Unknown Source) >> > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown >> Source) >> > at java.lang.reflect.Method.invoke(Unknown Source) >> > at >> org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) >> > at >> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) >> > 10-Jun-2009 21:07:13 org.apache.catalina.core.StandardContext >> > listenerStart >> > SEVERE: Skipped installing application listeners due to previous error >> > (s) >> > 10-Jun-2009 21:07:13 org.apache.catalina.core.StandardContext start >> > SEVERE: Error listenerStart >> > >> > Any suggestion? >> > >> > On Jun 10, 8:27 pm, Eduardo Nunes <[email protected]> wrote: >> > >> > > Did you added the required jars? >> > > - guice-servlet-2.0.jar >> > > - guice-2.0.jar >> > > - aopalliance.jar >> > >> > > On Wed, Jun 10, 2009 at 8:59 AM, Dariusz<[email protected]> wrote: >> > >> > > > Hi! >> > >> > > > I posted my question to a wrong group, so here is what my question >> is >> > > > about. >> > >> > > > I'm trying to get the example of guice 2.0 running, but I can't >> figure >> > > > out why it's not working. I try to do the same thing as on this >> page: >> > > >http://code.google.com/p/google-guice/wiki/ServletModule >> > >> > > > Here is what I got: >> > >> > > > web.xml >> > >> > > > <web-app id="WebApp_ID" version="2.4" xmlns=" >> http://java.sun.com/xml/ >> > > > ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> > > > xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee >> > > >http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> >> > > > <display-name>guicy</display-name> >> > >> > > > <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.test.MyGuiceServletConfig</ >> > > > listener-class> >> > > > </listener> >> > >> > > > </web-app> >> > >> > > > MyGuiceServletConfig.java >> > >> > > > import com.google.inject.Guice; >> > > > import com.google.inject.Injector; >> > > > import com.google.inject.servlet.GuiceServletContextListener; >> > >> > > > public class MyGuiceServletConfig extends >> GuiceServletContextListener >> > > > { >> > >> > > > @Override >> > > > protected Injector getInjector() { >> > > > return Guice.createInjector( new MyServletModule() ); >> > > > } >> > >> > > > } >> > >> > > > MyServletModule.java >> > >> > > > import com.google.inject.servlet.ServletModule; >> > >> > > > public class MyServletModule extends ServletModule { >> > >> > > > @Override >> > > > protected void configureServlets() { >> > > > serve("/*").with( MyServlet.class ); >> > > > } >> > >> > > > } >> > >> > > > MyServlet.java >> > >> > > > import java.io.IOException; >> > > > import java.io.PrintWriter; >> > >> > > > import javax.servlet.ServletException; >> > > > import javax.servlet.http.HttpServlet; >> > > > import javax.servlet.http.HttpServletRequest; >> > > > import javax.servlet.http.HttpServletResponse; >> > >> > > > import com.google.inject.Singleton; >> > >> > > > @Singleton >> > > > public class MyServlet extends HttpServlet { >> > >> > > > @Override >> > > > public void doGet(HttpServletRequest req, HttpServletResponse >> > > > resp) >> > > > throws ServletException, IOException { >> > > > resp.setContentType("text/html"); >> > > > PrintWriter writer = resp.getWriter(); >> > > > writer.printf("<h1>Welcome to the application!</h1>" ); >> > > > System.out.println( "...testing" ); >> > > > resp.setStatus( HttpServletResponse.SC_OK ); >> > > > } >> > >> > > > /** >> > > > * Process the HTTP Post request >> > > > */ >> > > > public void doPost( HttpServletRequest request, >> > > > HttpServletResponse >> > > > response ) throws ServletException, IOException { >> > > > System.out.println( "inside MyServlet class" ); >> > > > } >> > >> > > > } >> > >> > > > I'm not getting anywhere and I don't have anything in my log file. I >> > > > would really appreciate any help. I think th approach of Guice is >> > > > excellent and would love to use it for my applications. >> > >> > > > Thanks a lot in advance! >> > >> > > -- >> > > Eduardo S. Nuneshttp://e-nunes.com.br >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
