java.lang.NoClassDefFoundError错误解决

程序运行就报

java.lang.NoClassDefFoundError

这个错,但工程里是有相应的类的,也没有地方写错了,

最后本地打开工程文件时发现没有对应的文件,是没有编译到,

解决办法是project->clean一下工程,然后project->build all ,如果勾选了build automatically就会自动编译。

最后,再去本地路径里看,对应的文件有了,就可以了。

发布了6 篇原创文章 · 获赞 2 · 访问量 4万+
展开阅读全文

java.lang.NoClassDefFoundError怎么处理?

05-07

``` Servlet.service() for servlet [dispatcher] in context with path [/platform] threw exception [Filtered request failed.] with root cause java.lang.NoClassDefFoundError: Could not initialize class com.platform.cache.J2CacheUtils at com.platform.shiro.CluterShiroSessionDao.setShiroSession(CluterShiroSessionDao.java:57) at com.platform.shiro.CluterShiroSessionDao.doCreate(CluterShiroSessionDao.java:23) at org.apache.shiro.session.mgt.eis.AbstractSessionDAO.create(AbstractSessionDAO.java:116) at org.apache.shiro.session.mgt.eis.CachingSessionDAO.create(CachingSessionDAO.java:184) at org.apache.shiro.session.mgt.DefaultSessionManager.create(DefaultSessionManager.java:177) at org.apache.shiro.session.mgt.DefaultSessionManager.doCreateSession(DefaultSessionManager.java:158) at org.apache.shiro.session.mgt.AbstractValidatingSessionManager.createSession(AbstractValidatingSessionManager.java:136) at org.apache.shiro.session.mgt.AbstractNativeSessionManager.start(AbstractNativeSessionManager.java:99) at org.apache.shiro.mgt.SessionsSecurityManager.start(SessionsSecurityManager.java:152) at org.apache.shiro.subject.support.DelegatingSubject.getSession(DelegatingSubject.java:336) at org.apache.shiro.subject.support.DelegatingSubject.getSession(DelegatingSubject.java:312) at org.apache.shiro.web.util.WebUtils.saveRequest(WebUtils.java:607) at org.apache.shiro.web.filter.AccessControlFilter.saveRequest(AccessControlFilter.java:208) at org.apache.shiro.web.filter.AccessControlFilter.saveRequestAndRedirectToLogin(AccessControlFilter.java:191) at org.apache.shiro.web.filter.authc.FormAuthenticationFilter.onAccessDenied(FormAuthenticationFilter.java:168) at org.apache.shiro.web.filter.AccessControlFilter.onAccessDenied(AccessControlFilter.java:133) at org.apache.shiro.web.filter.AccessControlFilter.onPreHandle(AccessControlFilter.java:162) at org.apache.shiro.web.filter.PathMatchingFilter.isFilterChainContinued(PathMatchingFilter.java:203) at org.apache.shiro.web.filter.PathMatchingFilter.preHandle(PathMatchingFilter.java:178) at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:131) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748) ``` 问答

部署到服务器java.lang.NoClassDefFoundError

02-23

服务器环境:centos、tomcat8、openjdk1.8 本地环境:window、tomcat8、jdk1.8 本地部署没有问题,放到服务器报java.lang.NoClassDefFoundError。 项目之间没有干扰,我把其他项目都删掉了,只有这一个 下面是报错日志 spring报错,不能生成CommonProperties这个bean,因为没有这个ComonProperties类的定义 可是这个类是我自己写的,不存在包冲突或者包缺失的问题 求大大救救 ``` 23-Feb-2017 10:45:19.871 SEVERE [localhost-startStop-1] org.springframework.web.context.ContextLoader.initWebApplicationContext Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'commonProperties' defined in file [/usr/local/tomcat/tomcat8.0/webapps/zhongxi/WEB-INF/classes/com/zswlib/zhongxi/common/CommonProperties.class]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class com.zswlib.zhongxi.common.CommonProperties at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1105) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1050) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4851) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1092) at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1834) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.zswlib.zhongxi.common.CommonProperties at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1098) ... 26 more ``` 问答

求问java.lang.NoClassDefFoundError是什么原因

08-15

求大神帮助!!! 我从别的项目搞过来jar包,放到项目WEB-INF/lib文件夹下后,运行报异常 严重: Servlet.service() for servlet [ResouceServlet] in context with path [/test] threw exception [Servlet execution threw an exception] with root cause java.lang.NoClassDefFoundError: Could not initialize class com.tt.report.core.prosess.ProsessFactory at com.tt.report.ResouceServlet.doGet(ResouceServlet.java:75) at javax.servlet.http.HttpServlet.service(HttpServlet.java:624) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) 其中ProsessFactory类的代码 public class ProsessFactory { public static Map<String, Prosess> prosessFactory = new HashMap(); public static Prosess defaultProsess = new DefaultProsess(); static { prosessFactory.put("createImage", new CreateImageProess()); prosessFactory.put("read", new ReadProsess()); prosessFactory.put("write", new WriteProsess()); prosessFactory.put("page", new WriteProsess()); prosessFactory.put("write_content", new WriteContentProsess()); prosessFactory.put("page_content", new WriteContentProsess()); prosessFactory.put("write_verify", new WriteVerifyProsess()); prosessFactory.put("write_writeContent", new WriteWriteContentProsess()); prosessFactory.put("closesessionid", new CloseSessionProsess()); prosessFactory.put("resource", new ResourceProsess()); prosessFactory.put("widget", new WidgetProsess()); prosessFactory.put("write_cal_cell", new WriteCalCellProsess()); prosessFactory.put("paint", new PaintProsess()); prosessFactory.put("paint_page", new PaintPageProsess()); prosessFactory.put("fr_dialog", new dialogParametersProsess()); prosessFactory.put("readReportTpl", new ReadReortTplProsess()); prosessFactory.put("writeReortTpl", new WriteReortTplProsess()); prosessFactory.put("rometReport", new RometReportProcess()); prosessFactory.put("emb", new EmbResourceService()); prosessFactory.put("export", new ExportService()); prosessFactory.put("heartbeat", new HeartBeatService()); prosessFactory.put("reset_H_W", new ReSetCellWHProsess()); prosessFactory.put("showtest", new TestShowSessionProsess()); prosessFactory.put("writecontentcache", new WriteContentCacheProsess()); prosessFactory.put("fr_write", new AppendOrDeleteProsess()); } public static Prosess getProsess(String op) { if (op == null) { op = "page"; } return (Prosess)prosessFactory.get(op); } } 不知是什么原因? 先谢谢,万分感谢了 问答

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览