2015-09-15 52 views
0

我想在eclipse中的項目中添加一個庫,但它包含一個名爲AdamantiumMenu的$ PropertyKey類和另外兩個名稱中沒有$符號的類,但這兩個類已成功添加第一個與$。 任何人都可以建議我需要如何繼續添加所有3個類?

我這個代碼添加到的pom.xml:生成class文件時

09:52:27.961 [http-nio-8080-exec-7] ERROR f.p.s.b.e.CustomExceptionHandler - java.lang.NoClassDefFoundError: org/primefaces/adamantium/component/menu/AdamantiumMenu$PropertyKeys 
    at org.primefaces.adamantium.component.menu.AdamantiumMenu.getModel(AdamantiumMenu.java:71) 
    at org.primefaces.component.menu.BaseMenuRenderer.encodeEnd(BaseMenuRenderer.java:103) 
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:674) 
    at javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:554) 
    at javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:550) 
    at javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:550) 
    at javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:550) 
    at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.renderView(FaceletViewDeclarationLanguage.java:1891) 
    at org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:313) 
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:58) 
    at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:116) 
    at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:267) 
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:200) 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118) 
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
    at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50) 
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
    at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:125) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192) 
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160) 
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344) 
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261) 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) 
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) 
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) 
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) 
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) 
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610) 
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) 
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:516) 
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1086) 
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:659) 
    at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223) 
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1558) 
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1515) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) 
    at java.lang.Thread.run(Thread.java:745) 
Caused by: java.lang.ClassNotFoundException: org.primefaces.adamantium.component.menu.AdamantiumMenu$PropertyKeys 
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305) 
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1157) 
    ... 68 more 
+1

那麼發生了什麼事?你的庫是否在jar文件中?請注意,這些只是內部類... –

+0

是的,它是一個包含包含3個類的包的jar文件,當我執行代碼時,我收到NoClassFoundException ... AdamantiumMenu $ PropertyKey –

+0

如果您能夠顯示確切的錯誤,jar文件中的內容,代碼的樣子等等......目前沒有足夠的信息。 –

回答

-1

Java編譯器默認添加$跡象,如果:

<dependency> 
     <groupId>org.primefaces</groupId> 
     <artifactId>org.primefaces.adamantium</artifactId> 
     <version>1.0</version> 
     <scope>system</scope> 
     <systemPath>${project.basedir}/src/main/resources/adamantium-theme-1.0.jar</systemPath> 
    </dependency> 

我得到這個錯誤類包含inner classes。嘗試在$之前創建class的實例並查看它是否有效。

嘗試以下方法:

AdamantiumMenu adamantiumMenu = new AdamantiumMenu(); 
AdamantiumMenu.PropertyKey propertyKey = adamantiumMenu. new PropertyKey(); 
+1

這不是關於如何使用它 - 這是關於一個例外,由於類不是找到。 –

+0

瞭解,如果它是一個圖書館,參考將是適當的。這看起來像用戶代碼,其中用戶正嘗試使用其中包含$的類名進行實例化。可能是Spring注入或反射。 –

+1

不知道你的意思是「參考是正確的」,但我不會猜測太多,因爲我們有多少上下文。更好地從OP中找出... –

0

問題解決了,我手動添加類到文件夾,然後我添加源文件夾(在構建路徑)和I給出的文件夾的包含所有類的路徑包括內心階層。

相關問題