Eclipse和Android错误-NoClassDefFoundError

我有一个android应用程序一直运行的很好,直到我添加第二个外部库来创建路径的时候,它就出现了问题。自从添加了scoreninja jar,当我试图运行这个程序的时候我就得到了NoClassDefFoundError
这是报错信息

09-19 21:45:26.154: ERROR/AndroidRuntime(3654): java.lang.NoClassDefFoundError: com.scoreninja.adapter.ScoreNinjaAdapter

像所有通过android工具生成的脚本一样,我不知道除了删除和重新创建或者重启eclipse(我已经试过三次了)我还能做什么。有人知道我能怎样改正这个么?

4个回答

更新完ADT之后我也遇到了这个问题。
我把我所有的JAR文件存储在一个叫做“lib”的文件夹中,然后添加jars来创建正常的eclipse路径。一直到我更新,这个运行的都挺好。
在我更新之后,我很清楚的知道我得到了一个被包含在jar中的NoClassDefFoundError类(检查ReferencedLibraries类)。
解决方法就是把我所有的jars都从创建路径中移除,然后将我的“fib”文件夹重新命名为“libs”。这是一个小的习惯,而且似乎是新的ADT发现和在an.apk文件中包含库的方法。一旦我这样做了,所有的都好了。

你库没有正确载入
把java库放入libs文件夹后,右健导入为库
有的人这一步就够了
为了保险,这样做
1,右键工程, Build path, java build path,
2,选择libraries在右边的按钮中点击“Add Library”
3,选择“User library”,点击“下一步”
4,点击“User librarys”按钮在出现的界面中点击“New..”按钮
在弹出的界面中随便起一个名字,点击“确定”
5,点击“Add jars”按钮选择第三方jar包

通过向你创建的路径中添加额外的jar,仅仅是向你的包中添加jar,但是在运行的时候仍然是不能用的。
为了在运行的时候jar可以使用,你需要:

  • 把jar放在你assets的文件夹下
  • 在你创建的路径中,包含这个jar的副本
  • 在同样的弹出框中打开导出选项卡
  • 根据最新添加的jar,检查这个包

我在MapActivity中碰到了这个问题。在Eclipse中,在调试程序中创建的时候得到了NoClassDefFound。
忘记将库添加到manifest中了,在... 要素中。

<uses-library android:name="com.google.android.maps" />"
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
NoClassDefFoundError错误
//在解释运行程序时发生了一个奇怪的错误----// NoClassDefFoundErrorrn// 请专家们帮我看看 rn/**rn MyColorSliderTest.javarn @author GeHaimingrn @version 2007-04-30rn*/rnrnimport javax.swing.*;rnimport javax.swing.event.*;rnimport java.awt.*;rnimport java.awt.event.*;rnrnpublic class MyColorSliderTestrnrn public static void main(String[] args)rn rn MyColorSliderFrame frame=new MyColorSliderFrame();rn frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);rn frame.setVisible(true);rn rnrnrn/**rn MyColorSliderFramern*/rnclass MyColorSliderFrame extends JFramernrn public MyColorSliderFrame()rn rn setTitle("My Color Slider Test");rn setSize(DEFAULT_WIDTH,DEFAULT_HEIGHT);rn rn //初始化暂存颜色的变量rn red=green=blue=256/2;rn rn //sliderPanelrn sliderPanel=new JPanel();rn sliderPanel.setLayout(new GridLayout(3,1));rn rn //事件监听器rn listener=new ChangeListener()rn rn public void stateChanged(ChangeEvent event)rn rn JSlider slider=(JSlider)event.getSource();rn int value=slider.getValue();rn rn //这种算法,我并不是很认同,但又找不到时别的方法了rn if(value!=red)rn rn red=value;rn demoPanel.setBackground(new Color(value,green,blue));rn rn elsern rn if(value!=green)rn rn green=value;rn demoPanel.setBackground(new Color(red,value,blue));rn rn elsern rn blue=value;rn demoPanel.setBackground(new Color(red,green,value));rn rn rn rn ;rn rn //redSliderrn JSlider redSlider=new JSlider(0,256,1);rn addSlider(redSlider,"red");rn rn //greenSliderrn JSlider greenSlider=new JSlider(0,256,1);rn addSlider(greenSlider,"green");rn rn //blueSliderrn JSlider blueSlider=new JSlider(0,256,1);rn addSlider(blueSlider,"blue");rn rn rn //添加Sliderrn public void addSlider(JSlider s,String description)rn rn s.addChangeListener(listener);rn JPanel panel=new JPanel();rn panel.add(s);rn panel.add(new JLabel(description));rn sliderPanel.add(panel);rn rn rn private JPanel demoPanel;rn private JPanel sliderPanel;rn private ChangeListener listener;rn private int red,green,blue;rn rn public static final int DEFAULT_WIDTH=400;rn public static final int DEFAULT_HEIGHT=400;rn rnrn
springboot 偶发性的NoClassDefFoundError错误
几天前线上环境springboot出现了NoClassDefFoundError错误,重启之后就没有问题了,请问这种问题的出现,是打包问题吗?rnrn```rn2019-04-16 17:06:04,641 ERROR [https-jsse-nio-10089-exec-2] c.n.m.a.GlobalExceptionHandler [GlobalExceptionHandler.java : 58] 错误信息: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: org/apache/ibatis/reflection/ExceptionUtilrnorg.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: org/apache/ibatis/reflection/ExceptionUtilrn at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:982)rn at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)rn at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)rn at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)rn at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)rn at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)rn at com.nes.mtpf.filter.RecordIpFilter.doFilter(RecordIpFilter.java:48)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)rn at com.nes.mtpf.filter.HttpRequestMethodFilter.doFilter(HttpRequestMethodFilter.java:29)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)rn at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)rn at com.nes.mtpf.filter.CorsResponseFilter.doFilter(CorsResponseFilter.java:27)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)rn at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)rn at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)rn at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)rn at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:108)rn at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)rn at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)rn at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)rn at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)rn at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)rn at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)rn at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)rn at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)rn at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)rn at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)rn at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)rn at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)rn at java.lang.Thread.run(Thread.java:748)rnCaused by: java.lang.NoClassDefFoundError: org/apache/ibatis/reflection/ExceptionUtilrn at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)rn at com.sun.proxy.$Proxy83.insert(Unknown Source)rn at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:278)rn at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:58)rn at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)rn at com.sun.proxy.$Proxy109.insertSelective(Unknown Source)rn at com.nes.mtpf.service.impl.ArticleInfoServiceImpl.addNewInfo(ArticleInfoServiceImpl.java:58)rn at com.nes.mtpf.controller.ArticleInfoController.addNewInfo(ArticleInfoController.java:48)rn at sun.reflect.GeneratedMethodAccessor817.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:498)rn at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)rn at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)rn at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)rn at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)rn at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)rn at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)rn at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)rn ... 58 common frames omittedrn2019-04-16 17:06:13,863 ERROR [https-jsse-nio-10089-exec-7] c.n.m.a.GlobalExceptionHandler [GlobalExceptionHandler.java : 58] 错误信息: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: org/apache/ibatis/reflection/ExceptionUtilrnorg.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: org/apache/ibatis/reflection/ExceptionUtilrn at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:982)rn at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)rn at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)rn at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)rn at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)rn at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)rn at com.nes.mtpf.filter.RecordIpFilter.doFilter(RecordIpFilter.java:48)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)rn at com.nes.mtpf.filter.HttpRequestMethodFilter.doFilter(HttpRequestMethodFilter.java:29)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)rn at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)rn at com.nes.mtpf.filter.CorsResponseFilter.doFilter(CorsResponseFilter.java:27)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)rn at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)rn at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)rn at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)rn at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:108)rn at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)rn at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)rn at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)rn at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)rn at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)rn at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)rn at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)rn at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)rn at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)rn at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)rn at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)rn at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)rn at java.lang.Thread.run(Thread.java:748)rnCaused by: java.lang.NoClassDefFoundError: org/apache/ibatis/reflection/ExceptionUtilrn at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)rn at com.sun.proxy.$Proxy83.insert(Unknown Source)rn at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:278)rn at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:58)rn at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)rn at com.sun.proxy.$Proxy109.insertSelective(Unknown Source)rn at com.nes.mtpf.service.impl.ArticleInfoServiceImpl.addNewInfo(ArticleInfoServiceImpl.java:58)rn at com.nes.mtpf.controller.ArticleInfoController.addNewInfo(ArticleInfoController.java:48)rn at sun.reflect.GeneratedMethodAccessor817.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:498)rn at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)rn at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)rn at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)rn at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)rn at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)rn at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)rn at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)rn ... 58 common frames omittedrn2019-04-16 17:06:15,047 ERROR [http-nio-10088-exec-5] o.a.coyote.http11.Http11Processor [DirectJDKLog.java : 182] Error processing requestrnjava.lang.NoClassDefFoundError: org/apache/tomcat/util/http/parser/Cookiern at org.apache.tomcat.util.http.Rfc6265CookieProcessor.parseCookieHeader(Rfc6265CookieProcessor.java:90)rn at org.apache.catalina.connector.Request.parseCookies(Request.java:3104)rn at org.apache.catalina.connector.Request.getServerCookies(Request.java:2174)rn at org.apache.catalina.connector.CoyoteAdapter.parseSessionCookiesId(CoyoteAdapter.java:1007)rn at org.apache.catalina.connector.CoyoteAdapter.postParseRequest(CoyoteAdapter.java:714)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336)rn at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)rn at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)rn at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)rn at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)rn at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)rn at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)rn at java.lang.Thread.run(Thread.java:748)rnCaused by: java.lang.ClassNotFoundException: org.apache.tomcat.util.http.parser.Cookiern at java.net.URLClassLoader.findClass(URLClassLoader.java:382)rn at java.lang.ClassLoader.loadClass(ClassLoader.java:424)rn at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:94)rn at java.lang.ClassLoader.loadClass(ClassLoader.java:357)rn ... 15 common frames omittedrn2019-04-16 17:06:45,028 ERROR [http-nio-10088-exec-6] o.a.coyote.http11.Http11Processor [DirectJDKLog.java : 182] Error processing requestrnjava.lang.NoClassDefFoundError: org/apache/tomcat/util/http/parser/Cookiern at org.apache.tomcat.util.http.Rfc6265CookieProcessor.parseCookieHeader(Rfc6265CookieProcessor.java:90)rn at org.apache.catalina.connector.Request.parseCookies(Request.java:3104)rn at org.apache.catalina.connector.Request.getServerCookies(Request.java:2174)rn at org.apache.catalina.connector.CoyoteAdapter.parseSessionCookiesId(CoyoteAdapter.java:1007)rn at org.apache.catalina.connector.CoyoteAdapter.postParseRequest(CoyoteAdapter.java:714)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336)rn at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)rn at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)rn at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)rn at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)rn at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)rn at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)rn at java.lang.Thread.run(Thread.java:748)rn2019-04-16 17:06:51,852 ERROR [http-nio-10088-exec-9] o.a.coyote.http11.Http11Processor [DirectJDKLog.java : 182] Error processing requestrnjava.lang.NoClassDefFoundError: org/apache/tomcat/util/http/parser/Cookiern at org.apache.tomcat.util.http.Rfc6265CookieProcessor.parseCookieHeader(Rfc6265CookieProcessor.java:90)rn at org.apache.catalina.connector.Request.parseCookies(Request.java:3104)rn at org.apache.catalina.connector.Request.getServerCookies(Request.java:2174)rn at org.apache.catalina.connector.CoyoteAdapter.parseSessionCookiesId(CoyoteAdapter.java:1007)rn at org.apache.catalina.connector.CoyoteAdapter.postParseRequest(CoyoteAdapter.java:714)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336)rn at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)rn at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)rn at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)rn at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)rn at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)rn at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)rn at java.lang.Thread.run(Thread.java:748)rn2019-04-16 17:07:00,001 ERROR [pool-2-thread-1] o.s.s.s.TaskUtils$LoggingErrorHandler [TaskUtils.java : 95] Unexpected error occurred in scheduled task.rnjava.lang.NoClassDefFoundError: org/apache/ibatis/reflection/ExceptionUtilrn at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)rn at com.sun.proxy.$Proxy83.selectList(Unknown Source)rn at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:230)rn at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:139)rn at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:76)rn at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)rn at com.sun.proxy.$Proxy92.getOffTimingTask(Unknown Source)rn at com.nes.mtpf.service.impl.EquipmentTimeWorkInfoServiceImpl.handleTimingTask(EquipmentTimeWorkInfoServiceImpl.java:126)rn at sun.reflect.GeneratedMethodAccessor248.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:498)rn at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)rn at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)rn at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)rn at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)rn at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)rn at com.sun.proxy.$Proxy100.handleTimingTask(Unknown Source)rn at com.nes.mtpf.AppStart.handleTimingTask(AppStart.java:148)rn at sun.reflect.GeneratedMethodAccessor247.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:498)rn at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:65)rn at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)rn at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)rn at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)rn at java.util.concurrent.FutureTask.run(FutureTask.java:266)rn at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)rn at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)rn at java.lang.Thread.run(Thread.java:748)rn2019-04-16 17:08:00,001 ERROR [pool-2-thread-1] o.s.s.s.TaskUtils$LoggingErrorHandler [TaskUtils.java : 95] Unexpected error occurred in scheduled task.rnjava.lang.NoClassDefFoundError: org/apache/ibatis/reflection/ExceptionUtilrn at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)rn at com.sun.proxy.$Proxy83.selectList(Unknown Source)rn at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:230)rn at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:139)rn at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:76)rn at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)rn at com.sun.proxy.$Proxy92.getOffTimingTask(Unknown Source)rn at com.nes.mtpf.service.impl.EquipmentTimeWorkInfoServiceImpl.handleTimingTask(EquipmentTimeWorkInfoServiceImpl.java:126)rn at sun.reflect.GeneratedMethodAccessor248.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:498)rn at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)rn at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)rn at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)rn at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)rn at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)rn at com.sun.proxy.$Proxy100.handleTimingTask(Unknown Source)rn at com.nes.mtpf.AppStart.handleTimingTask(AppStart.java:148)rn at sun.reflect.GeneratedMethodAccessor247.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:498)rn at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:65)rn at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)rn at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)rn at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)rn at java.util.concurrent.FutureTask.run(FutureTask.java:266)rn at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)rn at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)rn at java.lang.Thread.run(Thread.java:748)rn2019-04-16 17:08:36,579 ERROR [http-nio-10088-exec-4] o.a.coyote.http11.Http11Processor [DirectJDKLog.java : 182] Error processing requestrnjava.lang.NoClassDefFoundError: org/apache/tomcat/util/http/parser/Cookiern at org.apache.tomcat.util.http.Rfc6265CookieProcessor.parseCookieHeader(Rfc6265CookieProcessor.java:90)rn at org.apache.catalina.connector.Request.parseCookies(Request.java:3104)rn at org.apache.catalina.connector.Request.getServerCookies(Request.java:2174)rn at org.apache.catalina.connector.CoyoteAdapter.parseSessionCookiesId(CoyoteAdapter.java:1007)rn at org.apache.catalina.connector.CoyoteAdapter.postParseRequest(CoyoteAdapter.java:714)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336)rn at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)rn at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)rn at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)rn at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)rn at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)rn at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)rn at java.lang.Thread.run(Thread.java:748)rn2019-04-16 17:08:44,132 ERROR [http-nio-10088-exec-10] o.a.coyote.http11.Http11Processor [DirectJDKLog.java : 182] Error processing requestrnjava.lang.NoClassDefFoundError: org/apache/tomcat/util/http/parser/Cookiern at org.apache.tomcat.util.http.Rfc6265CookieProcessor.parseCookieHeader(Rfc6265CookieProcessor.java:90)rn at org.apache.catalina.connector.Request.parseCookies(Request.java:3104)rn at org.apache.catalina.connector.Request.getServerCookies(Request.java:2174)rn at org.apache.catalina.connector.CoyoteAdapter.parseSessionCookiesId(CoyoteAdapter.java:1007)rn at org.apache.catalina.connector.CoyoteAdapter.postParseRequest(CoyoteAdapter.java:714)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336)rn at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)rn at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)rn at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)rn at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)rn at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)rn at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)rn at java.lang.Thread.run(Thread.java:748)rnrn```
NoClassDefFoundError错误发现(之一)
这个错与是类加载器中defineClass()方法抛出来的,通过自定义实现加载器发现,如果defineClass方法中的name,不是类名,而是package+类名的形式,例如class文件:test.class,全限定名:com.wyp12.myClassLoader.test,如果加载过程中,如果参数name出错,就会报NoClassDefFoundError错误
急,android集成paypal支付,noclassdeffounderror错误
我直接跑的是官方的example,报PayPalConfiguration这个类,noclassdeffounderror,貌似是paypal的SDK库根本就没引进来。但是工程里是不显示出错的,libs文件夹下jar包也都在。rn我在openstack上查说是开发环境有问题,我用的是eclipse,要换成android studio就好了,不知道哪位大神搞过,给点指导。rn[img=https://img-bbs.csdn.net/upload/201506/29/1435549468_789719.jpg][/img]
NoClassDefFoundError 的一种错误原因
工具ieda,需要外部添加jar包的时候如下图这样添加 然后进行编译是没有问题的,但运行的时候访问就会报错,最终找到的原因,可能是这种添加jar导致打包后的项目里面没有相关的jar包 如图: 里面找不到 解决办法,可以将相关jar包打入maven库中 mvninstall:install-file-Dfile=xxx.jar-DgroupId=xxx -DartifactId...
NoClassDefFoundError错误如何解决
作了一个邮件程序如下:rnrnimport java.util.Properties;rnimport javax.mail.*;rnimport javax.mail.internet.*;rnimport javax.mail.internet.MimeMessage;rnrnrnpublic class mailrn public static void main(String[] args) throws Exception rn Properties props=new Properties();rn props.put("mail.smtp.host","192.168.42.253");rn Session session=Session.getDefaultInstance(props,null);rn rn Message msg=new MimeMessage(session);rn rn InternetAddress addressFrom=new InternetAddress("vbul@jcct.com");rn msg.setFrom(addressFrom);rn InternetAddress addressTo=new InternetAddress("ky@jcct.com");rn msg.setRecipient(Message.RecipientType.TO,addressTo);rn rn msg.setSubject("text");rn msg.setContent("text one","text/plain");rn rn Transport transport=session.getTransport("smtp");rn transport.send(msg);rn rn rnrnrn能通过编译,但运行时提示:rnrnException in thread "main" java.lang.NoClassDefFoundError:javax/activation/DatarnSource rn at mail.mainrnrnrn请问如何解决阿?
关于NoClassDefFoundError错误的排错
前几天紫竹群里有朋友提到自己遇到了NoClassDefFoundError错误,我们先来看看J2SE API中对这个错误描述:rn[color=#FF0000]当 Java 虚拟机或 ClassLoader 实例试图在类的定义中加载(作为通常方法调用的一部分或者作为使用 new 表达式创建的新实例的一部分),但无法找到该类的定义时,抛出此异常。 rnrn当前执行的类被编译时,所搜索的类定义存在,但无法再找到该定义。[/color]rnrn我根据自己的经验,给出了排错的步骤:rnrn1、排除低级错误:看看是否所搜索的类名与实际定义的类名不匹配,如大小写不一致,或少写多写字母等。[color=#FF0000]如:new ClassName(); 而实际定义的类名是CClasName或者className[/color]rn2、看看在所搜索的类定义中是否加了包名,而项目文件夹中却没有这个包的情况(往往是在别处拿人家的代码来用,却没有检查是否建立了相应的包),[color=#FF0000]因为这种情况编译器是不会报错的,只会在编译时告诉JVM到时要加载这个类就到这个包去找,而实际上你并没有建立这个包或者你的这个类没有放到那个包中,JVM自然会报错。[/color]如:你在某个类中有package mypackage;这么一句,而你的这个类却不在这个包目录下,当运行你的程序,某个时候需要加载使用你的这个类时,JVM会报错。rnrn3、看看是否环境变量有问题,这种情况在这里发生的机率很低了吧,呵呵,毕竟之前你的其他程序都应该是在正常运行的。当然,也不能否定这个情况,如:你没有设“.”这个当前目录的classpath时,有时也可能会出现这样的错误。rnrn 以上谨代表个人看法,因鄙人学习Java时间不长(一个月零23天),所以有纰漏之处,请各位斧正,谢谢!发此帖也算是练练脸皮,hoho。rn
初级:NoClassDefFoundError错误。
我在读SUN的JAVA教程。今天下载了这里的:http://java.sun.com/docs/books/tutorial/java/javaOO/QandE/nested-questions.html的InnerClassDemo.java。我在NetBeans IDE中运行,产生如下错误:rnjava.lang.NoClassDefFoundError: CreateObjectDemo/CreateObjectDemo (wrong name: CreateObjectDemo)rn at java.lang.ClassLoader.defineClass0(Native Method)rn at java.lang.ClassLoader.defineClass(ClassLoader.java:537)….rn不知何故?
android中NoClassDefFoundError
最近的项目有一个偶现的error,看了log是java.lang.NoClassDefFoundError: ,网上搜了关于该exception的问题,一般都是因为引入jar包sdk不匹配导致的。但是我的这个类是自己写的,不知道为什么也会出现这种error,求大神指教!!!!!rnrnrn报错的log:java.lang.NoClassDefFoundError: com/test/weather/widget/WeatherWidgetTestrnrn对应的代码是:WeatherWidgetTest.updateWidgets(context, isWeatherUpdate);rn public static boolean updateWidgets(Context context, boolean isWeatherUpdate) rn ComponentName provider = new ComponentName(context,rn context.getPackageName() + ".widget.WeatherWidgetTest");rn AppWidgetManager gm = AppWidgetManager.getInstance(context);rn int[] appWidgetIds;rn appWidgetIds = gm.getAppWidgetIds(provider);rn final int Num = appWidgetIds.length;rn for (int i = 0; i < Num; i++) rn WeatherWidgetTest.updateAppWidget(context, gm,rn appWidgetIds[i], isWeatherUpdate);rn rn return Num > 0;rn
eclipse 调用 jboss 出错,NoClassDefFoundError
命令行如下:rn "E:\Program Files\j2sdk1.4.2_05\bin\javaw.exe" -Djboss.home=E:\Program Files\jboss-3.2.5 -classpath "E:\Program Files\jboss-3.2.5\bin\run.jar;E:\Program Files\j2sdk1.4.2_05\lib\tools.jar" -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,suspend=y,address=localhost:4106 org.jboss.Mainrnrn出错:rnjava.lang.NoClassDefFoundError: Files\jboss-3/2/5rnException in thread "main" rnrn怎么回事啊?55555555555555
eclipse启动tomcat抛出NoClassDefFoundError
启动tomcat的时候提示我找不到org/apache/tomcat/util/digester/Digesterrn我看了tomcat-util.jar下面是没有这个类的rn那我要去哪里找啊rnrn下面是出错提示rnjava.lang.NoClassDefFoundError: org/apache/tomcat/util/digester/Digesterrn at org.apache.catalina.startup.Catalina.createStartDigester(Catalina.java:302)rn at org.apache.catalina.startup.Catalina.load(Catalina.java:551)rn at org.apache.catalina.startup.Catalina.load(Catalina.java:667)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:498)rn at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:253)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:427)rn
NoClassDefFoundError
项目中导入了第三方包。为什么还出现rnCould not find class 'org.ksoap2.serialization.SoapObject', ???
android,windows系统Eclipse的错误
在笔记本中windows系统下,用Eclipse总是报错,重启或退出Eclipse时就会出现错误:rnrn problem occurred when invoking code from plug-in org.eclipse.ui.workbenchrnrn怎么了?
一个关于NoClassDefFoundError错误的疑问
package texts;rnimport java.io.*;rnimport org.jdom.*;rnimport org.jdom.input.*;rnimport org.jdom.output.*;rnrnpublic class XMLReadrn public static String getStr()rn tryrn SAXBuilder sb = new SAXBuilder();rn Document doc = sb.build(new FileInputStream("xml/perfence.xml"));rn ProcessingInstruction pi = new ProcessingInstruction("xml-stylesheet","href=\"bookList.html.xsl\" type=\"text/xsl\"");rn doc.addContent(pi);rn Element root = doc.getRootElement();rn Element user = root.getChild("×éÃû³Æ");rn return user.getText();rn catch(JDOMException e)rn e.printStackTrace();rn catch(IOException e)rn e.printStackTrace();rn rn return "";rn rnrn public static void main(String[] args)rn System.out.println(getStr());rn rnrn上面这段程序是java读取我相对目录xml/下的prefencd.xml的代码,如果单独编译运行这个类时,能显示出正确的结果,可是如果在另一个类,如Text.java中调用他(语句为XMLRead xmlRead = new XMLRead();)的时候,会报错java.lang.NoClassDefFoundError: org/jdom/JDOMException,请问为什么啊?
自定义classLoad发生NoClassDefFoundError错误
小弟在学习classload,网上找了一个例子rnrn[code=Java]rnpackage com.demo.test;rnrnpublic class Test rn public static void main(String[] args)rn rn System.out.println("ok");rn rn rnrnrnrn[/code]rnrnrn[code=Java]rnpackage com.demo.test;rnrnimport java.io.ByteArrayOutputStream;rnimport java.io.File;rnimport java.io.FileInputStream;rnimport java.io.FileNotFoundException;rnimport java.io.IOException;rnimport java.nio.ByteBuffer;rnimport java.nio.channels.Channels;rnimport java.nio.channels.FileChannel;rnimport java.nio.channels.WritableByteChannel;rnrnpublic class MyClassLoader extends ClassLoader rn private String fileName; rn rn public MyClassLoader(String fileName) rn this.fileName = fileName; rn rn rn protected Class findClass(String className) throws ClassNotFoundException rn Class clazz = this.findLoadedClass(className); rn if (null == clazz) rn try rn String classFile = getClassFile(className); rn FileInputStream fis = new FileInputStream(classFile); rn FileChannel fileC = fis.getChannel(); rn ByteArrayOutputStream baos = new rn ByteArrayOutputStream(); rn WritableByteChannel outC = Channels.newChannel(baos); rn ByteBuffer buffer = ByteBuffer.allocateDirect(1024); rn while (true) rn int i = fileC.read(buffer); rn if (i == 0 || i == -1) rn break; rn rn buffer.flip(); rn outC.write(buffer); rn buffer.clear(); rn rn fis.close(); rn byte[] bytes = baos.toByteArray(); rn rn clazz = defineClass(className, bytes, 0, bytes.length); rn catch (FileNotFoundException e) rn e.printStackTrace(); rn catch (IOException e) rn e.printStackTrace(); rn rn rn return clazz; rn rn rn private String getClassFile(String name) rn StringBuffer sb = new StringBuffer(fileName); rn name = name.replace('.', File.separatorChar) + ".class"; rn sb.append(File.separator + name); rn return sb.toString(); rn rn rnrn[/code]rnrn[code=Java]rnpackage com.demo.test;rnrnpublic class MainClassLoader rn public static void main(String[] args) rn try rn MyClassLoader tc = new MyClassLoader("D:/worktemp/Demo/bin/com/demo/test"); rn Class c = tc.findClass("Test"); rn c.newInstance(); rn catch (ClassNotFoundException e) rn e.printStackTrace(); rn catch (IllegalAccessException e) rn e.printStackTrace(); rn catch (InstantiationException e) rn e.printStackTrace(); rn rn rn rnrn[/code]rnrn我是想用自己生成的classload去装载Test.class,这个文件的绝对路径是D:/worktemp/Demo/bin/com/demo/test下rnrnTest.java文件路径是在D:\worktemp\Demo\src\com\demo\test 下rnrn运行时发生这个错误,不知道怎么处理谢谢rnException in thread "main" java.lang.NoClassDefFoundError: Test (wrong name: com/demo/test/Test)
noclassdeffounderror
package com.pllpwy.Login;rn rnpublic class LoginUI implements ActionListener rn JFrame j;rn JLabel jLabel1;rn JLabel jLabel2;rn JLabel jLabel3;rn JLabel jLabel4;rn JButton jButton3;rn JButton jButton2;rn JButton jButton1;rn JPasswordField jPasswordField1;rn JTextField jTextField1;rn Icon i;rnrn public LoginUI() rn j = new JFrame();rn //节省空间。代码略。。。rn j.setResizable(false);rn j.setLocation(300, 200);rn j.setVisible(true);rn j.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);rnrn rnrn public void actionPerformed(ActionEvent e) rnrn char[] pwd = jPasswordField1.getPassword();rn String userpwd = new String(pwd);rn String username = jTextField1.getText();rnrn //JOptionPane.showMessageDialog(null, e.getActionCommand());rnrn rnrn public static void main(String[] args) rn new LoginUI();rn rnrnrnrnrn为什么在eclipse下面运行的时候提示:rnjava.lang.NoClassDefFoundError: com/pllpwy/Login/LoginUIrnCaused by: java.lang.ClassNotFoundException: com.pllpwy.Login.LoginUIrnrn它执行的时候,明显执行到了LoginUI文件夹下面去了。这个文件夹肯定不存在的了,这个是邮什么引起的?
noclassdeffounderror!!
编辑c>f2sdk1.4.2_02\bin>javac c:\f2sdk1.4.2_02\HelloWorld.javarnrn执行c>f2sdk1.4.2_02\bin>java c:\f2sdk1.4.2_02\HelloWorldrn编辑没问题,为什么执行的时候会出现noclassdeffounderror的错误呢rn怎么改呢??rn如果要设置classpath有该怎么做呢
NoClassDefFoundError错误是什么原因?郁闷
不知道为什么,我的SDK现在好像工作不正常,原来可以编译显示正确结果的程序,老是显示解释错误,编译已通过,比如,最简单的Hello程序:rnpublic class Hello rnrn public static void main(String[] args) rn rn System.out.println("Hello World!");rn rnrn编译通过后,执行java Hello命令时显示错误为:Exception in thread "main" java.lang.NoClassDefFoundError:Hello。其他正确的程序有时也总是编译时显示illegal character :\12288,但并没有出现非法字符呀,郁闷,哪位老大指点一下迷津,是不是安装出了问题还是设置有问题,可是环境变量class和classpath都设置正确呀,why,why,why……
启动j2ee服务器NoClassDefFoundError错误!
我配置好J2EE环境变量后,运行j2ee ?/显示如下:rnC:\Documents and Settings\Administrator>j2ee ?/rnJava 2 Enterprise Edition ServerrnOptions:rn -verbose Redirect all logging output to the current shell.rn -help Print this help message.rn -version Print the version.rn -stop Stop the J2EE server.rnC:\Documents and Settings\Administrator>rn这说明我的环境配置没有问题,但我启动服务器时出现以下错误,rnC:\Documents and Settings\Administrator>j2ee -verbosernJ2EE server listen port: 1050rnException in thread "main" java.lang.NoClassDefFoundError: com/sun/corba/se/internal/util/IdentityHashtablern at com.sun.corba.ee.internal.javax.rmi.CORBA.Util.(Util.java:87)rn at com.sun.corba.ee.internal.POA.POAImpl.activate(POAImpl.java:935)rn at com.sun.corba.ee.internal.POA.POAImpl.activate_object(POAImpl.java:895)rn at com.sun.corba.ee.internal.CosNaming.TransientNameService.initialize(TransientNameService.java:117)rn at com.sun.corba.ee.internal.CosNaming.TransientNameService.(TransientNameService.java:70)rn at com.sun.enterprise.iiop.POAProtocolMgr.initializeNaming(POAProtocolMgr.java:103)rn at com.sun.enterprise.server.J2EEServer.run(J2EEServer.java:226)rn at com.sun.enterprise.server.J2EEServer.main(J2EEServer.java:972)rn请问这是怎么回事,如何解决了.我在网上找了很久还是没有解决,,....rn 急先待回答了.
请教NoClassDefFoundError错误是什么意思?
在Linux下用JDK编译一个java文件报的错。rn多谢了!
[求助]hibernate出现NoClassDefFoundError错误
在运行hibernate过程中出现了NoClassDefFoundError错误,提示信息为java.lang.NoClassDefFoundError: Could not initialize class com.zhxu.entranceguard.hibernate.DAO.HibernateSessionFactoryrn rnrn
NoClassDefFoundError?
这个错误是什么意思?
程序出了错误NoClassDefFoundError,以及对错误的思考
错误背景:rn我建了一个web项目,然后发布到websphere,每次运行的时候都报NoClassDefFoundError: BDAgent,但是我开发环境里classpath明明加了BDAgent,如果真的没有BDAgent,一定会报一大堆红叉子,可是却没有。rnrn我的猜测是,开发环境里确实有BDAgent,但是因为程序在服务器上运行,那么就要把开发时候的classpath加入到websphere上,我请问大家,比如我在开发的时候再eclipse的classpath中加入BDAgent,那么在服务器上运行的时候是不是也要手动在websphere上添加BDAgent到classpath?
eclipse 导入Android源码错误
Eclipse导入packages/apps下的所有源码报错--R类找不到rn比如AccountPreference.javarn[img=http://www.eoeandroid.com/data/attachment/forum/201104/05/145825n6x66etmx9rzzrp1.png][/img]rnAccountPreferenceBase.java找不到类rn[img=http://www.eoeandroid.com/data/attachment/forum/201104/05/145953mc8n47pxu8oeu84q.png][/img]rn我Make了整个源码,并且也用mm命令编译了AccountsAndSyncSettings目录,然后刷新Eclipse下的AccountsAndSyncdSettings包,可是还是报上面的错rn
Eclipse 插件开发 import外部类 出现 NoClassDefFoundError 异常
在为一个java工程用eclipse rcp写一个界面。rnrn我写的eclipse插件放在 src目录下的tools.gui包,plugin.xml和META-INF放在java工程根目录下。rnrn现在我将tools包下的一个名为Client的类import进来,运行时出现了rn“java.lang.NoClassDefFoundError: Client (wrong name: tools/SimpleClient)”的异常。rnrn我觉得可能是eclipse rcp在运行时不能找到tools包下的Client类。rnrngoogle了一上午了。请问如何解决?谢谢!
android导入spring的jar包后发生NoClassDefFoundError错误?
通过Build path-->configure build path-->add Library-->user library-->New-->...-->add jars导入spring-2.5.6.jar和spring-webmvc-2.5.6.jar.jar文件是放在工程目录下的。rn在以下代码处发生错误:rnrn[code=Java]rnApplicationContext applicationContext = new ClassPathXmlApplicationContext(rn "invoker-client.xml");rn[/code]rnrn[code=XML]rn11-16 07:11:57.685: ERROR/AndroidRuntime(1555): java.lang.NoClassDefFoundError: org.springframework.context.support.ClassPathXmlApplicationContextrn[/code]rnrnrn试过新建libs 文件夹,包放到这个目录下,右键 Build Path -> Use as source folder,编译不通过;rn把jar文件放在assets目录下也不行;rnproject-->clean-->...也不行。rnrn有碰到过这种情况的吗,请教解决办法?
android使用第三方jar包,运行时找不到class:NoClassDefFoundError错误
请教知道的大虾,给出解决方法,网上找了N的方法去尝试,无果;希望贴出来的方法都是亲自测试过的,谢谢了!rnrnandroid菜鸟飘过...
帮忙看看 NoClassDefFoundError: org/jaxen/JaxenException 错误
jaxen1.1.1jar 已经加入到项目中,单独使用Junit运行 完全OK。 rn可是在WEB环境中 出现如下错误。 是包冲突还是被拦截了?rnjava.lang.reflect.InvocationTargetExceptionrn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452)rn at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254)rn at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)rn at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at org.apache.struts2.interceptor.MessageStoreInterceptor.intercept(MessageStoreInterceptor.java:204)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)rn at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485)rn at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)rn at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)rn at org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:102)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:343)rn at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)rn at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)rn at com.etrans.service.account.AutoLoginFilter.doFilter(AutoLoginFilter.java:43)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)rn at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)rn at org.springframework.security.web.session.SessionManagementFilter.doFilter
helloworld出NoClassDefFoundError错误,盼解决
1.操作rnd:\eclipse\workspace\test\bin\org\company>java HelloWorldrnrn2.源代码rn就是一句HelloWorldrnrn3.异常现象rnException in thread "main" java.lang.NoClassDefFoundError: HelloWorld (wrong namrne: org/company/HelloWorld)rn at java.lang.ClassLoader.defineClass1(Native Method)rn at java.lang.ClassLoader.defineClass(ClassLoader.java:620)rn at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12rn4)rn at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)rn at java.net.URLClassLoader.access$000(URLClassLoader.java:56)rn at java.net.URLClassLoader$1.run(URLClassLoader.java:195)rn at java.security.AccessController.doPrivileged(Native Method)rn at java.net.URLClassLoader.findClass(URLClassLoader.java:188)rn at java.lang.ClassLoader.loadClass(ClassLoader.java:306)rn at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)rn at java.lang.ClassLoader.loadClass(ClassLoader.java:251)rn at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)rnrn4.环境变量rn[color=#FF0000]CLASSPATH[/color]:.;D:\jdk1.6\lib;D:\jdk1.6\jre\lib;D:\jdk1.6\lib\tools.jar;%ANT_HOME%\lib;D:\jdk1.6\jre\lib\extrn[color=#FF0000]JAVA_HOME[/color]:D:\jdk1.6rn[color=#FF0000]Path[/color]:%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files\Microsoft SQL Server\90\DTS\Binn\;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\;%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;%ANT_HOME%\binrn
SessionFactory factory = config.buildSessionFactory(); 时报NoClassDefFoundError错误
代码:rn private Session session = null;rn public OperateTest() rn rn rn Configuration config = new Configuration().configure();rn tryrn rn //报错的地方rn SessionFactory factory = config.buildSessionFactory();rn this.session = factory.openSession(); rn rn catch (Throwable t) rn rn t.printStackTrace(); rn rnrn rn rn报错如下:rnrnjava.lang.NoClassDefFoundError: net/sf/ehcache/CacheExceptionrn at java.lang.Class.getDeclaredConstructors0(Native Method)rn at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)rn at java.lang.Class.getConstructor0(Class.java:2640)rn at java.lang.Class.newInstance0(Class.java:321)rn at java.lang.Class.newInstance(Class.java:303)rn at org.hibernate.cfg.SettingsFactory.createCacheProvider(SettingsFactory.java:323)rn at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:219)rn at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1463)rn at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1004)rn at pkg.OperateTest.(OperateTest.java:17)rn at pkg.Test.main(Test.java:16)rnException in thread "main" java.lang.NullPointerExceptionrn at pkg.OperateTest.Insert(OperateTest.java:30)rn at pkg.Test.main(Test.java:17)rnrn说明:rn编译正确。rnrn环境变量:rnclasspath: rn.;%JAVA_HOME%\lib;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;%CATALINA_HOME%\common\lib\servlet-api.jar;%JAVA_HOME%\lib\ehcache-1.1.jarrnpath:rn;%JAVA_HOME%\BIN;%JAVA_HOME%\JRE\BIN;%CATALINA_HOME%\BIN;rnrn还有什么没有加???????????????????rn谢谢
错误:NoClassDefFoundError:Searcher(wrong name:news/Searcher)
DOS下提示错误:NoClassDefFoundError:Searcher(wrong name:news/Searcher)rn程序中没有main函数吗?不明白rn-------------------------------------------------------------------------------rnpackage news;rnrnimport com.heaton.bot.HTTP;rnimport com.heaton.bot.HTTPSocket;rnimport com.heaton.bot.ISpiderReportable;rnimport com.heaton.bot.IWorkloadStorable;rnimport com.heaton.bot.Spider;rnimport com.heaton.bot.SpiderInternalWorkload;rnrn//实现接口rnpublic class Searcherrn implements ISpiderReportable rn public static void main(String[] args) throws Exception rn //SpiderInternalWorkload:基于内存的作业管理的方法rn IWorkloadStorable wl = new SpiderInternalWorkload();rn Searcher _searcher = new Searcher();rn Spider _spiderrn //Spider(报告发现的对象,开始的URL,HTTP处理程序(HTTPSocket 类来通过HTTP 协议发送和接收数据),线程池的大小,制定的作业管理器)rn = new Spider(_searcher, "http://www.sina.com",rn new HTTPSocket(), 100, wl); rn //setMaxBody设置要下载的正文大小rn _spider.setMaxBody(100);rn _spider.start();rn rn //发现内部链接rn public boolean foundInternalLink(String url) rn return false;rn rn //发现外部链接rn public boolean foundExternalLink(String url) rn return false;rn rn //发现其他链接(非HTML链接)rn public boolean foundOtherLink(String url) rn return false;rn rn //用于处理网页,Spider要完成的实际工作,page参数包含网页内容rn public void processPage(HTTP http) rn System.out.println("扫描网页:" + http.getURL());rn new HTMLParse(http).start();rn rn //用来请求一个被处理的网页,这个网页刚刚被Spider下载,参数page中是网页的内容,当这个网页产生HTML错误时参数error为真rn public void completePage(HTTP http, boolean error) rn rn //由Spider调用以确定查询字符串是否应删除,如果队列中的字符串应当删除,这一方法返回真rn public boolean getRemoveQuery() rn return true;rn rn //当Spider程序没有剩余的工作时调用这个方法rn public void spiderComplete() rn rnrn
NoClassDefFoundError这个错误怎么解决啊
以前做个程序,一直都好用,可是今天在用就出现了上面的错误,这个程序还有用那,怎么解决啊,各位高手帮帮忙..
一个RMI程序老出来NoClassDefFoundError错误
这个程序由4个文件组成rnServer.java:rnrnpackage test;rnimport java.rmi.Naming;rnimport java.rmi.RMISecurityManager;rnrnpublic class Serverrnrn public static void main(String[] args) rn if (System.getSecurityManager() == null) rn System.setSecurityManager(new RMISecurityManager());rn rnrn rn String name = "BackendProtocol";rn try rn System.out.println("create backend");rn Backend backend = new Backend();rn System.out.println("start rebind");rn Naming.rebind(name, backend);rn System.out.println("Backend bound");rn catch (Exception e) rn System.err.println("Backend exception: " + e.getMessage());rn e.printStackTrace();rn rn rnrnrnBackendProtocol.java:rnrnpackage test;rnimport java.rmi.Remote;rnimport java.rmi.RemoteException;rnrnimport net.jini.admin.Administrable;rnrnpublic interface BackendProtocol extends Remote , Administrable rnpublic float doConversion(float amount, String country) rnthrows RemoteException;rnrnrnBackend.java:rnrnpackage test;rnimport java.rmi.RemoteException;rnimport java.rmi.server.UnicastRemoteObject;rnimport java.util.Hashtable;rnrnpublic class Backend extends UnicastRemoteObject implements BackendProtocol rn Hashtable exchangerate = new Hashtable();rnrn Backend() throws RemoteException rn rnrn // This initializes the converter to allow conversionsrn // for known countries.rn public void initRates() rn exchangerate.put("UK", new Float(0.72));rn exchangerate.put("Sweden", new Float(200));rn rnrn public float doConversion(float amount, String country)rn throws RemoteException rn System.out.println("Back-end: doing the conversion");rn Float xchrate = (Float) exchangerate.get(country);rn if (xchrate != null)rn return amount * (xchrate.floatValue());rn elsern return amount;rn rnrn public Object getAdmin() throws RemoteException rn return "Admin";rn rnrnrnrnClient.java:rnpackage test;rnimport java.rmi.Naming;rnimport java.rmi.RMISecurityManager;rnrnpublic class Client rn public static void main(String args[]) rn if (System.getSecurityManager() == null) rn System.setSecurityManager(new RMISecurityManager());rn rn try rn String name = "//" + args[0] + "/BackendProtocol";rn BackendProtocol comp = (BackendProtocol) Naming.lookup(name);rn comp.doConversion(500 , "UK");rn System.out.println(comp.getAdmin());rn catch (Exception e) rn System.err.println("Backend: " + e.getMessage());rn e.printStackTrace();rn rn rnrnrn编译rnE:\Projects\eclipse\workspace\TestRMI>javac -classpath d:\jini2_1\lib\jini-core.jar;d:\jini2_1\lib\jini-ext.jar;d:\jini2_1\lib\sun-util.jar test\*.javarnrnE:\Projects\eclipse\workspace\TestRMI>rmic -classpath d:\jini2_1\lib\jini-core.jar;d:\jini2_1\lib\jini-ext.jar;d:\jini2_1\lib\sun-util.jar;.\ test.Backendrnrn运行:rnE:\Projects\eclipse\workspace\TestRMI>java -cp d:\jini2_1\lib\jini-core.jar;d:\jini2_1\lib\jini-ext.jar;d:\jini2_1\lib\sun-util.jar;.\ -Djava.rmi.server.codebase=file:/e:\Projects\eclipse\workspace\TestRMI/ -Djava.security.policy=java.policy test.Serverrnrn可就是因为BackendProtocol扩展了net/jini/admin/Administrable接口,运行的时候出现NoClassDefFoundErrorrnBackend exception: Error occurred in server thread; nested exception is:rnjava.lang.NoClassDefFoundError: net/jini/admin/Administrablernjava.rmi.ServerError: Error occurred in server thread; nested exception is:rnjava.lang.NoClassDefFoundError: net/jini/admin/Administrablernat sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:349rn)rnat sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:207)rnat sun.rmi.transport.Transport$1.run(Transport.java:148)rnat java.security.AccessController.doPrivileged(Native Method)rnat sun.rmi.transport.Transport.serviceCall(Transport.java:144)rnat sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4rn60)rnat sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransportrn.java:701)rnat java.lang.Thread.run(Thread.java:534)rnat sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamrnRemoteCall.java:247)rnat sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:rn223)rnat sun.rmi.server.UnicastRef.invoke(UnicastRef.java:350)rnat sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)rnat java.rmi.Naming.rebind(Naming.java:160)rnat test.Server.main(Server.java:19)rnCaused by: java.lang.NoClassDefFoundError: net/jini/admin/Administrablernat java.lang.ClassLoader.defineClass0(Native Method)rnat java.lang.ClassLoader.defineClass(ClassLoader.java:539)rnat java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12rn3)rnat java.net.URLClassLoader.defineClass(URLClassLoader.java:251)rnat java.net.URLClassLoader.access$100(URLClassLoader.java:55)rnat java.net.URLClassLoader$1.run(URLClassLoader.java:194)rnat java.security.AccessController.doPrivileged(Native Method)rnat java.net.URLClassLoader.findClass(URLClassLoader.java:187)rnat java.lang.ClassLoader.loadClass(ClassLoader.java:289)rnat java.lang.ClassLoader.loadClass(ClassLoader.java:235)rnat java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)rnat java.lang.ClassLoader.defineClass0(Native Method)rnat java.lang.ClassLoader.defineClass(ClassLoader.java:539)rnat java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12rn3)rnat java.net.URLClassLoader.defineClass(URLClassLoader.java:251)rnat java.net.URLClassLoader.access$100(URLClassLoader.java:55)rnat java.net.URLClassLoader$1.run(URLClassLoader.java:194)rnat java.security.AccessController.doPrivileged(Native Method)rnat java.net.URLClassLoader.findClass(URLClassLoader.java:187)rnat java.lang.ClassLoader.loadClass(ClassLoader.java:289)rnat java.lang.ClassLoader.loadClass(ClassLoader.java:235)rnat java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)rnat java.lang.Class.forName0(Native Method)rnat java.lang.Class.forName(Class.java:219)rnat sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:430)rnat sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)rnat java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:631)rnat java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:257)rnat sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.javrna:200)rnat java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:151rn3)rnat java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)rnat java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1rn626)rnat java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)rnat java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)rnat sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)rnat sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:342rn)rnat sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:207)rnat sun.rmi.transport.Transport$1.run(Transport.java:148)rnat java.security.AccessController.doPrivileged(Native Method)rnat sun.rmi.transport.Transport.serviceCall(Transport.java:144)rnat sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4rn60)rnat sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransportrn.java:701)rnat java.lang.Thread.run(Thread.java:534)rn请问这到底是怎么回事?我上面编译运行的步骤有哪里错了吗? rn
hibernate出现NoClassDefFoundError错误!急急!请大虾
yeclipse 4.11 +eclipse 3.11+jdk 1.5 _8+mysqlrn我用hibernate 2.1x+struts 1.1rn一步一步跟着视频教程作的,程序可以运行,但是当要插入数据事rnrnsessionFactory是elipse加hibernate 时自动生成的rn总是rn每次都到action的:Session se=SessionFactory.currentSession();rn进入sessionFactroy的:private static final ThreadLocal threadLocal = new ThreadLocal();rn出现:rnjavax.servlet.ServletException: Servlet execution threw an exceptionrnrnrnroot cause rnrnjava.lang.NoClassDefFoundError: net/sf/hibernate/cfg/Configurationrn com.yourcompany.Hibernate.SessionFactory.(SessionFactory.java:30)rn com.yourcompany.struts.action.LoginAction.execute(LoginAction.java:62)rn org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)rn org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)rn org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)rn org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:709)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rn rn我的sessionFactory类为rnpackage com.yourcompany.Hibernate;rnrnimport net.sf.hibernate.HibernateException;rnimport net.sf.hibernate.Session;rnimport net.sf.hibernate.cfg.Configuration;rnrnrnpublic class SessionFactory rnrn rn private static String CONFIG_FILE_LOCATION = "/hibernate.cfg.xml";rnrn rn private static final ThreadLocal threadLocal = new ThreadLocal();rnrn rn private static final Configuration cfg = new Configuration();rnrn rn private static net.sf.hibernate.SessionFactory sessionFactory;rnrn rn public static Session currentSession() throws HibernateException rn Session session = (Session) threadLocal.get();rnrn if (session == null) rn if (sessionFactory == null) rn try rn cfg.configure(CONFIG_FILE_LOCATION);rn sessionFactory = cfg.buildSessionFactory();rn rn catch (Exception e) rn System.err.println("%%%% Error Creating SessionFactory %%%%");rn e.printStackTrace();rn rn rn session = sessionFactory.openSession();rn threadLocal.set(session);rn rnrn return session;rn rnrn /**rn * Close the single hibernate session instance.rn *rn * @throws HibernateExceptionrn */rn public static void closeSession() throws HibernateException rn Session session = (Session) threadLocal.get();rn threadLocal.set(null);rnrn if (session != null) rn session.close();rn rn rnrn /**rn * Default constructor.rn */rn private SessionFactory() rn rnrnrn
JDBC连接Mysql数据库出现NoClassDefFoundError错误
import java.sql.*;rnrnpublic class Mysqlrnrnpublic static void main(String[] args) rnrn try rn String driver = "org.gjt.mm.mysql.Driver";rn String url = "jdbc:mysql://localhost:3306/test";//server是数据库名rn String user = "root";rn String password = "";rn Connection conn = null;rn ResultSet rs = null;rn Statement stmt = null;rn Class.forName(driver).newInstance();rn conn = DriverManager.getConnection(url, user, password);rn stmt = conn.createStatement();rn rs = stmt.executeQuery("select *");rn while (rs.next()) rn System.out.println("" + rs.getInt(1) + "");rn System.out.println(":" + "");rn rn rs.close();rn conn.close();rn rn catch (Exception e) rn e.printStackTrace();rn rn rnrnrn如上源代码,编译可以通过,运行时出现NoClassDefFoundError错误,为什么?rnclasspath加了JDBC的驱动路径,也加了. 但还是有错,什么原因?
Hibernate测试例子出NoClassDefFoundError错误
诸位大虾看看怎么回事?rnrnjavax.servlet.ServletException: Invoker service() exceptionrn org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:477)rn org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:133)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:689)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rnrnrnroot cause rnrnjava.lang.NoClassDefFoundErrorrn coreservlets.NewTest.doGet(NewTest.java:77)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:689)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rn org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:419)rn org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:133)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:689)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rn——————————————————————————————————————————rnNewTest.java:rnpackage coreservlets;rnimport java.io.*;rnimport javax.servlet.*;rnimport javax.servlet.http.*;rnimport java.util.*;rnimport java.sql.*;rnimport org.apache.log4j.*;rnimport java.lang.*;rnimport coreservlets.HbTest.*;rnimport org.hibernate.*;rnrn//reply the requestrnpublic class NewTest extends HttpServletrn public void init()rn String appPath = getServletContext().getRealPath("/");rn try rn String file = getInitParameter("log4j-init-file");/**/rn if(file != null) rn PropertyConfigurator.configure(appPath + file);rn System.out.println("configure 已经调用"+appPath+file);rn rn catch(Exception e) rn System.out.println("the log4j configuretor file is error");rn rn rn rn rn public void doGet(HttpServletRequest request,rn HttpServletResponse response)rn throws ServletException, IOExceptionrn List list=null;rn tryrn Session session=HibernateUtil.currentSession();------77行rn Transaction Tx=session.beginTransaction();rn rn employee em=new employee();rn em.setfirstname(request.getParameter("firstname"));rn em.setlastname(request.getParameter("lastname"));rn em.setworknumber(request.getParameter("worknumber"));rn session.save(em);rn rn list=session.createQuery("form employee").list();rn rn Tx.commit();rn HibernateUtil.closeSession();rn catch(Exception e)rn System.out.println("the hb error is"+e);rn rn rn request.setAttribute("northlist",list);rn RequestDispatcher dispatcher= request.getRequestDispatcher("/northtest.jsp");rn dispatcher.forward(request,response); rn rn rnrn_______________________________________________________________________________rnHibernateUtil.java:rnpackage coreservlets.HbTest;rnimport org.hibernate.*;rnimport org.hibernate.cfg.*;rnrnpublic class HibernateUtil rnrn //private static Log log = LogFactory.getLog(HibernateUtil.class);rnrn private static final SessionFactory sessionFactory;rnrn static rn try rn // Create the SessionFactoryrn sessionFactory = new Configuration().configure().buildSessionFactory();rn catch (Throwable ex) rn // Make sure you log the exception, as it might be swallowedrn System.out.println("Initial SessionFactory creation failed."+ex);rn throw new ExceptionInInitializerError(ex);rn rn rnrn public static final ThreadLocal session = new ThreadLocal();rnrn public static Session currentSession() rn Session s = (Session) session.get();rn // Open a new Session, if this Thread has none yetrn if (s == null) rn s = sessionFactory.openSession();rn session.set(s);rn rn return s;rn rnrn public static void closeSession() rn Session s = (Session) session.get();rn if (s != null)rn s.close();rn session.set(null);rn rnrnrnrn
求救:运行Bean时,提示NoClassDefFoundError的错误.
在ECLIPSE 里运行一个JSP时,调用MyBean.getValue()时出错,不知道怎么改,大虾帮忙rnrn代码:rnpackage myPackage;rnrnimport java.io.*;rnimport org.jdom.*;rnimport org.jdom.input.*;rnimport org.jdom.output.*;rnrnpublic class MyBean rn private String s="";rn private Document xmldoc=null;rn private SAXBuilder builder=new SAXBuilder(); rn public String getValue() rn try rn xmldoc=builder.build(s);rn catch (IOException e) rn e.printStackTrace();rn catch (JDOMException e) rn System.out.print(e.getMessage());rn rn return "ok";rn rnrnrn错误提示:rnjava.lang.NoClassDefFoundError: org/jdom/JDOMExceptionrn java.lang.Class.getDeclaredConstructors0(Native Method)rn java.lang.Class.privateGetDeclaredConstructors(Unknown Source)rn java.lang.Class.getConstructor0(Unknown Source)rn java.lang.Class.getConstructor(Unknown Source)rn org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1218)rn org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)rn org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)rn org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)rn org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2224)rn org.apache.jasper.compiler.Node$JspRoot.accept(Node.java:525)rn org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)rn org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)rn org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)rn org.apache.jasper.compiler.Node$Root.accept(Node.java:456)rn org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)rn org.apache.jasper.compiler.Generator.generate(Generator.java:3268)rn org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:189)rn org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)rn org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)rn org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)rn org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rnrn
诡异的NoClassDefFoundError
发生NoClassDefFoundError,有哪些情况啊?rn希望有发生过这个问题的人都说说啊rn rnclasspath绝对没错rnrn我自己电脑上运行的好好的rn拿到别人电脑上运行就出现这个错误rn rn发生过很多次了rn有的人的电脑上我把需要的JAR包放到JBOSS下面的一个LIB目录下后就没有这个问题了rn但是有的还是这个问题rn rn实在搞不清楚这个是什么问题rnrnJAVADOC上是这么写的rn当 Java 虚拟机或 ClassLoader 实例试图在类的定义中加载(作为通常方法调用的一部分或者作为使用 new 表达式创建的新实例的一部分),但无法找到该类的定义时,抛出此异常
移植java源码到android平台遇见的NoClassDefFoundError错误
如题,日志显示android 栈:rn03-09 20:50:26.621: Exception in protocol stage thread: java.util.concurrent.ThreadLocalRandomrn03-09 20:50:26.621: java.lang.NoClassDefFoundError: java.util.concurrent.ThreadLocalRandomrn在网络上搜了下,说是android引用的jdk版本问题??但不了解android方面怎么设置引用的jdk?或者其他什么原因??rn 忘高手指点!!
在工程中导入JAR,出现NoClassDefFoundError错误
我现在碰到个问题,将原来程序中用到的包打成JAR文件,然后将原包删去,将打好的JAR文件导入进来代替原包,可是在运行的时候出现NoClassDefFoundError错误。rnrn我试了重新建立一个工程,并把JAR文件防在工程目录下,都不行,全都是出同一个错误。rnrn本人是J2ME新手,还请各位大侠帮忙看看是什么问题。万分感谢
相关热词 c#部署端口监听项目、 c#接口中的属性使用方法 c# 昨天 c#func链接匿名方法 c#怎么创建文件夹 c#从键盘接收空格 c#da/ad c#部门请假管理系统 c#服务器socket c# 默认的访问修饰符