daemon mode requires HttpServletRequest?

15 views
Skip to first unread message

Brad Larson

unread,
Sep 17, 2009, 1:05:35 PM9/17/09
to Repo and Gerrit Discussion
This is in response to http://groups.google.com/group/repo-discuss/browse_thread/thread/f03b79b352012142#,
but I can't reply there for some reason. Does reply only work on more
recent posts?

With current code, if I run 'java -jar gerrit.war daemon', it
complains about not finding javax.servlet.http.HttpServletRequest. I
can work on adding this class to my classpath... but should it be
needed? This sounds like a bug to me - I don't think the daemon
should need HTTP servlet request support.

Full error:

$ sudo -u gerrit java -jar gerrit.war daemon
Exception in thread "main" java.lang.reflect.InvocationTargetException
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 ExecutableWarMain.runMain(ExecutableWarMain.java:167)
at ExecutableWarMain.main(ExecutableWarMain.java:66)
Caused by: com.google.inject.internal.ComputationException:
com.google.inject.internal.ComputationException:
java.lang.TypeNotPresentException: Type
javax.servlet.http.HttpServletRequest not present
at com.google.inject.internal.MapMaker$StrategyImpl.compute
(MapMaker.java:553)
at com.google.inject.internal.MapMaker$StrategyImpl.compute
(MapMaker.java:419)
at com.google.inject.internal.CustomConcurrentHashMap
$ComputingImpl.get(CustomConcurrentHashMap.java:2041)
at com.google.inject.internal.FailableCache.get(FailableCache.java:
46)
at com.google.inject.ConstructorInjectorStore.get
(ConstructorInjectorStore.java:52)
at com.google.inject.ConstructorBindingImpl.initialize
(ConstructorBindingImpl.java:57)
at com.google.inject.InjectorImpl.initializeBinding(InjectorImpl.java:
377)
at com.google.inject.BindingProcessor$1$1.run(BindingProcessor.java:
169)
at com.google.inject.BindingProcessor.initializeBindings
(BindingProcessor.java:224)
at com.google.inject.InjectorBuilder.initializeStatically
(InjectorBuilder.java:120)
at com.google.inject.InjectorBuilder.build(InjectorBuilder.java:105)
at com.google.inject.InjectorImpl.createChildInjector
(InjectorImpl.java:144)
at com.google.gerrit.server.config.GerritGlobalModule.createInjector
(GerritGlobalModule.java:87)
at com.google.gerrit.server.config.GerritGlobalModule.createInjector
(GerritGlobalModule.java:79)
at com.google.gerrit.pgm.Daemon.run(Daemon.java:33)
at com.google.gerrit.pgm.AbstractProgram.main(AbstractProgram.java:
70)
... 6 more
Caused by: com.google.inject.internal.ComputationException:
java.lang.TypeNotPresentException: Type
javax.servlet.http.HttpServletRequest not present
at com.google.inject.internal.MapMaker$StrategyImpl.compute
(MapMaker.java:553)
at com.google.inject.internal.MapMaker$StrategyImpl.compute
(MapMaker.java:419)
at com.google.inject.internal.CustomConcurrentHashMap
$ComputingImpl.get(CustomConcurrentHashMap.java:2041)
at com.google.inject.internal.FailableCache.get(FailableCache.java:
46)
at com.google.inject.MembersInjectorStore.get
(MembersInjectorStore.java:66)
at com.google.inject.ConstructorInjectorStore.createConstructor
(ConstructorInjectorStore.java:69)
at com.google.inject.ConstructorInjectorStore.access$000
(ConstructorInjectorStore.java:31)
at com.google.inject.ConstructorInjectorStore$1.create
(ConstructorInjectorStore.java:39)
at com.google.inject.ConstructorInjectorStore$1.create
(ConstructorInjectorStore.java:35)
at com.google.inject.internal.FailableCache$1.apply
(FailableCache.java:35)
at com.google.inject.internal.MapMaker$StrategyImpl.compute
(MapMaker.java:549)
... 21 more
Caused by: java.lang.TypeNotPresentException: Type
javax.servlet.http.HttpServletRequest not present
at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType
(CoreReflectionFactory.java:98)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature
(Reifier.java:107)
at sun.reflect.generics.tree.ClassTypeSignature.accept
(ClassTypeSignature.java:31)
at sun.reflect.generics.visitor.Reifier.reifyTypeArguments
(Reifier.java:50)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature
(Reifier.java:120)
at sun.reflect.generics.tree.ClassTypeSignature.accept
(ClassTypeSignature.java:31)
at
sun.reflect.generics.repository.ConstructorRepository.getParameterTypes
(ConstructorRepository.java:76)
at java.lang.reflect.Method.getGenericParameterTypes(Method.java:282)
at com.google.inject.TypeLiteral.getParameterTypes(TypeLiteral.java:
291)
at com.google.inject.spi.InjectionPoint.forMember(InjectionPoint.java:
110)
at com.google.inject.spi.InjectionPoint.<init>(InjectionPoint.java:
72)
at com.google.inject.spi.InjectionPoint$Factory$2.create
(InjectionPoint.java:399)
at com.google.inject.spi.InjectionPoint$Factory$2.create
(InjectionPoint.java:393)
at com.google.inject.spi.InjectionPoint.addInjectorsForMembers
(InjectionPoint.java:370)
at com.google.inject.spi.InjectionPoint.addInjectionPoints
(InjectionPoint.java:353)
at com.google.inject.spi.InjectionPoint.forInstanceMethodsAndFields
(InjectionPoint.java:296)
at com.google.inject.MembersInjectorStore.createWithListeners
(MembersInjectorStore.java:78)
at com.google.inject.MembersInjectorStore.access$000
(MembersInjectorStore.java:35)
at com.google.inject.MembersInjectorStore$1.create
(MembersInjectorStore.java:43)
at com.google.inject.MembersInjectorStore$1.create
(MembersInjectorStore.java:40)
at com.google.inject.internal.FailableCache$1.apply
(FailableCache.java:35)
at com.google.inject.internal.MapMaker$StrategyImpl.compute
(MapMaker.java:549)
... 31 more
Caused by: java.lang.ClassNotFoundException:
javax.servlet.http.HttpServletRequest
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType
(CoreReflectionFactory.java:95)
... 52 more

Shawn Pearce

unread,
Sep 18, 2009, 4:44:21 PM9/18/09
to repo-d...@googlegroups.com
On Thu, Sep 17, 2009 at 10:05, Brad Larson <bkla...@gmail.com> wrote:
>
> This is in response to http://groups.google.com/group/repo-discuss/browse_thread/thread/f03b79b352012142#,
> but I can't reply there for some reason.  Does reply only work on more
> recent posts?

Freaking weird. I guess groups doesn't like bringing something back
from the dead? I think you could have worked around it by clicking
"More options" over on the right near the date, then "Show original",
and finally "Show only message text" to get a plaintext version that
you can slap a new mbox "From" header onto, toss it into an mbox, and
then replied to it from that mbox. With the same subject and the
proper In-Reply-To set for that Message-Id, it would pick up the
message again.

Yes, its annoying. Maybe I should be a good Googler and go find that
code and submit a patch to the team to allow reply to ancient message.
I don't understand why they wouldn't support that feature, it seems
like a basic useful thing to do. *sigh*

> With current code, if I run 'java -jar gerrit.war daemon', it
> complains about not finding javax.servlet.http.HttpServletRequest.  I
> can work on adding this class to my classpath... but should it be
> needed?  This sounds like a bug to me - I don't think the daemon
> should need HTTP servlet request support.

Frell. Yes, that's a bug. That bug must have crept in while I was
injecting Guice into the code base. I did not intend for this to be a
dependency. My testing failed to run the daemon in an environment
without the servlet code in the test harness classpath. I blame Maven
for setting up the project classpath in Eclipse with dependencies that
aren't always there.

Actually, we probably need to split the Gerrit code base into a couple
of different Maven projects, one of which contains this daemon code
but doesn't contain the HttpServletRequest. That way we can be more
certain that if the daemon code compiles, it compiles without the web
container environment, and thus won't demand it at runtime by mistake.

Looking at the stack trace you posted, this looks like its ugly to
debug too. It should be fixed. Yes, you can work around it by
tossing in the servlet API, but you should not need this, and its
really not desired.

Filed as http://jira.source.android.com/jira/browse/GERRIT-281

Reply all
Reply to author
Forward
0 new messages