类写的绝对没有问题  ,main 方法也没有任何问题 ,使用自己安装的 JDK JRE 命令行执行也没有问题。
但是在eclipse 3.6中则不行,没办法调试也没没发执行  抛出上面的异常。eclipse 编译生成了class文件,但是无论采用eclipse 的jre 还是 选择自己安装的jre 都无法执行 。
另外一个eclipse3.2 则可以 。  两个eclipse ini文件配置相同。请问一下谁遇到过这种错误么,我必须要使用 报错的那个eclipse3.6 因为必须支持 TOMCATE7 

解决方案 »

  1.   

    莫不是路径配置存在重名类?先判断下是不是Eclipse的问题先。用Eclipse3.6创建个新的java类,写个main函数,尝试启动它能跑么?
      

  2.   

    eclipse3.2 可以,eclipse3.6 不可以,那就是eclipse的配置问题了吧。
      

  3.   


    3.6不行的。。3.6 和3.2的另外一个区别是 3.6装了maven插件
      

  4.   

    你是说,Eclipse3.6,新写个带main函数的简单类,都无法正常启动它?那就说明这个Eclipse3.6,配置上肯定有问题了。
      

  5.   

    问题解决了 ,Eclipse is running in a JRE, but a JDK is required
    Some Maven plugins may not work when importing projects or updating source folders.装了maven 一直报这个错误,我把这个错误解决了, 就是让 eclipse 运行在 jdk 中 ,结果之前的问题也好了
      

  6.   

     运行在 jre 和 jdk 的区别是什么???
      

  7.   


    jre是运行环境,只能运行编译好的java class。jdk是开发环境,支持将java源代码编译为class文件。既然你要用Eclipse做开发,必然应该给它配好JDK。
      

  8.   

    问题又来了 新建了一个java项目 ,可以执行,但是在我之前的 maven web 项目里面无法执行
      

  9.   

    加个QQ吧   帮我远程一下?
    我QQ 251021539
      

  10.   

    maven test的错误提示 -------------------------------------------------------------------------------
    Test set: edu.hzsf.storm.dal.dao.daoibatis.UserDAOTest
    -------------------------------------------------------------------------------
    Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 3.562 sec <<< FAILURE!
    testGetUser(edu.hzsf.storm.dal.dao.daoibatis.UserDAOTest)  Time elapsed: 3.472 sec  <<< ERROR!
    java.lang.NoSuchMethodError: org.springframework.core.MethodParameter.getParameterAnnotations()[Ljava/lang/Object;
    at org.springframework.beans.factory.config.DependencyDescriptor.getAnnotations(DependencyDescriptor.java:203)
    at org.springframework.beans.factory.annotation.QualifierAnnotationAutowireCandidateResolver.isAutowireCandidate(QualifierAnnotationAutowireCandidateResolver.java:106)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.isAutowireCandidate(DefaultListableBeanFactory.java:377)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.isAutowireCandidate(DefaultListableBeanFactory.java:364)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:670)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:610)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1076)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:982)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:329)
    at org.springframework.test.AbstractDependencyInjectionSpringContextTests.injectDependencies(AbstractDependencyInjectionSpringContextTests.java:208)
    at org.springframework.test.AbstractDependencyInjectionSpringContextTests.prepareTestInstance(AbstractDependencyInjectionSpringContextTests.java:183)
    at org.springframework.test.AbstractSingleSpringContextTests.setUp(AbstractSingleSpringContextTests.java:103)
    at junit.framework.TestCase.runBare(TestCase.java:132)
    at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:79)
    at junit.framework.TestResult$1.protect(TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:243)
    at junit.framework.TestSuite.run(TestSuite.java:238)
    at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
    at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
    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 org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
    at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
    at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
      

  11.   

    JAR包版本存在冲突,这个比较麻烦了。从堆栈信息来看,似乎是maven的版本和spring的版本不配套。比如(只是举例),你Eclipse所装maven的版本是按照Spring2.0来设计的,结果你用了Spring1.0的包。
      

  12.   

    现在有几个问题
    1. 我不用maven 管理的项目 , Se项目 可以正常运行,用maven 管理的为本项目  ,我在俩面弄了个main函数都就跑不了
    2.如果是eclipse的问题 ,那么我用mvn test 的时候 编译和运行 是使用的哪个JDK 和JRE ,MAVEN 插件还是环境变量配置的?
    3.JDK 里面的 jre  与 和jdk 同一目录下的jre 的区别在哪
      

  13.   

    加分就免了,也未必能解决你的问题。因为似乎有好几个问题混在一起了,但是优先必须防范的是JDK和JRE的问题,必须确保启动Eclipse以及Eclipse中配置的Java>Installed JREs 都用JDK的目录,避免节外生枝。
    顺便说下:“3.JDK 里面的 jre 与 和jdk 同一目录下的jre 的区别在哪。” 这个区别不大,但JDK重要的是bin目录,我们所说的JDK都是指bin目录的上级目录。另一个我认为比较大的问题,是你若干个项目所用的Spring包,版本应该是不一样的。而Eclipse中所安装maven插件只能支持其中的一个版本,具体是什么版本,应该能从maven的帮助信息或什么地方查的到。
      

  14.   

    另外一个问题  我maven 里面配置的junit 版本是4.8.1 ,为什么 mvn test 的时候会自动下载一个3.8.1但hi我把配置改成3.8.1的时候却显示junit 不存在?下面是错误信息-------------------------------------------------------------------------------
    Test set: edu.hzsf.storm.dal.dao.daoibatis.UserDAOTest
    -------------------------------------------------------------------------------
    Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.02 sec <<< FAILURE!
    warning(junit.framework.TestSuite$1)  Time elapsed: 0.015 sec  <<< FAILURE!
    junit.framework.AssertionFailedError: No tests found in edu.hzsf.storm.dal.dao.daoibatis.UserDAOTest
    at junit.framework.Assert.fail(Assert.java:47)
    at junit.framework.TestSuite$1.runTest(TestSuite.java:97)
    at junit.framework.TestCase.runBare(TestCase.java:134)
    at junit.framework.TestResult$1.protect(TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:243)
    at junit.framework.TestSuite.run(TestSuite.java:238)
    at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
    at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
    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 org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
    at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
    at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
      

  15.   

    junit.framework.AssertionFailedError: No tests found in edu.hzsf.storm.dal.dao.daoibatis.UserDAOTest这个提示不是说Junit不存在而是它在UserDAOTest这个类里面没找到任何 测试函数。是不是你写漏了标注或函数名不是以test开始之类的问题。
      

  16.   

    之前注释掉了我忘了junit 版本问题解决了
      

  17.   


    找到原因了 maven项目忘了 mvn eclipse:eclipse 了
      

  18.   

    Microsoft Windows [版本 6.1.7600]
    版权所有 (c) 2009 Microsoft Corporation。保留所有权利。C:\Users\meran>d:D:\>cd worspace
    系统找不到指定的路径。D:\>cd workD:\work>cd workspaceD:\work\workspace> cd stormD:\work\workspace\storm>mvn test -e
    [INFO] Error stacktraces are turned on.
    [INFO] Scanning for projects...
    [WARNING]
    [WARNING] Some problems were encountered while building the effective model for
    edu.hzsf:storm:war:0.0.1-SNAPSHOT
    [WARNING] 'dependencies.dependency.systemPath' for com.sun:tools:jar should use
    a variable instead of a hard-coded path C:/Program Files/Java/jdk1.6.0_18/lib/to
    ols.jar @ line 156, column 23
    [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-comp
    iler-plugin is missing. @ line 166, column 9
    [WARNING]
    [WARNING] It is highly recommended to fix these problems because they threaten t
    he stability of your build.
    [WARNING]
    [WARNING] For this reason, future Maven versions might no longer support buildin
    g such malformed projects.
    [WARNING]
    [INFO]
    [INFO] ------------------------------------------------------------------------
    [INFO] Building storm Maven Webapp 0.0.1-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO]
    [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ storm ---
    [debug] execute contextualize
    [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e
    . build is platform dependent!
    [INFO] Copying 10 resources
    [INFO]
    [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ storm ---
    [WARNING] File encoding has not been set, using platform encoding GBK, i.e. buil
    d is platform dependent!
    [INFO] Compiling 29 source files to D:\work\workspace\storm\target\classes
    [INFO] -------------------------------------------------------------
    [ERROR] COMPILATION ERROR :
    [INFO] -------------------------------------------------------------
    [ERROR] \work\workspace\storm\src\main\java\edu\hzsf\storm\dal\dao\BaseTestCase.
    java:[6,7] 无法访问 junit.framework.TestCase
    未找到 junit.framework.TestCase 的类文件
    public class BaseTestCase extends AbstractDependencyInjectionSpringContextTests{[INFO] 1 error
    [INFO] -------------------------------------------------------------
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 1.949s
    [INFO] Finished at: Sat Feb 18 11:25:50 CST 2012
    [INFO] Final Memory: 8M/20M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.
    3.2:compile (default-compile) on project storm: Compilation failure
    [ERROR] \work\workspace\storm\src\main\java\edu\hzsf\storm\dal\dao\BaseTestCase.
    java:[6,7] 无法访问 junit.framework.TestCase
    [ERROR] 未找到 junit.framework.TestCase 的类文件
    [ERROR] public class BaseTestCase extends AbstractDependencyInjectionSpringConte
    xtTests{
    [ERROR] -> [Help 1]
    org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
    rg.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on
     project storm: Compilation failure
    \work\workspace\storm\src\main\java\edu\hzsf\storm\dal\dao\BaseTestCase.java:[6,
    7] 无法访问 junit.framework.TestCase
    未找到 junit.framework.TestCase 的类文件
    public class BaseTestCase extends AbstractDependencyInjectionSpringContextTests{
            at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
    .java:213)
            at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
    .java:153)
            at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
    .java:145)
            at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
    ct(LifecycleModuleBuilder.java:84)
            at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
    ct(LifecycleModuleBuilder.java:59)
            at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
    ild(LifecycleStarter.java:183)
            at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
    eStarter.java:161)
            at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
            at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
            at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
            at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
            at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
    cher.java:290)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
    a:230)
            at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
    uncher.java:409)
            at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
    352)
    Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation fail
    ure
    \work\workspace\storm\src\main\java\edu\hzsf\storm\dal\dao\BaseTestCase.java:[6,
    7] 无法访问 junit.framework.TestCase
    未找到 junit.framework.TestCase 的类文件
    public class BaseTestCase extends AbstractDependencyInjectionSpringContextTests{
            at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompiler
    Mojo.java:656)
            at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:128)
            at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
    BuildPluginManager.java:101)
            at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
    .java:209)
            ... 19 more
    [ERROR]
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please rea
    d the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc
    eption
    'cmd' 不是内部或外部命令,也不是可运行的程序
    或批处理文件。
    D:\work\workspace\storm>^Ah这个你看看啊 。这个也解决了  那个帖子的分也都给你了啊
      

  19.   

    [ERROR] \work\workspace\storm\src\main\java\edu\hzsf\storm\dal\dao\BaseTestCase.
    java:[6,7] 无法访问 junit.framework.TestCase
    未找到 junit.framework.TestCase 的类文件检查下你maven的启动脚本 或 配置,是不是在CLASSPATH里面漏了 junit 的JAR包?