abbes
abbes

Reputation: 89

Exception creating new Maven project in Apache Netbeans9

I faced this exception when I create a new maven project in Apache Netbeans9, I'm using Java10.

Here is the exception text:

java.lang.IllegalArgumentException: Key contains code point U+0000
    at java.prefs/java.util.prefs.AbstractPreferences.get(AbstractPreferences.java:296)
    at org.netbeans.modules.maven.queries.MavenFileOwnerQueryImpl.registerCoordinates(MavenFileOwnerQueryImpl.java:153)
    at org.netbeans.modules.maven.ProjectOpenedHookImpl.registerWithSubmodules(ProjectOpenedHookImpl.java:431)
    at org.netbeans.modules.maven.ProjectOpenedHookImpl.projectOpened(ProjectOpenedHookImpl.java:138)
    at org.netbeans.spi.project.ui.ProjectOpenedHook$1.projectOpened(ProjectOpenedHook.java:60)
[catch] at org.netbeans.modules.project.ui.OpenProjectList.notifyOpened(OpenProjectList.java:1273)
    at org.netbeans.modules.project.ui.OpenProjectList.doOpenProject(OpenProjectList.java:1354)
    at org.netbeans.modules.project.ui.OpenProjectList.open(OpenProjectList.java:798)
    at org.netbeans.modules.project.ui.OpenProjectList$6.run(OpenProjectList.java:650)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
    at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
    at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
    at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)

Screenshot this is the screenshot of the exception

Upvotes: 5

Views: 3013

Answers (6)

Christian CH
Christian CH

Reputation: 11

In my case, this file was corrupt.

C:\Users\[your_name]\AppData\Roaming\NetBeans\12.0\config\Preferences\org\netbeans\modules\maven\externalOwners.properties

I deleted it and recreated it as an empty file. This fixed the problem.

Upvotes: 1

niyi adebambo
niyi adebambo

Reputation: 31

Close your Netbeans IDE and - C:\Users[your username]\AppData\Roaming\

Just remove or rename the NetBeans folder. Then relaunch your IDE and open the project via file - open menu

Upvotes: 0

svarog
svarog

Reputation: 9839

I tried to migrate from Netbeans 12.1 (under jdk8) to Netbeans 12.5 (under jdk11).

Encountered this exception.

I tried S. Kadakov's answer, did found some files containing \u0000 control characters like uihandler.properties but removing these characters didn't really do anything.

Instead what I did is go to the installation folder (in my case)

C:\Program Files\NetBeans-12.5\netbeans\etc

And modified the netbeans_jdkhome setting

#netbeans_jdkhome="C:\Program Files\Java\jdk-11"
netbeans_jdkhome="C:\Program Files\Java\jdk1.8.0_261"

Basically telling Netbeans to go back to jdk8. If you have code that needs to be compiled with a higher JDK you can just set the right java platform for the compiler inside the IDE itself

Upvotes: 0

Svetoslav Stoyanov
Svetoslav Stoyanov

Reputation: 146

Deleting the NetBeans folder from C:\Users\[your username]\AppData\Roaming\NetBeans\ solved my issue.

Upvotes: 4

user10617847
user10617847

Reputation: 301

For ubuntu workaround to remove local netbeans data

rm -rf ~/.netbeans

Upvotes: 0

S. Kadakov
S. Kadakov

Reputation: 919

Finally, workaround found!

You (and me as well) used Netbeans of older versions, so Netbeans keeps old preferences and settings like DB connections, AppServers, installed modules and so on at

C:\Users\[your username]\AppData\Roaming\NetBeans\

... and tries to import it. Possibly any of your preferences or settings containes wrong data. Just remove or rename this directory and start for fresh.

Be aware: all you preferences will be lost!

Another approach: you can search patterm \u0000 (just as text) in all files at older configurations. In my case two files were containing lines

\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000

at the very begining. Removing that solved the problem.

Upvotes: 4

Related Questions