How to open my resource in that localhost:8080/test/index.html? - java

Tomcat started in eclipse and also I'm able to open the following URL in the browser:
http://localhost:8080/test/index.html
But, I'm not able to open my resource in that page.
Error that I am getting is:
HTTP Status 404 - /
type Status report
message http:/test/index.html
description The requested resource (/test/index) is not available.
Apache Tomcat/6.0.29

Please, try the following steps in eclipse to deploy the project as a WAR File and not as an EAR File:
In the Project Explorer right click on test (which is the name of your project, if I got it right)
In the context menu choose Export->WAR file
In the dialog window that pops up click the Browse... button to choose the destination folder for the deployment. This should be the web application folder of your Tomcat installation: <TOMCAT_INSTALLATION>/webapps where <TOMCAT_INSTALLATION> is the folder you have installed Tomcat in.
Click Finish
Now start your Tomcat server. Assuming you have the index.html file in the WebContent folder of the test project in Eclipse, you should see the content of index.html in your browser when you open the URL.

Related

Cannot run/debug jsp page from within IntelliJ using Tomcat server

I created a new project and created artifact for it.
When I run Tomcat from command prompt and go to: http://localhost:8080/IntelProject1/index.jsp
I can see my page.
But when I try to run it from IntelliJ, it opens empty page:
http://localhost:8080
and if I try to go to:
http://localhost:8080/IntelProject1/index.jsp
this is what it displays:
HTTP Status 404 - /IntelProject1/index.jsp
type Status report
message /IntelProject1/index.jsp
description The requested resource is not available.
Apache Tomcat/7.0.57
The reason it is able to find it from tomcat is because I edited server.xml file in tomcat/conf folder:
<Context path="/IntelProject1" docBase="C:\Users\ibogojevic\Desktop\IntelProject1\web\JSP" />
But I want to be able to open it and debug from within IntelliJ
Maybe my artifact is wrong.
Any thoughts?
Open Debug Configuration in IntelliJ IDEA and make sure that Deploy applications configured in Tomcat checkbox is checked as it shown on the screenshot.
For me it worked with:
File >Project Structure >Artifacts
In the
Output Layout on the right side >"Available Elements?"
right click on the available libraries ( for me it was "Spring MVC-4.2.4.RELEASE")
Put into Lib
And it worked.

Uploading app to Web App Engine in IntelliJ

I'm trying to deploy my app to Web App Engine. I have WAE module in web part of my project; there is a path specified in Modules/web/Google App Engine:
/Users/Kamil/IdeaProjects/appengine-java-sdk-1.9.12/
Although when I click on we in general (Modules/web/"Paths" tab), I see following settings:
Output path:
/Users/Kamil/IdeaProjects/NameOfMyProject/web/target/web-1.0.0-SNAPSHOT/WEB-INF/classes
The problem is:
When I click "Upload Web App Engine Application" following error appears:
Bad configuration: Could not locate
/Users/Kamil/IdeaProjects/NameOfMyProject/web/target/web-1.0.0-SNAPSHOT/WEB-INF/appengine-web.xml
I don't get it why it tries to search in wrong directory, not the one specified in Modules. Please advise.
Edit
I noticed that in Modules/web/"Sources" tab whole folder named "target" is excluded. Maybe that's the problem?
According to the error message
Bad configuration: Could not locate
/Users/Kamil/IdeaProjects/NameOfMyProject/web/target/web-1.0.0-SNAPSHOT/WEB-INF/appengine-web.xml
, the deployment code is looking for appengine-web.xml, a crucial config file for your App Engine app. It's looking for that file here:
/Users/Kamil/IdeaProjects/NameOfMyProject/web/target/web-1.0.0-SNAPSHOT/WEB-INF/appengine-web.xml
Is it possible that the file
/Users/Kamil/IdeaProjects/NameOfMyProject/web/target/web-1.0.0-SNAPSHOT/WEB-INF/appengine-web.xml
could not be located ("Bad configuration: Could not locate ") because the file
/Users/Kamil/IdeaProjects/NameOfMyProject/web/target/web-1.0.0-SNAPSHOT/WEB-INF/appengine-web.xml
does not exist?
The path /Users/Kamil/IdeaProjects/appengine-java-sdk-1.9.12/ is the path to your SDK, not the target folder, and is not related to this issue.
The target file is excluded from "sources" because "sources" is the location of files that are included as source code into the build. The target folder is the opposite of source files - it's the flattened-out WAR archive that is used to deploy your app. The deployment tool you use will pack it up into a .war file and send that to the App Engine data centers.
Finally, the output path folder .../classes is where the compiled .java files that turn into .class files for your app are put.
I think you should look into some tutorials on IntelliJ and App Engine to make sure that your project was created and configured properly.
Good luck!
One you can do that locate build folder in explorer and delete it. After that reopen android studio build it again and run it. Now every thing is fine.

A WAR file created from Eclipse does not work from browser, but it works when the war file is expanded

I created a simple HelloWorld project in Eclipse. It runs within Eclipse fine.
When I created a WAR file, it does not. The WAR file's name is test.war, and the file is placed in webapps\ROOT\temp.
I tested as localhost:8080/temp/test.
The error message is
HTTP Status 404 - /temp/test
type Status report
message /temp/test
description The requested resource is not available.
I unzipped the war file as "jar -cvf test.war" in the same directory.
The war file contains index.jsp, and when unzipped, it works when I tested as localhost:8080/temp/
Any idea why the index.jsp is not picked up from the war file?
A WAR works only when deployed.
Deployment occurs by expanding the archive.
Probably your server does not perform auto-deploy. If it did, you would see files loaded not from the WAR, but from the expanded directory

GlassFish Quandary

I am trying to install GlassFish (on a Mac) as directed by a book on Core JSF. When I go to
http://localhost:8080
I see the page as displayed in the book, with no problems. However, when I copy the login.war file to the directory specified in the book and try to go to the login page
http://localhost:8080/login
I simply see a 404 Error.
I /think/ I have copied the file correctly. What does this indicate? By virtue of the fact that I am able to see the page
http://localhost:8080
correctly does this mean that GlassFish has been appropriately installed? What does the 404 Error likely mean? Thanks. Conor.
The 404 error is the HTTP page not found error. This means, the page you are trying to access does not exist. I believe your application is not deployed on the server.
To deploy your application, go to server admin page localhost:4848 click on application from the navigation menu. From there click on Deploy and browse to the file location. You can also specify the context root where your application should be deployed.
However, your application might be deployed on the server with a different context root.
If you have a glassfish descriptor, then you can check your context root from there. However, If you do not have a glassfish descriptor then you need to create one.
In this descriptor you need to define your context root name.
<context-root>/foobar</context-root>
this means the application will be deployed on localhost:8080/foobar
Similarly, if you defined your context root as following:
<context-root>/</context-root>
Then your application will be deployed on localhost:8080/

Netbeans update, project no longer opens index page

Yesterday when I launched my java project, it opened a web browser and went to http://localhost:8080/ showing my application's login page. Today, after accepting the latest updates (bangs head against keyboard) it no longer loads my app and is loading the Glassfish index page...
GlassFish Server 3.1.2
Your server is now running
I've verified the context path of my app is correct and I'm really not sure what areas of netbeans other than project settings that I should take a look at.
from the comments above the problem is when you run project from netbeans
the url opens on
http://localhost:8080/
if thats the problem how i understands it then go to context.xml and make sure
there is path attribure like this
"just look at the path only"
<Context antiJARLocking="true" path="/account_2">
etc...
but as you said you already checked it "context path" but can you tell me which one
because there is context path in project properties in netbeans under RUN node
and there is also "specify relative url context path" option
netbeans-->projects---go to your project---> then right click then properties then go to run node under relative url put /account/login.html this should make it work

Categories