Search code examples
javaeclipsemavenmaven-pluginmaven-3

Workspace defines a VM that does not contain a valid jre/lib/rt.jar: C:\Program Files\Java\jre7


I am new to maven and i have been creating simple web application with maven using hibernate, spring etc. i get following error occur when i run mvn eclipse:eclipse command.

[WARNING] Workspace defines a VM that does not contain a valid jre/lib/rt.jar: C:\Program Files\Java\jre7
[WARNING] could not read workspace project:c:\Users\Acer\workspace\.metadata\.plugins\org.eclipse.core.resources\.projects\myproject
org.codehaus.plexus.util.xml.pull.XmlPullParserException: processing instruction can not have PITarget with reserveld xml name (position: START_D
OCUMENT seen \r\n<?xml ... @2:7)
        at org.codehaus.plexus.util.xml.pull.MXParser.parsePI(MXParser.java:2453)
        at org.codehaus.plexus.util.xml.pull.MXParser.parseProlog(MXParser.java:1447)
        at org.codehaus.plexus.util.xml.pull.MXParser.nextImpl(MXParser.java:1395)
        at org.codehaus.plexus.util.xml.pull.MXParser.next(MXParser.java:1093)
        at org.codehaus.plexus.util.xml.Xpp3DomBuilder.build(Xpp3DomBuilder.java:187)
        at org.codehaus.plexus.util.xml.Xpp3DomBuilder.build(Xpp3DomBuilder.java:83)
        at org.codehaus.plexus.util.xml.Xpp3DomBuilder.build(Xpp3DomBuilder.java:48)
        at org.apache.maven.plugin.eclipse.reader.ReadWorkspaceLocations.readArtefact(ReadWorkspaceLocations.java:341)
        at org.apache.maven.plugin.eclipse.reader.ReadWorkspaceLocations.readWorkspace(ReadWorkspaceLocations.java:536)
        at org.apache.maven.plugin.eclipse.reader.ReadWorkspaceLocations.init(ReadWorkspaceLocations.java:94)
        at org.apache.maven.plugin.eclipse.EclipsePlugin.getWorkspaceConfiguration(EclipsePlugin.java:2063)
        at org.apache.maven.plugin.eclipse.EclipsePlugin.fillDefaultClasspathContainers(EclipsePlugin.java:1580)
        at org.apache.maven.plugin.eclipse.EclipsePlugin.setup(EclipsePlugin.java:978)
        at org.apache.maven.plugin.ide.AbstractIdeSupportMojo.execute(AbstractIdeSupportMojo.java:500)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        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.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.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:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
[INFO] no substring wtp server match.

this is my pom.xml

could anybody tell me what i am doing wrong here. thanks in advance for any help


Solution

  • I looks like a java issue. Check your java_home directory. Is it pointing to C:\Program Files\Java\jre7 ? If so let maven also point to read same location by configure the toolchains.xml in your maven directory (e.g D:\maven-2.2.1\conf) to your java version

    <toolchains>
    <toolchain>
        <type>jdk</type>
        <provides>
            <version>1.7</version> <!--This should be same as is configured via the toolchains plugin -->
            <vendor>ibm</vendor> <!--This should be same as is configured via the toolchains plugin -->
        </provides>
        <configuration>
            <jdkHome>C:\Program Files\Java\jdk1.7.0</jdkHome>
        </configuration>
    </toolchain>
    </toolchains>