12

I am not able to run maven java web application project to the configured tomcat within eclipse ide.

Initially I could right click on the project and run it on tomcat server but ever since I shared the project to a repository I am not able to do that.

I disconnected the project form the repository and now I I dont even see the Run as -> Run on Server option inside eclipse ide.

I am using m2e plugin version .0.12.1 and eclipse helios and tomcat 6.

Could someone help me understand what am I missing here?

Thanks.

skip
  • 12,193
  • 32
  • 113
  • 153
  • I just installed Maven Integration for WTP .0.12.0 plugin but that didn't help either. – skip May 28 '12 at 22:22
  • What is the type of project? is it a dynamic web project or maven project? – Priyank Doshi May 30 '12 at 11:17
  • @PriyankDoshi: It is a Maven Webapp. – skip Jun 02 '12 at 10:04
  • I dont think maven has such option.Even we do use same.What practice we follow is manually copy war file in server and run it. – Priyank Doshi Jun 02 '12 at 10:08
  • @PriyankDoshi: http://img337.imageshack.us/img337/2102/mavenarchetypewebapp.jpg is how I created the project. I have got locally working it alright using a local repository but somehow I acnt figure out that why is it not working likewise in remote repository. – skip Jun 02 '12 at 10:15
  • Its same.We create maven project with same. – Priyank Doshi Jun 02 '12 at 10:17
  • If you are familiar with .bat file for windows, you can write one for all this stuff. We did it. Every time, we run the .bat file only – Priyank Doshi Jun 02 '12 at 10:18
  • @PriyankDoshi: I don't remember using .bat for anything else than starting up a tomcat instance from command line. What do you think could be the reason behind the behavior I am seeing? – skip Jun 02 '12 at 10:58

6 Answers6

12

PROBLEM

When you try to run the project on the server using "Run on Server" (SA+X+R) option, eclipse returns the following message: The selection did not contain any resources that can run on a server.

SOLUTION

On the navigation panel, click over the project for pop-up menu, properties, Project Facets, check: - Dynamic Web Module - Java It worked for me try this may be this is your problem

Nagaraj
  • 121
  • 1
  • 6
2

Maybe you sholud update two file in .settings folder in your web project: .settings/.jsdtscope

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/WebContent"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
    <attributes>
        <attribute name="hide" value="true"/>
    </attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>

.settings/org.eclipse.wst.common.component

<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="Web">
    <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
    <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
    <wb-resource deploy-path="/" source-path="/src/main/WebContent" tag="defaultRootSource"/>
    <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
    <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test"/>
    <property name="java-output-path" value="/Web/build/classes"/>
    <property name="context-root" value="shequwang-web"/>
</wb-module>

change the path="src/main/WebContent" value's as yours in the two files,then restart the IDE.After I done this,it was work well again.

zhoufoxcn
  • 101
  • 1
  • 4
1

I faced this issue recently in STS
After following below steps error disappeared .

  1. Check default JRE version configured in IDE and check JRE System Library version showing in project
  2. If versions are different ,make them same first .
  3. Now right click on Project and select properties .
  4. Select on Project facets and choose Dynamic Web Module
  5. Refresh the Project.
user3123256
  • 161
  • 1
  • 4
0

I don't know if you solved your problem, but I had the exact same problem and could never fix it. Then I saved all my projects, deleted everything else, started Eclipse from 0 as if it had been just downloaded, re-installed plugins and started new projects copying my older projects' stuff. Yes, it took me like an hour and it's not an expert solution but sometimes it's better to just start over.

Maco
  • 741
  • 6
  • 5
  • Sorry for the deplayed reply, hadn't accessed stackoverflow for sometime now. Just like you I could never fix the problem because I am not sure if there was problem. Once the project was checked in to a remote repository I could only use the console to see the logs(application logs) and everything, besides downloading the huge remote log file. Example, I had to run, `mvn tomcat:run` from within the project directory. Thanks for the reply. – skip Aug 18 '12 at 17:57
0

copy your project to the other location. go to eclipse and right click on Project and expand runAs. click maven install. if problem presists, remove the project and import it again.

hamidreza75
  • 567
  • 6
  • 15
0

you placed it in wrong folder remember java code in src and UI files in webapp