0

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

user3474126
  • 63
  • 1
  • 12
  • I think I need to package my web application instead of export to zip? Google says there should be an option tab in Properties -> Build. I have ONLY a Compile tab there – user3474126 Apr 20 '15 at 00:17
  • Am I supposed to add a plugin to Netbeans to give me more Build options such as Package? – user3474126 Apr 20 '15 at 00:21
  • yes, you need to package your app as an war-file. Is it possible to use maven and the pom.xml. Right click on the pom.xml and "maven -> package" should with a little bit of luck generate you a war-file. Upload this file. – daniel Apr 20 '15 at 00:24
  • thankyou daniel. i am working with a Maven project however i have no Package option or tab anywhere (it is supposed to be next to Compile in Properties->Build, however i have ONLY a Compile tab). am i supposed to add a plugin to get this options? – user3474126 Apr 20 '15 at 00:26
  • i think i didnt install Java EE correctly? trying to figure out how to do that now.................... – user3474126 Apr 20 '15 at 00:48
  • In Netbeans (Run -> Build Project) or F11. Change from Projects to Files. There will be an target folder. Within that target folder, there will be the war-file. Or you can rightclick the pom.xml and choose Run Maven -> Goals and type package as the Goal to execute. After this you will find the war in the target folder – daniel Apr 20 '15 at 00:48
  • OH MY GOD. thankyou so much. i was spending all this time trying to figure out how to install java EE . i still dont know if i have it or if i had it . my netbeans still has no Run->Build->options or anything other than Compile in Properties->Build. HOWEVER the maven idea worked. i'm so glad you knew about it. how are people supposed to do programming without relying 100% on others? thanks again. – user3474126 Apr 20 '15 at 01:16

1 Answers1

1

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.

user3474126
  • 63
  • 1
  • 12
  • it appears that when i create a standard java web application i do have options under Properties Build to Package. HOWEVER nomatter what type of project i create, my plugin entitled Java Web and EE is set to inactive and the button to Activate it is greyed out. – user3474126 Apr 20 '15 at 01:35