I get 404 while deploying Tomcat and calling localhost://8080

已回答

I have a simple HelloWorld Apache Wicket Project (Dont mind just a Test :D) . The Server starts and Artifact deploys successfully but  When i call localhost, I get 404 Error. I Changed the ApplicationContext to "/" but the Error keeps coming. Does anyone know why this happens? 

Greetings,

Xaver

 

评论操作 固定链接

Hello Xaver,

Have you checked server logs?

0
评论操作 固定链接

Hi Yaroslav,

Thanks for your answer. Yes I did, the output tells me everything is running:

I deploy my Project as an external source not as a artifact but it is getting deployed. Do you think this could be the reason for the 404 error?  

So like this:

0
评论操作 固定链接

Am I got you right that you deploy folder with application files? Yes, it could be the reason. Why don't you use artifact?

0
评论操作 固定链接

When I use artifact i get ClassNotFoundException or other errors for some reason. I tried it with every kind of artifact. What would you suggest me to use?

0
评论操作 固定链接

Could you please share your project for investigation?

0
评论操作 固定链接

Thank you, can you tell me your email adress for sharing my project? 

0
评论操作 固定链接

Sorry, but that's the link to Dropbox main page, not for the shared project.

0
评论操作 固定链接

Thanks! I'm not sure that it's a correct project structure. Does it work if you manually deploy it on Tomcat (without using IDE)? Probably it's better to start with some examples: https://dzone.com/articles/wicket-setting-project, https://virgo47.wordpress.com/2011/02/20/starting-with-wicket-on-intellij-idea/

0
评论操作 固定链接

Okey Thank you. What kind of Artifact should i use instead of the Projects folders? 

0
评论操作 固定链接

"WAR exploded" should be used. I could be generated automatically by IDE when you import properly configured Maven project.

0
评论操作 固定链接

I am getting the same HTTP status 404 not found error.I am new to Intellij IDEA so please tell me where did i most probably make mistake.

0
评论操作 固定链接

@Hardikvariya98 could you please provide a demo project, to reproduce a problem?

0
评论操作 固定链接

Hi, I have the same error. Please assist to resolve it. 

@WebServlet(name = "FirstServlet")
public class FirstServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

}

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter pw = response.getWriter();
pw.println("<html>");
pw.println("<h1> Hello world! </h1>");
pw.println("</html>");

}
}

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
<servlet>
<servlet-name>FirstServlet</servlet-name>
<servlet-class>FirstServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>FirstServlet</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping>
</web-app>
0
评论操作 固定链接

http://localhost:8080/hello

HTTP Status 404 – Not Found


Type Status Report

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.


Apache Tomcat/8.5.57

0
评论操作 固定链接

[2020-07-27 04:43:49,601] Artifact JavaEETest:war exploded: Artifact is deployed successfully
[2020-07-27 04:43:49,601] Artifact JavaEETest:war exploded: Deploy took 582 milliseconds

0
评论操作 固定链接

Hello Yana,

Please share sample project for investigation.

0
评论操作 固定链接

Hi, https://github.com/yanamak89/testservlet

 

And also after adding FirstJsp.jsp i got yellow pop up with message:

"Is possible to bind and connect to localhost:1099 at same time - application server will probably complete with some other software on the port"(its visible only 1 sec) and then after this next yellow pop up appears:

"Application Server was not connected before run configuration stop, reason:

com.intellij.javaee.oss.admin.jmx.JmxAdminExceprtion: java.util.concurrent.ExecutionException:

java.land.Security.Exception:Authentication failed! Invalid user name or password "

0
评论操作 固定链接

TomCat localHost logs: 

/Users/yanamac/Desktop/programming/apache-tomcat-8.5.57/bin/catalina.sh run
NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
[2020-07-27 10:40:41,064] Artifact JavaEETest:war exploded: Waiting for server connection to start artifact deployment...
Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 1099; nested exception is:
java.net.BindException: Address already in use
jdk.internal.agent.AgentConfigurationError: java.rmi.server.ExportException: Port already in use: 1099; nested exception is:
java.net.BindException: Address already in use
at jdk.management.agent/sun.management.jmxremote.ConnectorBootstrap.startRemoteConnectorServer(ConnectorBootstrap.java:491)
at jdk.management.agent/jdk.internal.agent.Agent.startAgent(Agent.java:447)
at jdk.management.agent/jdk.internal.agent.Agent.startAgent(Agent.java:599)
Caused by: java.rmi.server.ExportException: Port already in use: 1099; nested exception is:
java.net.BindException: Address already in use
at java.rmi/sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:335)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:243)
at java.rmi/sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:412)
at java.rmi/sun.rmi.transport.LiveRef.exportObject(LiveRef.java:147)
at java.rmi/sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:234)
at java.rmi/sun.rmi.registry.RegistryImpl.setup(RegistryImpl.java:220)
at java.rmi/sun.rmi.registry.RegistryImpl.<init>(RegistryImpl.java:180)
at jdk.management.agent/sun.management.jmxremote.SingleEntryRegistry.<init>(SingleEntryRegistry.java:49)
at jdk.management.agent/sun.management.jmxremote.ConnectorBootstrap.exportMBeanServer(ConnectorBootstrap.java:836)
at jdk.management.agent/sun.management.jmxremote.ConnectorBootstrap.startRemoteConnectorServer(ConnectorBootstrap.java:479)
... 2 more
Caused by: java.net.BindException: Address already in use
at java.base/sun.nio.ch.Net.bind0(Native Method)
at java.base/sun.nio.ch.Net.bind(Net.java:469)
at java.base/sun.nio.ch.Net.bind(Net.java:458)
at java.base/sun.nio.ch.NioSocketImpl.bind(NioSocketImpl.java:643)
at java.base/java.net.ServerSocket.bind(ServerSocket.java:374)
at java.base/java.net.ServerSocket.<init>(ServerSocket.java:260)
at java.base/java.net.ServerSocket.<init>(ServerSocket.java:151)
at java.rmi/sun.rmi.transport.tcp.TCPDirectSocketFactory.createServerSocket(TCPDirectSocketFactory.java:45)
at java.rmi/sun.rmi.transport.tcp.TCPEndpoint.newServerSocket(TCPEndpoint.java:670)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:324)
... 11 more
Disconnected from server

0
评论操作 固定链接

Logs after third commit

27-Jul-2020 22:56:19.043 WARNING [RMI TCP Connection(5)-127.0.0.1] org.apache.tomcat.util.descriptor.web.WebXml.setVersion Unknown version string [4.0]. Default version will be used.
[2020-07-27 10:56:19,591] Artifact JavaEETest:war exploded: Artifact is deployed successfully
[2020-07-27 10:56:19,591] Artifact JavaEETest:war exploded: Deploy took 642 milliseconds

 

But if im truing to see firstJsp using http://localhost:9090/WEB-INF/firstJsp.jsp I can see 404 error

HTTP Status 404 – Not Found


Type Status Report

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.


Apache Tomcat/8.5.57

0
评论操作 固定链接

After adding url-pattern to web.xml (please see commit message: Adding jsp-file in to web.xml)

the same error yellow pop up with the message:

"Is possible to bind and connect to localhost:1099 at same time - application server will probably complete with some other software on the port"(its visible only 1 sec) and then after this next yellow pop up appears:

"Application Server was not connected before run configuration stop, reason:

com.intellij.javaee.oss.admin.jmx.JmxAdminExceprtion: java.util.concurrent.ExecutionException:

java.land.Security.Exception:Authentication failed! Invalid user name or password "

0
评论操作 固定链接

Yana,

Please try to follow this guide: https://codegym.cc/groups/posts/51-creating-the-simplest-web-project-in-intellij-idea-enterprise-step-by-step-with-pictures, so you'll get sample web app. Check that it works. Then add your firstJsp.jsp and servlet:

@WebServlet("/FirstServlet")
public class FirstServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

}

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter pw = response.getWriter();
pw.println("<html>");
pw.println("<h1> Hello world! </h1>");
pw.println("</html>");


}
}

Now run your application. It should show index page, but if you add "/FirstServlet" to the URL it'll show "firstJsp" page.
0
评论操作 固定链接

Problem

Hi,

I have an issue about intelliJ and Tomcat Server with Maven

[en] description: resource not available

/* ------------------------------------ */

But I configure my tomcat server as asked but it doesn't seem to work

/* ------------------------------------ */

And the logs (sorry for the french version)

The project seems to work on an Eclipse project (my other teammates can run the project on their environment)... have you any idea where the bug is ?

.

.

.

EDIT: Problem solved 

The issue coming from a configuration from the deployment tools "application context". On my URL, the server was redirecting on http://localhost:8080/location-voiture/ but the URL was lunch on http://localhost:8080/location_voiture_war_exploded/ so I have to manage it like that (I also run the artifact war only)

4
评论操作 固定链接

Thanks David Thomas for pointing out . I was doing the same mistake.

0
评论操作 固定链接

If anyone thinks "Application context" is not displayed, try scrolling down:

0
评论操作 固定链接

Hello) I have the same problem and tried all the variants (exploded/not-exploded artifacts), but without any success:

(Github:    https://github.com/Sergei-Gots/simple-JAX-RX-implementation.git 

HTTP Status 404 - not found

Message The requested resource [/simple_webapp/] is not available

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

server log ends with:

[2022-06-01 01:27:50,666] Artifact simple-JAX-RX:war exploded: Artifact is deployed successfully
[2022-06-01 01:27:50,666] Artifact simple-JAX-RX:war exploded: Deploy took 2,461 milliseconds
01-Jun-2022 01:27:57.795 INFO [Catalina-utility-1] org.apache.catalina.startup.HostConfig.deployDirectory Установка веб приложения в папку [C:\Program Files\Apache Software Foundation\Tomcat 10.0\webapps\manager]
01-Jun-2022 01:27:58.016 INFO [Catalina-utility-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [C:\Program Files\Apache Software Foundation\Tomcat 10.0\webapps\manager] has finished in [221] ms

 

Run Configuration:

TYA

 

 

 

0
评论操作 固定链接

Hello,

What URL do you open? It should be "http://localhost:8080/simple_JAX_RX_war_exploded/rest/hello". Also you need to add this dependency:

<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
0
评论操作 固定链接

Hello.

I did: added javax.xml.bind in dependecy, cleaned and rebuilt.

But unfortunately, nothing changed. Still have the same problem "resource not found 404"

Yes, I try to use different variations of http-requests. And In case I input 

"http://localhost:8080/simple_JAX_RX_war_exploded/rest/hello" 

or any other address begins with http://localhost:8080

i get 

Type Status Report

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

 

and there is the only "specific" case when i input 

http://localhost:8080/simple_JAX_RX_war_exploded/

there will be an additional message displayed:

Message The requested resource [/simple_JAX_RX_war_exploded/] is not available 

0
评论操作 固定链接

Could you please attach screenshot from "Project Structure | Artifacts"?

0
评论操作 固定链接

"Project Structure | Artifacts":

 

 

0

请先登录再写评论。