2013-03-21 90 views
0

我遇到了wicket,slf4j和CentOS 5.8的問題。這是我收到的StackTrace:NoSuchMethodError SLF4J CentOS 5.8

Can't instantiate page using constructor public MyCompany.backenduser.NewBackendUser() 
org.apache.wicket.WicketRuntimeException: Can't instantiate page using constructor public MyCompany.backenduser.NewBackendUser() 
    at org.apache.wicket.session.DefaultPageFactory.createPage(DefaultPageFactory.java:212) 
    at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:57) 
    at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.newPage(BookmarkablePageRequestTarget.java:298) 
    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:1250) 
    at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329) 
    at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436) 
    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.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1307) 
    at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198) 
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) 
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1307) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368) 
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109) 
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) 
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) 
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) 
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) 
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) 
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) 
    at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) 
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) 
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) 
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) 
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169) 
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237) 
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) 
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1307) 
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:453) 
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) 
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:559) 
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) 
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072) 
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382) 
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) 
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006) 
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) 
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255) 
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154) 
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) 
    at org.eclipse.jetty.server.Server.handle(Server.java:365) 
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485) 
    at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:926) 
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:988) 
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:635) 
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) 
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) 
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:627) 
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:51) 
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) 
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) 
    at java.lang.Thread.run(Thread.java:662) 
Caused by: java.lang.reflect.InvocationTargetException 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) 
    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:192) 
    ... 65 more 
Caused by: java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple; 
    at org.slf4j.impl.Log4jLoggerAdapter.warn(Log4jLoggerAdapter.java:420) 
    at org.apache.wicket.Localizer.getStringIgnoreSettings(Localizer.java:198) 
    at org.apache.wicket.Localizer.getString(Localizer.java:313) 
    at org.apache.wicket.model.StringResourceModel.getString(StringResourceModel.java:503) 
    at MyCompany.controls.PermissionsControl.<init>(PermissionsControl.java:28) 
    at MyCompany.backenduser.NewBackendUser.init(NewBackendUser.java:281) 
    at MyCompany.backenduser.NewBackendUser.<init>(NewBackendUser.java:107) 
    ... 70 more 

我只在CentOS 5.8上收到這個,在Windows上它工作的很好。我們使用maven來構建項目。我從pom.xml中排除了每個版本的slf4j與其他jar文件。

+0

你在每個環境中使用了哪些java版本? – bert 2013-03-21 11:09:23

+0

1.6 Windows上的Update 31和CentOS上的1.​​6 Update 33。 – Knerd 2013-03-21 11:10:45

回答

2

很可能您的部署環境中某處存在較舊的slf4j-log4j.jar。在Web容器的lib目錄中查找slf4j *文件,並在您的應用程序中將它們的版本檢查爲slf4j-api的版本。

+1

我們解決了這個問題,解決戰爭時的問題就是秩序。它在CentOS下比在Windows下更好 - – Knerd 2013-03-21 14:37:05