Yes,

in the initial message I sent a code where I set the injector in the
session, and this was exactly my question: is it correct to do that? how to
handle the injector so that I do not have to keep instantiating him in
every service call?

at.,

*Arthur P. Gregório*
*+55 45 9958-0302*
@gregorioarthur
www.arthurgregorio.eti.br



2012/10/5 Brian Pontarelli <[email protected]>

> It looks like you are putting the Injector (or at least one of the
> anonymous inner classes it creates) in the session at some point. Tomcat
> serializes the sessions out to disk during restart by default and since you
> have the Injector in the session it fails, since that object is not
> serializable.
>
> Audit your code and look for 'session.setAttribute'
>
> -bp
>
>
> On Oct 5, 2012, at 8:20 AM, Arthur Gregório <[email protected]>
> wrote:
>
> Anyone can help with this?
>
> =D
>
> Em segunda-feira, 24 de setembro de 2012 09h48min51s UTC-3, Arthur
> Gregório escreveu:
>>
>> I am developing an application using JSF and Guice to inject the DAO's
>> within the services used by the managed bean .. however from time to time
>> my tomcat shows the below error in the server log, saying that the
>> implementation of the injector is not serializable ...
>>
>> Set 24, 2012 9:41:04 AM org.apache.catalina.session.**StandardSession
>> writeObject
>> Advertência: Cannot serialize session attribute adminBean for session
>> A84058FE8346B64799CD45C8CDBC83**76
>> java.io.**NotSerializableException: com.google.inject.internal.**
>> InjectorImpl$4
>> at java.io.ObjectOutputStream.**writeObject0(**
>> ObjectOutputStream.java:1180)
>> at java.io.ObjectOutputStream.**defaultWriteFields(**
>> ObjectOutputStream.java:1528)
>> at java.io.ObjectOutputStream.**writeSerialData(**
>> ObjectOutputStream.java:1493)
>> at java.io.ObjectOutputStream.**writeOrdinaryObject(**
>> ObjectOutputStream.java:1416)
>> at java.io.ObjectOutputStream.**writeObject0(**
>> ObjectOutputStream.java:1174)
>> at java.io.ObjectOutputStream.**defaultWriteFields(**
>> ObjectOutputStream.java:1528)
>> at java.io.ObjectOutputStream.**writeSerialData(**
>> ObjectOutputStream.java:1493)
>> at java.io.ObjectOutputStream.**writeOrdinaryObject(**
>> ObjectOutputStream.java:1416)
>> at java.io.ObjectOutputStream.**writeObject0(**
>> ObjectOutputStream.java:1174)
>> at java.io.ObjectOutputStream.**defaultWriteFields(**
>> ObjectOutputStream.java:1528)
>> at java.io.ObjectOutputStream.**writeSerialData(**
>> ObjectOutputStream.java:1493)
>> at java.io.ObjectOutputStream.**writeOrdinaryObject(**
>> ObjectOutputStream.java:1416)
>> at java.io.ObjectOutputStream.**writeObject0(**
>> ObjectOutputStream.java:1174)
>> at java.io.ObjectOutputStream.**writeObject(**
>> ObjectOutputStream.java:346)
>> at org.apache.catalina.session.**StandardSession.writeObject(**
>> StandardSession.java:1671)
>> at org.apache.catalina.session.**StandardSession.**writeObjectData(**
>> StandardSession.java:1077)
>> at org.apache.catalina.session.**StandardManager.doUnload(**
>> StandardManager.java:432)
>> at org.apache.catalina.session.**StandardManager.unload(**
>> StandardManager.java:353)
>> at org.apache.catalina.session.**StandardManager.stopInternal(**
>> StandardManager.java:518)
>> at org.apache.catalina.util.**LifecycleBase.stop(**
>> LifecycleBase.java:232)
>> at org.apache.catalina.core.**StandardContext.stopInternal(**
>> StandardContext.java:5462)
>> at org.apache.catalina.util.**LifecycleBase.stop(**
>> LifecycleBase.java:232)
>> at org.apache.catalina.core.**StandardContext.reload(**
>> StandardContext.java:3901)
>> at org.apache.catalina.manager.**ManagerServlet.reload(**
>> ManagerServlet.java:949)
>> at org.apache.catalina.manager.**ManagerServlet.doGet(**
>> ManagerServlet.java:360)
>> at javax.servlet.http.**HttpServlet.service(**HttpServlet.java:621)
>> at javax.servlet.http.**HttpServlet.service(**HttpServlet.java:722)
>> at org.apache.catalina.core.**ApplicationFilterChain.**internalDoFilter(*
>> *ApplicationFilterChain.java:**305)
>> at org.apache.catalina.core.**ApplicationFilterChain.**doFilter(**
>> ApplicationFilterChain.java:**210)
>> at org.netbeans.modules.web.**monitor.server.MonitorFilter.**
>> doFilter(MonitorFilter.java:**393)
>> at org.apache.catalina.core.**ApplicationFilterChain.**internalDoFilter(*
>> *ApplicationFilterChain.java:**243)
>> at org.apache.catalina.core.**ApplicationFilterChain.**doFilter(**
>> ApplicationFilterChain.java:**210)
>> at org.apache.catalina.filters.**SetCharacterEncodingFilter.**doFilter(**
>> SetCharacterEncodingFilter.**java:108)
>> at org.apache.catalina.core.**ApplicationFilterChain.**internalDoFilter(*
>> *ApplicationFilterChain.java:**243)
>> at org.apache.catalina.core.**ApplicationFilterChain.**doFilter(**
>> ApplicationFilterChain.java:**210)
>> at org.apache.catalina.core.**StandardWrapperValve.invoke(**
>> StandardWrapperValve.java:225)
>> at org.apache.catalina.core.**StandardContextValve.invoke(**
>> StandardContextValve.java:169)
>> at org.apache.catalina.**authenticator.**AuthenticatorBase.invoke(**
>> AuthenticatorBase.java:581)
>> at org.apache.catalina.core.**StandardHostValve.invoke(**
>> StandardHostValve.java:168)
>> at org.apache.catalina.valves.**ErrorReportValve.invoke(**
>> ErrorReportValve.java:98)
>> at org.apache.catalina.valves.**AccessLogValve.invoke(**
>> AccessLogValve.java:927)
>> at org.apache.catalina.core.**StandardEngineValve.invoke(**
>> StandardEngineValve.java:118)
>> at org.apache.catalina.connector.**CoyoteAdapter.service(**
>> CoyoteAdapter.java:407)
>> at org.apache.coyote.http11.**AbstractHttp11Processor.**process(**
>> AbstractHttp11Processor.java:**999)
>> at org.apache.coyote.**AbstractProtocol$**AbstractConnectionHandler.**
>> process(AbstractProtocol.java:**565)
>> at org.apache.tomcat.util.net.**JIoEndpoint$SocketProcessor.**
>> run(JIoEndpoint.java:309)
>> at java.util.concurrent.**ThreadPoolExecutor.runWorker(**
>> ThreadPoolExecutor.java:1110)
>> at java.util.concurrent.**ThreadPoolExecutor$Worker.run(**
>> ThreadPoolExecutor.java:603)
>> at java.lang.Thread.run(Thread.**java:722)
>>
>> i'm missing something during guice setup?!
>>
>> the setup in a contextListener
>>
>>     private void startGuice(ServletContext context) {
>>
>>         Injector injector = Guice.createInjector(
>>                 new JpaPersistModule("**ConecteseWebPU"));
>>
>>         injector.getInstance(**JPAServiceInitializer.class);
>>
>>         context.setAttribute(Injector.**class.getName(), injector);
>>
>>         LOG.info("Guice is ready!");
>>     }
>>
>> now I keep it in context, and when i need to retrieve it, not have to
>> create another injector ...
>>
>
> --
> 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/-/FgXO0M3-_eMJ.
> 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.
>
>
>  --
> 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.
>

-- 
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.

Reply via email to