I am doing first steps in REST with Jersey following here using m2e. It works fine deployed on tomcat 10.1, after a few adaptions to tomcat 10 and Java-17.
Now, I'd like to do a next step and put something new to the pom.xml. But doing Maven / Update Project ... leads to the failure message:
Could not update project HelloREST configuration
Cannot invoke "org.eclipse.wst.common.componentcore.internal.WorkbenchComponent.findResourcesByRuntimePath(org.eclipse.core.runtime.IPath)"
because "aComponent" is null
Further, the Error Log also shows
eclipse.buildId=4.26.0.20221201-1200
java.version=17.0.5
java.vendor=Eclipse Adoptium
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments: -product org.eclipse.epp.package.jee.product
Command-line arguments: -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.jee.product
org.eclipse.m2e.logback.appender
Error
Tue Feb 07 13:19:45 CET 2023
HelloREST/.settings/org.eclipse.wst.common.component is missing or invalid. Skipping module dependency configuration. Deployment issues may arise.
and
eclipse.buildId=4.26.0.20221201-1200
java.version=17.0.5
java.vendor=Eclipse Adoptium
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments: -product org.eclipse.epp.package.jee.product
Command-line arguments: -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.jee.product
org.eclipse.wst.common.frameworks
Error
Tue Feb 07 13:19:45 CET 2023
Cannot invoke "org.eclipse.wst.common.componentcore.internal.WorkbenchComponent.getProperties()" because "component" is null
java.lang.NullPointerException: Cannot invoke "org.eclipse.wst.common.componentcore.internal.WorkbenchComponent.getProperties()" because "component" is null
at org.eclipse.wst.common.componentcore.internal.resources.VirtualComponent.setMetaProperty(VirtualComponent.java:285)
at org.eclipse.wst.common.componentcore.internal.operation.ServerContextRootUpdateOperation.execute(ServerContextRootUpdateOperation.java:40)
at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl$1.run(DataModelPausibleOperationImpl.java:385)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2380)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2405)
at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.runOperation(DataModelPausibleOperationImpl.java:410)
at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.runOperation(DataModelPausibleOperationImpl.java:360)
at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.doExecute(DataModelPausibleOperationImpl.java:247)
at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.executeImpl(DataModelPausibleOperationImpl.java:219)
at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.cacheThreadAndContinue(DataModelPausibleOperationImpl.java:89)
at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.execute(DataModelPausibleOperationImpl.java:207)
at org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities.setServerContextRoot(ComponentUtilities.java:337)
at org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities.setServerContextRoot(J2EEProjectUtilities.java:948)
at org.eclipse.m2e.wtp.WebProjectConfiguratorDelegate.configure(WebProjectConfiguratorDelegate.java:157)
at org.eclipse.m2e.wtp.AbstractProjectConfiguratorDelegate.configureProject(AbstractProjectConfiguratorDelegate.java:88)
at org.eclipse.m2e.wtp.WTPProjectConfigurator.configure(WTPProjectConfigurator.java:70)
at org.eclipse.m2e.core.project.configurator.AbstractLifecycleMapping.configure(AbstractLifecycleMapping.java:123)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.lambda$6(ProjectConfigurationManager.java:494)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:364)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:274)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:488)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.lambda$4(ProjectConfigurationManager.java:416)
at java.base/java.util.Collection.removeIf(Collection.java:576)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration0(ProjectConfigurationManager.java:410)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.lambda$3(ProjectConfigurationManager.java:340)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:364)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:274)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:213)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1102)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:339)
at org.eclipse.m2e.core.ui.internal.UpdateMavenProjectJob.runInWorkspace(UpdateMavenProjectJob.java:80)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:43)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
I do not see any other problem yet, but they may come. Any idea what could be the reason?
The failure messages does not disappear, when I try to reduce the project, even not if I delete .metadata and restart Eclipse.
The pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.codejava</groupId>
<artifactId>HelloREST</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>HelloREST</name>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>17</release>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.3</version>
<configuration>
<warName>HelloREST</warName>
<outputDirectory>/opt/tomcat/webapps/</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>3.1.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>3.1.1</version>
</dependency>
<dependency>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>4.0.1</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>
The following steps solved my problem:
=====
I investigated a bit deeper. I found a reason with 2 file in the .settings folder:
The fist one was nearly empty. Just
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId"/>
The second contained a line
<installed facet="jst.web" version="5.0"/>
Deleting that line and re-import the project replaced it by
<installed facet="jst.web" version="2.5"/>
and filled the first file with
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="HelloREST">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<property name="context-root" value="HelloREST"/>
<property name="java-output-path" value="/HelloREST/target/classes"/>
</wb-module>
</project-modules>
I have no clue about this, but two question are still unanswered (currently not very important to me):
@nitind: From https://github.com/rolfschumacher/RoS-HelloREST.git you may git clone the erroneous project.