I've been fighting an internal Eclipse error for two days. I'm running the latest Spring Tool Suite edition of Eclipse, and I've attempting to import a collection of existing Maven projects. Whenever I do so, Eclipse throws a NullPointerException, but no stack trace is available from the Error Log view. If I instruct Eclipse to update the Maven project (Maven > Update Project), I get a NullPointerException again. This time, the Error Log view reports the following stack trace:
java.lang.NullPointerException
at org.eclipse.wst.common.componentcore.internal.resources.VirtualResource.getProjectRelativePaths(VirtualResource.java:119)
at org.eclipse.wst.common.componentcore.internal.resources.VirtualFile.getUnderlyingFiles(VirtualFile.java:104)
at org.eclipse.wst.common.componentcore.internal.resources.VirtualFile.getUnderlyingResources(VirtualFile.java:93)
at org.eclipse.wst.common.componentcore.internal.resources.VirtualResource.exists(VirtualResource.java:88)
at org.eclipse.jst.common.internal.modulecore.util.ManifestUtilities.getNonBinaryComponentManifest(ManifestUtilities.java:124)
at org.eclipse.jst.common.internal.modulecore.util.ManifestUtilities.getManifest(ManifestUtilities.java:81)
at org.eclipse.jst.common.internal.modulecore.util.ManifestUtilities.getManifestClasspath(ManifestUtilities.java:147)
at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.getManifestClasspath(J2EEModuleVirtualComponent.java:248)
at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.calculateManifestReferences(J2EEModuleVirtualComponent.java:368)
at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.cacheManifestReferences(J2EEModuleVirtualComponent.java:360)
at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.getReferences(J2EEModuleVirtualComponent.java:176)
at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.getReferences(J2EEModuleVirtualComponent.java:214)
at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.getReferences(J2EEModuleVirtualComponent.java:207)
at org.eclipse.m2e.wtp.WebProjectConfiguratorDelegate.configureClasspath(WebProjectConfiguratorDelegate.java:386)
at org.eclipse.m2e.wtp.WTPProjectConfigurator.configureClasspath(WTPProjectConfigurator.java:107)
at org.eclipse.m2e.jdt.internal.DefaultClasspathManagerDelegate.populateClasspath(DefaultClasspathManagerDelegate.java:61)
at org.eclipse.m2e.jdt.internal.BuildPathManager.getClasspath(BuildPathManager.java:253)
at org.eclipse.m2e.jdt.internal.BuildPathManager.getClasspath(BuildPathManager.java:363)
at org.eclipse.m2e.jdt.internal.BuildPathManager.getClasspath(BuildPathManager.java:343)
at org.eclipse.m2e.jdt.internal.BuildPathManager.getClasspath(BuildPathManager.java:371)
at org.eclipse.m2e.jdt.internal.BuildPathManager.updateClasspath(BuildPathManager.java:191)
at org.eclipse.m2e.jdt.internal.BuildPathManager.mavenProjectChanged(BuildPathManager.java:180)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.notifyProjectChangeListeners(ProjectRegistryManager.java:746)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.applyMutableProjectRegistry(ProjectRegistryManager.java:865)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:289)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration0(ProjectConfigurationManager.java:369)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$2.call(ProjectConfigurationManager.java:316)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$2.call(ProjectConfigurationManager.java:1)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:161)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:137)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:89)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1301)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:313)
at org.eclipse.m2e.core.ui.internal.UpdateMavenProjectJob.runInWorkspace(UpdateMavenProjectJob.java:77)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Here's what I've tried:
I've blown away my workspace and created a new one. Multiple times.
I've blown away my Maven repository so that it would be re-created.
I've reinstalled Spring Tool Suite.
I've tried asking Eclipse to update the Maven repositories.
I've checked for merge conflicts in my local SVN repository. (There are none; this is a brand new branch from trunk that is freshly checked out.)
I've checked the Synchronize view in Eclipse to see if it notes any differences. (Eclipse can't get far enough to recognize any projects available to synchronize.)
I've searched Google for NullPointerExceptions occurring in VirtualResource.getProjectRelativePaths(). I've found NullPointerExceptions in other very similar places, and I've tried the recommendations for them, just for the heck of it, but none of them work.
I'm at my wits' end with this problem. Help me, Obi-Wan Kenobi, you are my only hope.
This is what I did to fix it:
Removed the project from the workspace
Remove .classpath, .project and .settings folder
Reimport the project
I'm strongly sure that the problem is not related to the maven plugin; but if it is, i was wandering if you run a mvn eclipse:eclipse before importing the project into eclipse, if you do that and you are using maven 3, I had checked that maven plugin does not support maven 3 properly yet; so I encourage you to make a mvn eclipse:clean, then import the project as an existing project, and after that activate the maven plugin nature from eclipse.
I hope it helps,
PS. it seems to be a know eclipse bug (https://www.google.com.uy/search?q=j2ee.componentcore.J2EEModuleVirtualComponent.getReferences(J2EEModuleVirtualComponent.java&oq=j2ee.componentcore.J2EEModuleVirtualComponent.getReferences(J2EEModuleVirtualComponent.java&aqs=chrome..69i57.128j0j7&sourceid=chrome&espv=210&es_sm=91&ie=UTF-8); try downloading the last eclipse version; I'm using kepler at work, and I'm working in maven/spring projects and it works fine.
Good luck!
This happens because your m2e plugins are corrupted. To rectify follow the steps below.
close eclipse
Go to your eclipse workspace folder Under .metadata/pluigns folder, identify all m2e plugins
delete them
copy the relevant plugins from non-corrupted workspace, either from
your machine or from any one of your team members machine
restart eclipse
As echinelli indicated, this did turn out to be an Eclipse (or STS) bug, but installing the latest version isn't the fix, as I already had that version installed. I had installed STS based on Eclipse 4.x; when I uninstalled that and went to the 3.x version, the problem went away.
Ok, I had the same issue with a more obscure reason.
I used pluginExecution for aspectj-maven-plugin and over the course of trying to fix yet another maven issue I had commented out <action><execute><execute></action>
This leads to the nullpointerexception.
I solved by adding the <build> section with "maven-compiler-plugin" artifact in the POM. I noticed that without it, Eclipse threw a java.lang.NullPointerException.
Related
I am working on Eclipse plugin. At the beginning exporting of it worked fine but I guess that after updating Eclipse it broke down. Eclipse started to mentioned that I have uninstalled some equinox packages. It took time till I understood that version of Eclipse made a problems and I reinstalled older version of Eclipse. Now I am again able to run sample environment with plugin but I still am not able to export plugin. In export form where I need to select deployable plugin and/or fragments I don't have listed anything. From what I found I understand that it might be problem with importing project in Eclipse as it might not remove information that project is external and thus not listing as project that could be exported. But I did not find any way to prove this case.
Is there anybody having any idea how to solve this kind of issue?
I am trying to move a Java project from Selenium 2.53 to 3.4. I am using Eclipse Mars under Windows 7. Eactly the same problem happens in a fresh installation of Eclipse Neon.
I have changed the Maven dependency to selenium-java 3.4 and got NullPointerException when trying to run the project in Eclipse. After a Maven build of pom.xml, the resulting jar runs fine.
I thought the project might have gotten corrupted, so I started a new Maven project, hoping to move the code into it eventually. After creating a simple Maven project I added selenium-java 3.4 as a dependency - and immediately got an error during the project build in Eclipse. The details say, again, NullPointerException. Then I installed Neon,created a new project again, added selenium-java 3.4 as a dependency and got the same issue.
Unfortunately I have no way of knowing on what line the NPE happens. When trying to save pom.xml, I get a windows saying:
'Building workspace' has encountered a problem. Errors occurred during the build.
When I click Details I see:
Errors occurred during the build.
Errors running builder 'Maven Project Builder' on project 'service.apm.ui_auto.dataentry'.
java.lang.NullPointerException
When I look into Errors, all I see is "Project configuration is not up to date with pom.xml. Select Maven -> Update project from the project context menu or use Quick fix". When I do that, I just get another window with "'Updating Maven Project' has encountered a problem". And the Details button shows a message about the NPE again.
After a lot of "trying stuff" I have stumbled upon an apparent solution.
I rename C:\Users\myuser\.m2 and then the new project starts working just fine - it builds, runs, Maven Update project works... until I try to build the old project. As soon as I try to build the old project or update it (right click old project > Maven > Update project), the Null Pointer Exception returns, and then it affects the new project too.
Moreover, even if I do not touch the old project, the NPE eventually returns, apparently during downloading sources and javadoc. While I will try disabling downloading sources and javadoc, this does not look like a complete solution.
After a lot of "trying stuff" I have finally stumbled upon an apparent solution. It was not great, but I am placing it here for the benefit of others who get the issue.
I have:
Installed Eclipse Neon in a separate directory and with a separate workspace
deleted C:\Users\myuser\.m2
created a new project from scratch, and did NOT import the old projects into the new Neon
Now things seem to work fine, though at one point, the NPE returned - I think updating the indexes corrupted the repository again. I deleted .m2 and the NPE went away.
It seems there is a maven build issue with current version of selenium jars 3.4.0, so what worked for me was adding dependency for a lower version of selenium, in this case, version 3.3.1. Once added and saved, no error was seen and the project was successfully built.
I've been dealing with this problems for days now.
I need to install maven and the eclipse plug-in "maven2eclipse" on an offline environment.
So far I've installed maven on the computer but I'm not able to import or open a maven project in eclipse when I right click and select "import source" in the package/project explorer. Maven alternatives simply aren't there for me to use even though I've installed all of the plug-ins that m2e repository has to offer.
I've downloaded the m2e-repository for a local version with these commandlines:
Artifact and metadata (replacing .artifact. with .metadata. and running it again)
"C:\eclipse Java EE\eclipse.exe" -application org.eclipse.equinox.p2.artifact.repository.mirrorApplication \ -source http://download.eclipse.org/technology/m2e/releases \ -destination C:\Maven2Eclipse\repos
I then moved this local folder to the offline system and used it as a local repository.
I've also downloaded the helios repository, but I haven't installed anything from it. Becuase I seemed to be lacking some important dependancies without it. Something with eclipse.UI.. haven't been able to reproduce it.
Anyways, I've added the downloaded repositories to the disposal of my offline environment.
I installed everything with "m2e" and/or "maven" in it's name but I still can't import an "existing maven project". The option simply isn't there.
Here's a screenshot of what m2e software I have installed using the "install new software".
http://i.imgur.com/xPKN6qn.png
Have I missed something? There's something missing and keeping me from actually being able to select the import source "import an existing maven project".
I've been searching the web like crazy and I cannot find anything that resembles my problem.
There's quite a lot on mirroring eclipse repositories and what not but I don't seem to have a problem whit that, unless something didn't get downloaded.
Thanks in advance for any help.
It is better if you can update eclipse with the automatic update by using the url online directly.downloading and then installing the plugin manually causes a lot of issues as some plugins might not get downloaded properly in the installer or some plugins may be completely missing from the installer itself.
Please check the proper url to install the plugin automatically which matches with the version of the eclipse you may be using.
Just...check this two things, if you go in eclipse configuration, inside the Maven tab?
1: Check the Offline mode...
2: Try to use the Maven you've installed (not the embedded one..)
I solved the issue by manually copying all plugins and feature files into their respective folders, making sure everything was installed as well and then restarting eclipse a couple of times with the -clean addition. After that, it started working.. weird :/
Thanks for the answers though!
So I tried to get the Maven Gwt archetype up and running. So some background info, I got Maven 3.0, and I have JDK 1.7 in Eclipse.
I ran the archetype, imported the project, and had a bunch of warnings and errors, I solved most of them but this one: GWT SDk servlet.jar was missing in WEB-INF/lib
So I searched stack overflow, and used someones suggestion of using quick-fix to synchronize them. Now I get a warning saying that I have not J2SE1.5 installed.
Do I need J2SE1.5 to run my web app? Why is JDk 1.7 not enough?
Next, I get the warning
Classpath entry com.google.gwt.eclipse.core.GWT_CONTAINER will not be exported or published. Runtime ClassNotFoundExceptions may result.
Which I also have no clue why it is saying that.
But I am able to run the clean install gwt:run Maven goals without any problems.
I could suppress the warnings but my ADD would kill me, I'd rather understand the issues if I am going to just ignore them.
If you have a GWT_CONTAINER entry in your build-path with a Maven project, then you're doing it wrong (gwt-maven-plugin archetype most probably does it wrong, but I don't have the patience to fix all its warts and nobody else seems to bother; maybe we should simply get rid of it).
You should first install the Google Plugin for Eclipse (GPE), which works hand-in-hand with M2Eclipse (M2E) to autoconfigure the project when it detects it's a GWT project (makes use of the gwt-maven-plugin IIRC).
Then make sure you don't have any .project, .classpath or .settings/ files/folders and import your Maven project in Eclipse. M2E and GPE should do everything for you. In the event that GPE doesn't add the GWT nature to your project, go check "Google Web Toolkit" in the project preferences, you'll see that GPE will have automatically selected the gwt-user from your POM as the GWT SDK.
See http://code.google.com/p/google-web-toolkit/wiki/WorkingWithMaven (which suggests avoiding the gwt-maven-plugin archetype).
All in all, it's easier to simply start from scratch: add a dependency on gwt-user and add the gwt-maven-plugin, then do everything else with GPE wizards in Eclipse.
You might also find https://github.com/tbroyer/gwt-maven-archetypes helpful.
I'm expiriencing multiple compilation errors in my project, most of the code is in red, but the strange(or not) thing is that while building the project with maven everything is build successfully and the war is assemled as it should be.
The thing is that auto suggest is not working because code is not compiling. What can I do to fix this?
I'm using eclipse, sorry
UPDATE:
I've tried all suggestions below but none worked
If you are using Eclipse, try Project > clean.. your project.
I don't know why, but Eclipse sometimes just think your project was wrong but it's not. Clean it to entirely build it again.
If it's Eclipse do
Project > Clean
then right click at the parent-most project and do
Maven > Update Project Configuration
Maven > Update Dependencies
I guess you have m2eclipse installed, already.
Use a maven plugin in your IDE
plugin for eclipse
plugin for netbeans
Most likely you have to include external libraries/dependencies in your IDE. It seems when you're building with maven, those dependencies are solved for you.
Some IDE's support Maven projects, try to see if yours does.
You haven't specified what IDE you're using or what the errors are, which makes it pretty hard to give you advice. My guess is that you haven't configured your project (or whatever the equivalent IDE concept is) to tell it the libraries you're using... whereas the Maven build file already contains that information.
EDIT: Okay, so it can't find the right libraries. Options:
Use a Maven plugin and let it manage the project
Edit the project's build path and explicitly tell it which jar files to use.