Jhon Fagen
Jhon Fagen

Reputation: 35

Unable to create Enterprise application in NetBeans IDE 12.6

When I try to create an Enterprise application using the wizard (Ant project) I get the following error

java.lang.NullPointerException: Cannot invoke "org.netbeans.modules.j2ee.dd.api.application.Application.setDisplayName(String)" because "this.application" is null
at org.netbeans.modules.j2ee.earproject.ProjectEar.setupDDFromVirtual(ProjectEar.java:290)
at org.netbeans.modules.j2ee.earproject.ProjectEar.getApplication(ProjectEar.java:255)
at org.netbeans.modules.j2ee.earproject.ui.wizards.NewEarProjectWizardIterator.testableInstantiate(NewEarProjectWizardIterator.java:160)
at org.netbeans.modules.j2ee.earproject.ui.wizards.NewEarProjectWizardIterator.instantiate(NewEarProjectWizardIterator.java:139)
at org.openide.loaders.TemplateWizard$InstantiatingIteratorBridge.instantiate(TemplateWizard.java:1048)
at org.openide.loaders.TemplateWizard.handleInstantiate(TemplateWizard.java:602)
at org.netbeans.modules.project.ui.NewProjectWizard.handleInstantiate(NewProjectWizard.java:51)
at org.openide.loaders.TemplateWizard.instantiateNewObjects(TemplateWizard.java:436)
at org.openide.loaders.TemplateWizardIterImpl.instantiate(TemplateWizardIterImpl.java:228)
at org.openide.loaders.TemplateWizardIteratorWrapper$ProgressInstantiatingIterator.instantiate(TemplateWizardIteratorWrapper.java:155)
at org.openide.WizardDescriptor.callInstantiateOpen(WizardDescriptor.java:1602)
at org.openide.WizardDescriptor.callInstantiate(WizardDescriptor.java:1546)
at org.openide.WizardDescriptor.access$2300(WizardDescriptor.java:67)
[catch] at org.openide.WizardDescriptor$Listener$2$1.run(WizardDescriptor.java:2233)
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)

Of course, all the fields in the wizard are filled. However, there are no errors when creating WAR and EJB separately. The error occurs only when an EAR is created, even if it is empty.

use

All paths are spelled out correctly, read / write permissions to directories are set

Screen

Upvotes: 1

Views: 1444

Answers (2)

A. S.
A. S.

Reputation: 1

It works with jakarta EE9 provided you do the following:

Plugin versions in all pom.xml files:

maven-compiler-plugin 3.9.0

maven-war-plugin 3.3.2

maven-dependency-plugin 3.2.0

In the pom.xml file of -ejb- change packaging war to jar.

Then:

Clean and build in the following order:

top, ejb, web and ear.

That's all.

Upvotes: 0

skomisa
skomisa

Reputation: 17383

I can reproduce your problem, and NetBeans Bug Report 5953 "Creating a new Enterprise Application (Java with Ant) impossible (only when selecting JakartaEE9) - NPEs thrown" has already been raised.

The bug report is unresolved, but the problem only occurs when creating a Jakarta EE 9 Enterprise Application. I successfully created a Jakarta EE 8 Enterprise Application simply by selecting Jakarta EE8 from the Java EE Version drop list within the wizard.

You have several options available to resolve this, but none of them are good:

  • Wait for NetBeans to fix the problem. Definitely not recommended!
  • Create a Jakarta EE8 Enterprise Application with the Ant wizard instead, if you don't require EE 9 functionality.
  • Create a Jakarta EE8 Enterprise Application with the Ant wizard, then "hack" the generated projects to use EE 9.
  • Use another IDE which properly supports this functionality.
  • Create the EE 9 Enterprise Application in another IDE, then import the projects into NetBeans.

Using Maven or Gradle isnstead of Ant as the build tool doesn't help either:

  • I couldn't create a Maven Enterprise Application when using Jakarta EE8 or Jakarta EE9, though I didn't research why.
  • The project wizard doesn't even offer "Enterprise Application" as an option when using Gradle.

Notes:

Need to figure out whether maybe Web Applications (in Ant, Maven, and Gradle) might not be enough in terms of Java EE support, i.e., do we need Enterprise Applications and EJB-specific project types, if not, let's remove them.

Upvotes: 0

Related Questions