我正在尝试Gitblit,这对于 Git 来说似乎是一个相当不错的 web-UI。通过 war 文件进行安装非常简单,而且开箱即用。但是,我遇到了一个奇怪的问题。
我正在共享一个具有标准文件夹结构的 Maven 项目
project
pom.xml
src
src/test-file.txt (I added this file to verify the issue)
src/java
src/java/main
src/java/main/package
src/java/main/package/File.java
只要我尝试导航第一级(so, pom.xml
and src
)一切都很好,我可以正确打开和读取文件。但是,当我尝试打开java
下的文件夹src
时,链接会呈现为localhost:8080/gitblit/tree/project/commit-id/src%2Fjava
并且我会看到一个白页。请求不会转发到服务器(如果有帮助的话,tomcat 7.0.32),firebug 只是告诉我Error 400: Bad Request
。
这%2F
看起来很奇怪,所以我手动尝试修复 中的链接localhost:8080/gitblit/tree/project/commit-id/src/java
,但随后生成了内部服务器错误。看着日志,我读到
INFO Found more URL path parts then expected, these will be ignored. Url: 'http://localhost:8080/gitblit/tree/project/commit-id/src/java', mountpath: 'blob', urlPath: 'project/commit-id/src/java', expected 3 parameters was 4
然后,我添加了test-file.txt
. 如果我导航到src
并尝试打开test-file.txt
,首先链接会尝试打开localhost:8080/gitblit/blob/project/commit-id/src%2Ftest-file.txt
,显示一个 html 页面,说明找不到文件。如果我尝试与以前相同的技巧(%2F
to /
),那么我会收到此异常:
INFO Found more URL path parts then expected, these will be ignored. Url: 'http://localhost:8080/gitblit/blob/project/commit-id/src/test-file.txt', mountpath: 'blob', urlPath: 'project/commit-id/src/test-file.txt', expected 3 parameters was 4
ERROR /path/to/project/.git cant find {1} in tree {2}
org.eclipse.jgit.errors.IncorrectObjectTypeException: Object commit-id is not a blob.
at org.eclipse.jgit.storage.file.WindowCursor.open(WindowCursor.java:130)
at org.eclipse.jgit.lib.ObjectDatabase.open(ObjectDatabase.java:176)
at org.eclipse.jgit.lib.Repository.open(Repository.java:278)
at com.gitblit.utils.JGitUtils.getByteContent(JGitUtils.java:563)
at com.gitblit.utils.JGitUtils.getStringContent(JGitUtils.java:596)
at com.gitblit.wicket.pages.BlobPage.<init>(BlobPage.java:133)
at sun.reflect.GeneratedConstructorAccessor22.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.apache.wicket.session.DefaultPageFactory.createPage(DefaultPageFactory.java:188)
at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:89)
at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.newPage(BookmarkablePageRequestTarget.java:305)
at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.getPage(BookmarkablePageRequestTarget.java:320)
at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents(BookmarkablePageRequestTarget.java:234)
at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1279)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1358)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1465)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:319)
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:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
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:1004)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
ERROR Can't instantiate page using constructor public com.gitblit.wicket.pages.BlobPage(org.apache.wicket.PageParameters) and argument r = "project" h = "commit-id" f = "src"
org.apache.wicket.WicketRuntimeException: Can't instantiate page using constructor public com.gitblit.wicket.pages.BlobPage(org.apache.wicket.PageParameters) and argument r = "project" h = "commit-id" f = "src"
at org.apache.wicket.session.DefaultPageFactory.createPage(DefaultPageFactory.java:212)
at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:89)
at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.newPage(BookmarkablePageRequestTarget.java:305)
at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.getPage(BookmarkablePageRequestTarget.java:320)
at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents(BookmarkablePageRequestTarget.java:234)
at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1279)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1358)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1465)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:319)
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:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
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:1004)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedConstructorAccessor22.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.apache.wicket.session.DefaultPageFactory.createPage(DefaultPageFactory.java:188)
... 27 more
Caused by: java.lang.NullPointerException
at com.gitblit.wicket.pages.BlobPage.generateSourceView(BlobPage.java:142)
at com.gitblit.wicket.pages.BlobPage.<init>(BlobPage.java:134)
... 31 more
我基本上没有配置 gitblit 本身(没有更改gitblit.properties
),所以我的问题可能存在于错过的配置中,但我可以弄清楚在哪里。有什么提示吗?