maven update in Eclipse: Could not update project - eclipse

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:
Deleting the project from Eclipse Project Explorer, but not from the file system.
Deleting the .settings folder in the file system
Import the project again as Existing Maven Project
=====
I investigated a bit deeper. I found a reason with 2 file in the .settings folder:
org.eclipse.wst.common.component
org.eclipse.wst.common.project.facet.core.xml
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):
How did the .settings files got garbled?
Why does Eclipse Import Existing Maven Project look at .settings files, while it works in the same way, when .settings files are deleted?
#nitind: From https://github.com/rolfschumacher/RoS-HelloREST.git you may git clone the erroneous project.

Related

Error While Installing JSF Facet in Eclipse Project

Error While Installing JSF Facet in Eclipse Project
Detailed exception trace from .metadata/.log
!ENTRY org.eclipse.wst.common.project.facet.core 4 0 2018-10-04 18:48:27.943
!MESSAGE Failed while installing JavaServer Faces 2.2.
!STACK 0
java.lang.NullPointerException
at org.eclipse.jst.jsf.core.internal.project.facet.JSFFacetInstallDelegate.resolveConfigPath(JSFFacetInstallDelegate.java:313)
at org.eclipse.jst.jsf.core.internal.project.facet.JSFFacetInstallDelegate.createConfigFile(JSFFacetInstallDelegate.java:331)
at org.eclipse.jst.jsf.core.internal.project.facet.JSFFacetInstallDelegate.execute(JSFFacetInstallDelegate.java:130)
at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.callDelegate(FacetedProject.java:1477)
at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.modifyInternal(FacetedProject.java:441)
at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.mergeChangesInternal(FacetedProject.java:1181)
at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.access$2(FacetedProject.java:1117)
at org.eclipse.wst.common.project.facet.core.internal.FacetedProject$5.run(FacetedProject.java:1099)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2313)
at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.mergeChanges(FacetedProject.java:1109)
at org.eclipse.wst.common.project.facet.core.internal.FacetedProjectWorkingCopy.commitChanges(FacetedProjectWorkingCopy.java:2020)
at org.eclipse.wst.common.project.facet.ui.internal.FacetsPropertyPage$4.run(FacetsPropertyPage.java:232)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2313)
at org.eclipse.wst.common.project.facet.ui.internal.FacetsPropertyPage$5.run(FacetsPropertyPage.java:246)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
!SESSION 2018-10-05 10:56:32.004 -----------------------------------------------
eclipse.buildId=3.6.1.201408250818-RELEASE-e44
java.version=1.7.0_51
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Framework arguments: -product org.springsource.sts.ide
Command-line arguments: -os win32 -ws win32 -arch x86 -product org.springsource.sts.ide
Is this project a "Dinamic Web Project"? If so, you have to select a "Dynamic web module version" 2.5 or higher, because JavaServer Faces 2.2 requires this version.
You can also try to delete the project (save to another location first, just to be safe) and import it as a maven project, adding the facets latter or adjusting your pom.xml example:
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.13</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.13</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
</dependency>
You can also check your web.xml as picture below.
It should be like the code below, according to your "Dynamic Web Module" (see version 3.1 and web-app_3_1):
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">

tycho surefire with windowtester pro does not open correct window

I'm trying to set up a UI testing system with windowtester pro. I want to link those tests into the maven build process by using the Tycho plugin. For practising purpose I'm currently using an example project.
Now, when I build my project everything seems to compile fine, but when the test starts I get the following message and a default eclipse window pops up. The test is then executed on that window and -suprise- fails.
Framework arguments:
-application org.eclipse.tycho.surefire.osgibooter.uitest
-testproperties C:\Users\jla\workspace\com.example.addressbook.test\target
\surefire.properties
-product com.example.addressbook.bundle.product
Command-line arguments:
-debug
-consolelog
-data C:\Users\jla\workspace\com.example.addressbook.test\target\work\data
-dev file:/C:/Users/jla/workspace/com.example.addressbook.test/target/dev.properties
-application org.eclipse.tycho.surefire.osgibooter.uitest
-testproperties C:\Users\jla\workspace\com.example.addressbook.test\target
\surefire.properties
-product com.example.addressbook.bundle.product
!ENTRY org.eclipse.ui 4 4 2012-10-12 16:00:36.984
!MESSAGE Exception in org.eclipse.ui.internal.FolderLayout.addView(String):
org.eclipse.ui.PartInitException: View descriptor not found:
org.eclipse.ui.navigator.ProjectExplorer
!ENTRY org.eclipse.ui 4 4 2012-10-12 16:00:36.990
!MESSAGE Exception in org.eclipse.ui.internal.FolderLayout.addView(String):
org.eclipse.ui.PartInitException: View descriptor not found:
org.eclipse.ui.navigator.ProjectExplorer
!STACK 1
org.eclipse.ui.PartInitException: View descriptor not found: org.eclipse.ui.navigator.ProjectExplorer
This is the Pom.xml I have for my test project:
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.example.addressbook</groupId>
<artifactId>com.example.addressbook.build</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../com.example.addressbook.build</relativePath>
</parent>
<artifactId>com.example.addressbook.test</artifactId>
<packaging>eclipse-test-plugin</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<testSuite>com.example.addressbook.test</testSuite>
<testClass>com.example.addressbook.test.AppTest001</testClass>
<useUIHarness>true</useUIHarness>
<useUIThread>true</useUIThread>
<!-- use our product and application to launch the tests -->
<product>com.example.addressbook.bundle.product</product>
<!-- <application>org.eclipse.ui.ide.workbench</application>-->
<dependencies>
<dependency>
<type>p2-installable-unit</type>
<artifactId>com.windowtester.runtime.feature.group</artifactId>
<version>0.0.0</version>
</dependency>
</dependencies>
</configuration>
</plugin>
</plugins>
</build>
</project>
I finally found a way to make it work. Since tycho is using the project informations created by eclipse it is necessary to reference the project that is supposed to be tested in the MANIFEST.MF file.
This is my MANIFEST.MF file:
Bundle-Name: Test Bundle
Bundle-Version: 1.0.0.qualifier
Bundle-SymbolicName: com.example.addressbook.test
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.junit,
com.windowtester.runtime,
com.windowtester.swt.runtime,
com.windowtester.swing.runtime,
org.eclipse.jface,
org.eclipse.core.runtime,
org.eclipse.swt,
com.example.addressbook.bundle,
com.example.addressbook.services
And this is what my pom.xml looks like. Note: I just added an application tag right under the product tag.
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.example.addressbook</groupId>
<artifactId>com.example.addressbook.build</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../com.example.addressbook.build</relativePath>
</parent>
<artifactId>com.example.addressbook.test</artifactId>
<packaging>eclipse-test-plugin</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<testSuite>com.example.addressbook.test</testSuite>
<testClass>com.example.addressbook.test.AppTest01</testClass>
<useUIHarness>true</useUIHarness>
<useUIThread>true</useUIThread>
<!-- use our product and application to launch the tests -->
<product>com.example.addressbook.bundle.product</product>
<application>com.example.addressbook.bundle.application</application>
<dependencies>
<dependency>
<type>p2-installable-unit</type>
<artifactId>com.windowtester.runtime.feature.group</artifactId>
<version>0.0.0</version>
</dependency>
</dependencies>
</configuration>
</plugin>
</plugins>
</build>
</project>

Eclipse with Websphere 7.0.0.17: EJB project does not work with resources within the workspace, but works with resources on Server

My application works with Maven and has three modules:
ear-module
web-module
ejb-module
EJB Version is 3.0.
Deployment works in both ways without error messages.
When I try to run the application with the Publishing settings for Websphere "Run server with resources on Server" it works fine.
When I try do the same with "Run server with resources within the workspace" and open the application in my Browser it fails with this error message:
A resource reference binding could not be found for the following resource references [jdbc/nust], defined for the NustService component.
I am new in JEE5, but it seems to me that local the websphere cant find the ejb-jar.xml.
Here the pom for ejb modul:
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>mycomp-nust-frontend-app</artifactId>
<groupId>mycomp.app</groupId>
<version>0.1.0-SNAPSHOT</version>
</parent>
<artifactId>mycomp-nust-frontend-svc</artifactId>
<name>mycomp-nust-frontend-svc</name>
<packaging>ejb</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb-api</artifactId>
<version>3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>mycomp.service</groupId>
<artifactId>mycomp-service-utils</artifactId>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<configuration>
<ejbVersion>3.0</ejbVersion>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
<!-- Add classpath container for Websphere Application Server 7 to the
Eclipse project. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<classpathContainers>
<classpathContainer>org.eclipse.jst.server.core.container/com.ibm.ws.ast.st.runtime.runtimeTarget.v70/was.base.v7</classpathContainer>
<classpathContainer>org.eclipse.jst.j2ee.internal.module.container</classpathContainer>
</classpathContainers>
<projectNameTemplate>${project.name}</projectNameTemplate>
</configuration>
</plugin>
</plugins>
</build>
</project>
Any suggestions, more info needed?
thx
The problem is not with your ejb-jar.xml. Remember, the ejb-jar.xml just declares references; the actual binding to a "real" resource is done by application server-specific files. In WebSphere's case, this file is ibm-ejb-jar-bnd.xml, which should be located at the same directory as ejb-jar.xml. Do you happen to have that file there?
I faced a similar situation where my application's defined resources could not be found. The solution was to define the /WEB-INF/ibm-web-bnd.xmi
<?xml version="1.0" encoding="UTF-8"?>
<com.ibm.ejs.models.base.bindings.webappbnd:WebAppBinding xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:com.ibm.ejs.models.base.bindings.webappbnd="webappbnd.xmi" xmi:id="WebAppBinding_1348167502046" virtualHostName="default_host">
<webapp href="WEB-INF/web.xml#struts_blank"/>
<resRefBindings jndiName="jms/MyConnectionFactory" xmi:id="cf">
<bindingResourceRef href="WEB-INF/web.xml"/>
</resRefBindings>
<messageDestinationRefBindings jndiName="jms/TopicSpace/Group/Test" xmi:id="myTopic">
<bindingMessageDestinationRef href="WEB-INF/web.xml"/>
</messageDestinationRefBindings>
</com.ibm.ejs.models.base.bindings.webappbnd:WebAppBinding>
A senior developer in the team said that this should be a XML file but then that didn't work. I discovered this by exporting a deployed application from an IBM tutorial. Depending on your application you will have to change the above resource references.
Hope this helps

Maven + Spring + Dynamic Web Module ( Eclipse ) = java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

My problem is that even set the "Deployment Assembly" to include the maven dependencies, this giving that my class is not being found, I do not know what else to do.
And I'm just noticing that with the ContextLoaderListener class since other classes seem to be included in my package.
My file 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 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mkyong.common</groupId>
<artifactId>SpringMVC</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>SpringMVC Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<!-- <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId>
<version>3.8.1</version> <scope>test</scope> </dependency> -->
<!-- Spring framework -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>2.5.6</version>
</dependency>
<!-- Spring MVC framework -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>2.5.6</version>
</dependency>
<!-- JSTL -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<!-- for compile only, your container should have this -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>SpringMVC</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.0-beta-1</version>
<configuration></configuration>
</plugin>
</plugins>
</build>
</project>
My file web.xml
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Spring Web MVC Application</display-name>
<servlet>
<servlet-name>mvc-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>mvc-dispatcher</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/mvc-dispatcher-servlet.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>
This problem seems to be either due to:
Some library version mismatch (ie. java version to compile != java
version on web app server).
Required Spring library not included during deployment.
Maven archetypes used to setup the project
Perform these steps to try fix this issue:
In pom.xml > if you use maven-compiler-plugin, double check this is matching the version of the library used, if not change it (ie. 1.7 NOT 1.6).
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
If you changed the library version in the above step, you then must do: Right Click on Project > Maven > Update Project... If an error is thrown during this step, you may find yourself stuck for good. I had this issue and could not resolve it. I ended up giving up creating my "Spring MVC with Maven" in Eclipse using archetypes. I believe using archetypes messed things up..in my case.
Right Click on Project > Properties > Java Build Path > JRE System Library > Edit > choose correct library version
Right Click on Project > Properties > Project Facets > Dynamic Web module (should be checked) > Runtimes tab on the right side of the panel > choose the server created (you must have added a server previously).
Right Click on Project > Properties > Deployment Assembly > Add > Java Build Path Entries > select the Spring dependencies. This is from ClassNotFoundException while loading ContextLoaderListener Note: You must perform this step every time after doing a "Maven > Update Project" in eclipse
Remember to clean your project before to deploy it: Project > Clean
... > select project > clean
Deploy your project and see it NOT break... hopefully
In my case, I had to restart a new project without using maven archetypes to get going. I used these guidelines http://gkokkinos.wordpress.com/2012/01/02/setting-up-a-spring-mvc-project-with-maven-in-eclipse/ . I still had an error thrown, but adding the Spring dependencies via Deployment Assembly (as described above) fixed things up.
I had this same problem. Simple solution is to right click the top level project -> Properties -> Deployment Assembly and include the 'Maven Dependencies'. In my case this is where my problem was. The class DispatcherServlet was not being included in the war file, therefore it was not found by Tomcat when I deployed it to that server.
I had similar issue and followed these steps to fix it.
Open Server tab in eclipse. Right click on your server.
Clean (Tomcat) Work directory
Clean (this is different than Work directory clean up which you could see in right click context)

How to set up Eclipse PDE/Build with Indigo?

In my project I use PDE/Build to build my RCP application on a remote server in Hudson.
The current version is a package based on Eclipse Galileo and it works fine both as a builder application and as a target platform.
Now I want to upgrade it to Indigo and I need some help here.
First, the old method of unpacking number of zips to form a target platform does not work.
(I used Platform Runtime Binary, Delta pack, PDE Runtime Binary and JDT Runtime Binary - a set that I came up with that can be used both as a builder and as a target platform).
Ok, there is new target definition for that.
How would I configure it so that it corresponds to my Galileo set up?
(And of course I wouldn't mind if it was simpler/cleaner).
I tried the following:
Added Eclipse RCP, Eclipse RCP Plug-in Developer Resources (for source), PDE/API Tools Environment from download.eclipse.org/eclipse/updates/3.7
Added Eclipse Java Development from download.eclipse.org/releases/indigo
Downloaded delta pack manually from download.eclipse.org/eclipse/downloads/drops/R-3.7-201106131736/download.php?dropFile=eclipse-3.7-delta-pack.zip, unpacked it and added the resulting directory (as Directory) to target definition. By the way, is there an update site for Indigo delta pack?
Added a couple of third party plug-ins from Eclipse Orbit p2 site: download.eclipse.org/tools/orbit/downloads/drops/R20110523182458/repository
I then used the definition's 'Set as Target Platform' - and my project builds fine in my workspace - that's nice!
Then I exported the platform to .
Now, if I try to execute my build like this:
java -jar <target-platform>\plugins\org.eclipse.equinox.launcher_1.2.0.v20110502.jar -application org.eclipse.ant.core.antRunner -buildfile <target-platform>/plugins/org.eclipse.pde.build_3.7.0.v20110512-1320/scripts/productBuild/productBuild.xml -Dbuilder=<pdebuild-folder>
or even
java -jar <target-platform>\plugins\org.eclipse.equinox.launcher_1.2.0.v20110502.jar
I get the following error:
An error has occurred. See the log file \configuration\1316517334675.log
The log contains the following:
!SESSION 2011-09-20 15:15:34.269
eclipse.buildId=unknown
java.version=1.7.0
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
!ENTRY org.eclipse.osgi 4 0 2011-09-20 15:15:35.175
!MESSAGE Application error
!STACK 1
java.lang.IllegalStateException: Unable to acquire application service. Ensure that the org.eclipse.core.runtime bundle is resolved and started (see config.ini).
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:74)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Ended up with Maven based build against "Eclipse for RCP and RAP Developers" plus delta pack plus SWTBot.
Both were deployed to my Maven repository and are unpacked during the build (if required). Therefore, I no longer care about the size of the target platform.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<!-- Deploy target platform if required -->
<execution>
<id>unpack-target-platform</id>
<phase>initialize</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<markersDirectory>${target.platform.dir}</markersDirectory>
<artifactItems>
<artifactItem>
<groupId>org.eclipse</groupId>
<artifactId>rcp-target-platform</artifactId>
<version>3.7.2-win32-x86_64</version>
<type>zip</type>
<outputDirectory>${target.platform.dir.sdk}</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.eclipse</groupId>
<artifactId>rcp-target-platform-delta-pack</artifactId>
<version>3.7.2</version>
<type>zip</type>
<outputDirectory>${target.platform.dir.deltapack}</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.eclipse</groupId>
<artifactId>swtbot.eclipse</artifactId>
<version>2.0.5.20111003_1754-3676ac8-dev-e36</version>
<type>zip</type>
<outputDirectory>${target.platform.dir.swtbot}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<!-- Build system properties -->
<target.platform.dir>/rcp-target-platform-3.7.2</target.platform.dir>
<target.platform.dir.swtbot>${target.platform.dir}/swtbot</target.platform.dir.swtbot>
<target.platform.dir.swtbot.plugins>${target.platform.dir.swtbot}/eclipse/plugins</target.platform.dir.swtbot.plugins>
<target.platform.dir.sdk>${target.platform.dir}/sdk</target.platform.dir.sdk>
<target.platform.dir.sdk.plugins>${target.platform.dir.sdk}/eclipse/plugins</target.platform.dir.sdk.plugins>
<target.platform.dir.deltapack>${target.platform.dir}/deltapack</target.platform.dir.deltapack>
<target.platform.dir.deltapack.plugins>${target.platform.dir.deltapack}/eclipse/plugins</target.platform.dir.deltapack.plugins>
<pdebuild.launcherVersion>1.2.0.v20110502</pdebuild.launcherVersion>
<pdebuild.plugin.version>3.7.0.v20111116-2009</pdebuild.plugin.version>
<pdebuild.antDelegateBuildfile>${pdebuild.configDirectory}/pdebuild-ant-from-mvn.xml</pdebuild.antDelegateBuildfile>
<pdebuild.configDirectory>${basedir}/pdebuild</pdebuild.configDirectory>
<pdebuild.buildDirectory>${project.build.directory}/${pdebuild.directory}</pdebuild.buildDirectory>
<pdebuild.directory>pde-build</pdebuild.directory>
</properties>
I then call ant build from Maven like this:
<!-- Delegate execution to PDE/Build via ant -->
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>compile</phase>
<configuration>
<target>
<ant antfile="${pdebuild.antDelegateBuildfile}">
<property name="equinoxLauncherPluginVersion" value="${pdebuild.launcherVersion}" />
<property name="pdeBuildPluginVersion" value="${pdebuild.plugin.version}" />
<property name="projectsDirectory" value="${basedir}" />
<property name="baseLocation" value="${target.platform.dir}" />
<property name="buildDirectory" value="${pdebuild.buildDirectory}" />
<property name="builder" value="${pdebuild.configDirectory}" />
<property name="product" value="${gui.product}"/>
<property name="runPackager" value="${pdebuild.runPackager}"/>
</ant>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
I am happy with the set up now.