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