2012-09-21 79 views
0

我一直從glassfish收到此錯誤消息。我正在netbeans上進行聊天。 我試過谷歌和大多數的解決方案是設置類路徑。但它並沒有解決我的問題:(我的朋友設法他的系統雖然java.lang.NoClassDefFoundError:java/util/Objects

我使用Log4j和primefaces上運行。

WARNING: java.lang.NoClassDefFoundError: java/util/Objects 
javax.el.ELException: java.lang.NoClassDefFoundError: java/util/Objects 
    at com.sun.el.parser.AstValue.invoke(AstValue.java:258) 
    at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:302) 
    at org.primefaces.component.behavior.ajax.AjaxBehaviorListenerImpl.processAjaxBehavior(AjaxBehaviorListenerImpl.java:47) 
    at org.primefaces.event.SelectEvent.processListener(SelectEvent.java:40) 
    at javax.faces.component.behavior.BehaviorBase.broadcast(BehaviorBase.java:106) 
    at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:760) 
    at org.primefaces.component.autocomplete.AutoComplete.broadcast(AutoComplete.java:334) 
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794) 
    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259) 
    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) 
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) 
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) 
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) 
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1542) 
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281) 
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) 
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655) 
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595) 
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161) 
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331) 
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231) 
    at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317) 
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195) 
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849) 
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746) 
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045) 
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228) 
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137) 
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) 
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) 
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79) 
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54) 
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59) 
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71) 
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532) 
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513) 
    at java.lang.Thread.run(Thread.java:662) 
Caused by: java.lang.NoClassDefFoundError: java/util/Objects 
    at entity.pojo.SimpleUser.hashCode(SimpleUser.java:132) 
    at java.lang.Object.toString(Object.java:219) 
    at java.lang.String.valueOf(String.java:2826) 
    at java.lang.StringBuilder.append(StringBuilder.java:115) 
    at managedbean.chat.ChatBean.changeUser(ChatBean.java:319) 
    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 com.sun.el.parser.AstValue.invoke(AstValue.java:254) 
    ... 36 more 
Caused by: java.lang.ClassNotFoundException: java.util.Objects 
    at com.sun.enterprise.loader.ASURLClassLoader.findClassData(ASURLClassLoader.java:808) 
    at com.sun.enterprise.loader.ASURLClassLoader.findClass(ASURLClassLoader.java:696) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248) 
    ... 46 more 

回答

1

你可能使用Java 7的Objects.hash()方法來實現hashCode()SimpleUser類,並在不包含此類的Java 6 VM上運行此類。