user3474126
user3474126

Reputation: 63

How do I point the web server to my web application?

I am ready to upload my web application to an online server. I picked the first one I saw opened on youtube which is Jelastic Cloud.

My web application looks like this (UPDATE: it added a glassfish-web.xml, see below)

enter image description here

I usually run it by rightclicking index.jsp and running that which opens index.jsp webpage in my web browser.

In Netbeans I went to Export -> Export as zip. Then I went and made sure the file was a .zip file.

I create an environment in Jelastic. It is set to Java by default. I changed the setting Tomcat to Glassfish 4.1 because I am using glassfish with netbeans and saw that option there.

I deploy my websitetest1.zip to the environment by clicking Deploy.

When it finishes, I click on Open in Browser.

A browser page opens and says:

HTTP Status 404 - Not Found

type Status report

messageNot Found

descriptionThe requested resource is not available.

GlassFish Server Open Source Edition 4.1

When I look in Jelastic's log for glassfish it says:

[2015-04-19T23:28:15.233+0000] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=45 _ThreadName=admin-listener(5)] [timeMillis: 1429486095233] [levelValue: 800] [[
  visiting unvisited references]]

[2015-04-19T23:28:15.245+0000] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=45 _ThreadName=admin-listener(5)] [timeMillis: 1429486095245] [levelValue: 800] [[
  visiting unvisited references]]

[2015-04-19T23:28:15.250+0000] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=45 _ThreadName=admin-listener(5)] [timeMillis: 1429486095250] [levelValue: 800] [[
  visiting unvisited references]]

[2015-04-19T23:28:15.365+0000] [glassfish 4.1] [INFO] [AS-WEB-GLUE-00172] [javax.enterprise.web] [tid: _ThreadID=45 _ThreadName=admin-listener(5)] [timeMillis: 1429486095365] [levelValue: 800] [[
  Loading application [ROOT] at [/]]]

[2015-04-19T23:28:15.478+0000] [glassfish 4.1] [INFO] [] [javax.enterprise.system.core] [tid: _ThreadID=45 _ThreadName=admin-listener(5)] [timeMillis: 1429486095478] [levelValue: 800] [[
  ROOT was successfully deployed in 429 milliseconds.]]

[2015-04-19T23:28:30.034+0000] [glassfish 4.1] [WARNING] [] [javax.enterprise.system.container.web.com.sun.web.security] [tid: _ThreadID=28 _ThreadName=http-listener-1(2)] [timeMillis: 1429486110034] [levelValue: 900] [[
  Context path from ServletContext:  differs from path from bundle: /]]

[2015-04-19T23:28:42.047+0000] [glassfish 4.1] [SEVERE] [] [org.apache.jasper.servlet.JspServlet] [tid: _ThreadID=29 _ThreadName=http-listener-1(3)] [timeMillis: 1429486122047] [levelValue: 1000] [[
  PWC6117: File "null" not found]]

I Googled and people were saying to set context path so I right-clicked my project, went to Run setting and changed context path from /g5 to g5 . This created a glassfish-web.xml file.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
  <context-root>g5</context-root>
  <class-loader delegate="true"/>
  <jsp-config>
    <property name="keepgenerated" value="true">
      <description>Keep a copy of the generated servlet class' java code.</description>
    </property>
  </jsp-config>
</glassfish-web-app>

I rezipped my project to webTEST3 and uploaded it to Jelastic and clicked deploy. When I open it in browser the same 404 thing happened

[2015-04-19T23:56:59.344+0000] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=43 _ThreadName=admin-listener(3)] [timeMillis: 1429487819344] [levelValue: 800] [[
  visiting unvisited references]]

[2015-04-19T23:56:59.571+0000] [glassfish 4.1] [INFO] [AS-WEB-GLUE-00172] [javax.enterprise.web] [tid: _ThreadID=43 _ThreadName=admin-listener(3)] [timeMillis: 1429487819571] [levelValue: 800] [[
  Loading application [ROOT] at [/]]]

[2015-04-19T23:56:59.597+0000] [glassfish 4.1] [INFO] [] [javax.enterprise.system.core] [tid: _ThreadID=43 _ThreadName=admin-listener(3)] [timeMillis: 1429487819597] [levelValue: 800] [[
  ROOT was successfully deployed in 430 milliseconds.]]

[2015-04-19T23:57:07.392+0000] [glassfish 4.1] [WARNING] [] [javax.enterprise.system.container.web.com.sun.web.security] [tid: _ThreadID=30 _ThreadName=http-listener-1(4)] [timeMillis: 1429487827392] [levelValue: 900] [[
  Context path from ServletContext:  differs from path from bundle: /]]

[2015-04-19T23:57:15.132+0000] [glassfish 4.1] [SEVERE] [] [org.apache.jasper.servlet.JspServlet] [tid: _ThreadID=28 _ThreadName=http-listener-1(2)] [timeMillis: 1429487835132] [levelValue: 1000] [[
  PWC6117: File "null" not found]]

[2015-04-19T23:58:26.911+0000] [glassfish 4.1] [SEVERE] [] [org.apache.jasper.servlet.JspServlet] [tid: _ThreadID=28 _ThreadName=http-listener-1(2)] [timeMillis: 1429487906911] [levelValue: 1000] [[
  PWC6117: File "null" not found]]

The index.jsp of my application is located at webTEST3.zip\g5\src\main\webapp . But I'm guessing the web server will know where to find that and I shouldn't need to type something like http://myshit/index.jsp to get to it? Or http://myshit/g5?

There is no .jar file in the zip anywhere.

Thankyou for reading. I think I am close and I will keep Googling

I am trying to Package my project however I have no Package option whatsoeever. How can I get this option? Here are my currently installed plugins. My project is a maven project.

enter image description here

Upvotes: 0

Views: 1655

Answers (1)

user3474126
user3474126

Reputation: 63

User daniel gave me a fix. My project is a maven project so I can rightclick my pom file -> Run Maven -> Goals and enter "package" as a goal and click go. This appears to have given me the path to a SNAPSHOT.jar. I uploaded this to my web server, deployed it and it worked.

Upvotes: 1

Related Questions