Saturday, June 15, 2013

org.codehaus.plexus.util.xml.XmlStreamReader error message on maven's pom.xml using Eclipse



In a maven project, if you get the error message:

 org.codehaus.plexus.util.xml.XmlStreamReader

on the pom.xml file, means that the "XmlStreamReader" class found errors when parsing it.

If a new project, so without compilation, go to its root directory (where the pom.xml file is placed) and run "mvn install". After, refresh you project.

If not a new project, try running "mvn install -U", also under the root directory. After, refresh you project.

If the problem persists and can not be identified visually, probably it's an "encoding" issue or phantom characters.


Solution #1 - Fixing Encoding

If you are using UTF-8, check the header of the pom.xml file.
Add the following at the first line:

<?xml version="1.0" encoding="UTF-8"?>

If not using UTF-8, discover your enconding.

Most used:
Brazil = ISO-8859-1
Windows-1252
UTF-16
us-ascii


More information at:
http://en.wikipedia.org/wiki/Character_encoding



Solution #2 - Phantom Characters


Phantom chars (not printable characters) are generating the errors during parsing. Do the following:

1. Copy the content using Ctrl+C, Ctrl+V to another temporary place.
2. Delete the original file and create a new one using the content from the temporary place.

If the problem persists, use an editor that trims not printable chars, for instance Notepad++ (windows) or gedit(linux).


Before:



After:







Solution #3 -  Eclipse's bug due to memory

Check if your memory is low, less than 200KB.
If *nix, use "free -h" command.
If windows, you can use a widget or the command "perfom /res".
With slow level of system's memory, Iclipse begins to behavior slightly different, small malfunctions up to a full freezing.
Save your files and stop Eclipse's server, if using one, then restart it.
Check memory again, and you'll see that the level is highly increased.
For this reason, due to mysterious project's malfunctions, I track the system memory and once in while I restart Eclipse if it
was working under low level memory, even though no problems happened yet in order to avoid the mysterious malfunctions.



No comments:

Post a Comment

eclipse: java: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" or Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder

  >PROBLEM Using Eclipse, you try to run a simple logging test using "org.slf4j.Logger" like the sample below: package Test; im...