Are you sure you have done all the basic cleanups? Like rebuild, flush your
output dir, ensuring the jars are actually copied over, etc.?

WP1 used to have a hard dep on the guice cglib repack, but it looks like
your problem is from a missing class that's in guice2. So I would guess
something weird is going on with the classpath (or Issue 343 as mculls
suggests).

Dhanji.

On Thu, Sep 10, 2009 at 1:35 PM, Josh McDonald <[email protected]>wrote:

> OK, thanks heaps for the pointers guys. I'll go through my stuff and double
> check no package-protected classes are being injected into, and so on. Some
> of those links I read but wasn't sure they applied to me as I'm not using
> OSGI, and I'm deploying into TC6. I did come across the @Provides
> initContext solution but it didn't help in my situation.
>
> Jesse if you're reading, is the 343 patch already in trunk? Since I've got
> to check out the source and build it myself to apply a patch either way, I
> might as well try using trunk and see how it goes.
>
> Also wondering if there's some noisy debug logging I can enable that will
> help me diagnose *which* of my classes are causing the problems in future? I
> hate not being able to solve my own damned mess :)
>
> -Josh
>
> 2009/9/10 Stuart McCulloch <[email protected]>
>
> 2009/9/9 Jean-Eudes COUIGNOUX <[email protected]>
>>
>>> Hi,
>>>
>>> I've the same issue in a previous thread.
>>>
>>>
>>> http://groups.google.com/group/google-guice/browse_thread/thread/462c77c6b07246bd
>>>
>>> My problem were the line
>>> bind(Context.class).to(InitialContext.class);
>>>
>>> I replace this by
>>>
>>> @Provides
>>>     public Context initContext() {
>>>         try {
>>>             return new InitialContext();
>>>         } catch (NamingException e) {
>>>             throw new RuntimeException("Unable to initialize
>>> context.",e);
>>>         }
>>>     }
>>>
>>
>> I think patch 343 would also fix it (and let you keep the original code)
>> because InitialContext comes from the system/container classloader
>> which is the situation that 343 addresses.
>>
>> but if you can't use a patched build that's one way to workaround it...
>>
>>
>>> 2009/9/9 Stuart McCulloch <[email protected]>
>>>
>>>> 2009/9/9 Josh McDonald <[email protected]>
>>>>
>>>>> Hey guys,
>>>>>
>>>>> I've recently upgraded an app from Guice 1.0, and I'm getting a
>>>>> ClassNotFoundException: com.google.inject.internal.cglib.reflect.FastClass
>>>>> which makes no sense, as 
>>>>> com.google.inject.internal.cglib.reflect.FastClass
>>>>> is in guice-2.0.jar :-/
>>>>>
>>>>> Any ideas? I've been pulling my hair out for hours :-/
>>>>>
>>>>
>>>> you might want to see if it works with the following patch:
>>>>
>>>>    http://code.google.com/p/google-guice/issues/detail?id=343
>>>>
>>>> for background about the classloading situation see:
>>>>
>>>>    http://code.google.com/p/google-guice/wiki/ClassLoading
>>>>    http://code.google.com/p/google-guice/wiki/OSGi
>>>>
>>>> HTH
>>>>
>>>>
>>>>> Code:
>>>>>
>>>>> public class Bootstrapper extends GuiceServletContextListener {
>>>>>
>>>>>     public static Injector applicationInjector;
>>>>>
>>>>>     @Override
>>>>>     protected Injector getInjector() {
>>>>>
>>>>>         Injector injector = Guice.createInjector(
>>>>>
>>>>>                 PersistenceService.usingJpa()
>>>>>                         .across(UnitOfWork.TRANSACTION)
>>>>>                         .addAccessor(LoginUserFinder.class)
>>>>>                         .addAccessor(PlayerFinder.class)
>>>>>                         .addAccessor(AgentFinder.class)
>>>>>                         .addAccessor(CoachFinder.class)
>>>>>                         .addAccessor(MembershipFinder.class)
>>>>>                         .buildModule(),
>>>>>
>>>>>                 FlexModule.buildModule(),
>>>>>
>>>>>                 new ServletModule() {
>>>>>
>>>>>                     @Override
>>>>>                     protected void configureServlets() {
>>>>>
>>>>>                         serve("/upload").with(UploadServlet.class,
>>>>> processWith(EntityImageProcessor.class));
>>>>>
>>>>> serve("/download/*").with(DownloadServlet.class);
>>>>>
>>>>> serve("/incoming/*").with(IncomingVideoServlet.class);
>>>>>                     }
>>>>>                 },
>>>>>
>>>>>                 BasketballExpressionsModule.buildModule());
>>>>>
>>>>>         //Kick start JPA.
>>>>>         injector.getInstance(PersistenceInitializer.class).start();
>>>>>
>>>>>         applicationInjector = injector;
>>>>>
>>>>>         return injector;
>>>>>     }
>>>>>
>>>>>     private Map<String, String> processWith(Class<? extends
>>>>> UploadProcessor> processorClass) {
>>>>>
>>>>>         Map<String, String> params = new HashMap<String, String>();
>>>>>         params.put("processorClass", processorClass.getName());
>>>>>
>>>>>         return params;
>>>>>     }
>>>>> }
>>>>>
>>>>> // -------------------------------------------------------------------
>>>>>
>>>>> public class BasketballExpressionsModule extends AbstractModule {
>>>>>
>>>>>     public void configure() {
>>>>>
>>>>>
>>>>> bindConstant().annotatedWith(JpaUnit.class).to("BasketballExpressionsPU");
>>>>>         bind(Context.class).to(InitialContext.class);
>>>>>
>>>>> bind(String.class).annotatedWith(Names.named("uploadFileLocation")).toProvider(JndiIntegration.fromJndi(String.class,
>>>>> "java:comp/env/basketballExpressions/uploadFileLocation"));
>>>>>
>>>>> bind(String.class).annotatedWith(Names.named("incomingVideoLocation")).toProvider(JndiIntegration.fromJndi(String.class,
>>>>> "java:comp/env/basketballExpressions/incomingVideoLocation"));
>>>>>     }
>>>>>
>>>>>     public static BasketballExpressionsModule buildModule() {
>>>>>         return new BasketballExpressionsModule();
>>>>>     }
>>>>> }
>>>>>
>>>>> --
>>>>> "Therefore, send not to know For whom the bell tolls. It tolls for
>>>>> thee."
>>>>>
>>>>> Josh 'G-Funk' McDonald
>>>>>   -  [email protected]
>>>>>   -  http://twitter.com/sophistifunk
>>>>>   -  http://flex.joshmcdonald.info/
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Cheers, Stuart
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>> --
>> Cheers, Stuart
>>
>>
>>
>
>
> --
> "Therefore, send not to know For whom the bell tolls. It tolls for thee."
>
> Josh 'G-Funk' McDonald
>   -  [email protected]
>   -  http://twitter.com/sophistifunk
>   -  http://flex.joshmcdonald.info/
>
>
> >
>

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