step one :
install apache tomcat version 9 or higher
C:\Program Files\Java\jdk1.8.0_131\jre
step 2 : conect java eclipse oxygen to the apache (setsuzoku dankai):
tool strip, help, install new software
work with : drop down arrow (select all available sites)
wait while it says panding...
drag down and check the check box with : web, XML, java EE something
wait...
eclipse will ask to be restarted, click yes.
step 3
in the package explorer right click the project folder,
project, web, arrow next to web, dynamic web project
step 4
new run time, choose apache tomcat 9
in browse select the apache install directory
it should be in C:\Program Files\Apache Software Foundation\Tomcat 9.0
finish to exit the new run time sub dialog box and on the main dialog box:
give the project a name
step 5 :
right click the web project you created, configure, convert to maven project
search the maven depository (https://mvnrepository.com) for : glassfish jersey
choose version 2.26 to get to :
https://mvnrepository.com/artifact/org.glassfish.jersey.core/jersey-client/2.26
open port.xml in the project in the package explorer under web-inf
click its dependency tab, add, and fill in the data from the link to the eclipse IDE.
click the pom.xml tab.
step 6 :
paste this above the build tag :
<dependencies>
<!-- https://mvnrepository.com/artifact/org.glassfish.jersey.core/jersey-client -->
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.26</version>
</dependency>
</dependencies>
(I just copied it from the jersey maven link)
so it looks like :
step 7 :
add a class
step 8 :
right click project name folder, java ee tools, generate stub to create the web.xml
problems :
1 error message when running :
Several ports (8005, 8080, 8009) required by Tomcat v9.0 Server at localhost are already in use. The server
may already be running in another process,
or a system process may be using the port. To start this server you will need to stop the other process
or change the port number(s).
2 what to put in the web.xml ?
3 in what url is the message ?
4 I tried reinstalling apache now my error is :
install apache tomcat version 9 or higher
C:\Program Files\Java\jdk1.8.0_131\jre
step 2 : conect java eclipse oxygen to the apache (setsuzoku dankai):
tool strip, help, install new software
work with : drop down arrow (select all available sites)
wait while it says panding...
drag down and check the check box with : web, XML, java EE something
wait...
eclipse will ask to be restarted, click yes.
step 3
in the package explorer right click the project folder,
project, web, arrow next to web, dynamic web project
step 4
new run time, choose apache tomcat 9
in browse select the apache install directory
it should be in C:\Program Files\Apache Software Foundation\Tomcat 9.0
finish to exit the new run time sub dialog box and on the main dialog box:
give the project a name
step 5 :
right click the web project you created, configure, convert to maven project
search the maven depository (https://mvnrepository.com) for : glassfish jersey
choose version 2.26 to get to :
https://mvnrepository.com/artifact/org.glassfish.jersey.core/jersey-client/2.26
open port.xml in the project in the package explorer under web-inf
click its dependency tab, add, and fill in the data from the link to the eclipse IDE.
click the pom.xml tab.
step 6 :
paste this above the build tag :
<dependencies>
<!-- https://mvnrepository.com/artifact/org.glassfish.jersey.core/jersey-client -->
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.26</version>
</dependency>
</dependencies>
(I just copied it from the jersey maven link)
so it looks like :
Code:
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<version>2.26</version>
<packaging>war</packaging>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.glassfish.jersey.core/jersey-client -->
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.26</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
</project>
step 7 :
add a class
Code:
package com.katonWeb;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@Path("/message")
public class helloWeb {
@GET
@Path("/msg")
public String getMsg() {return "katon gouka mekyaku";}
}
step 8 :
right click project name folder, java ee tools, generate stub to create the web.xml
problems :
1 error message when running :
Several ports (8005, 8080, 8009) required by Tomcat v9.0 Server at localhost are already in use. The server
may already be running in another process,
or a system process may be using the port. To start this server you will need to stop the other process
or change the port number(s).
2 what to put in the web.xml ?
3 in what url is the message ?
4 I tried reinstalling apache now my error is :