Run JSP from netbeans project in Tomcat Server - java

Hi I already develop my application using Netbeans IDE.
Now I want to run my application in Tomcat server for actual use. I already copy my project to tomcat/webapps.
But when I tried to run my application:
http://localhost:8081/myAppFolder/
it gives me an error message :The requested resource (/Opportunities-Registration/) is not available.
I should change the url to make it work:
http://localhost:8081/Opportunities-Registration/web/index.jsp
How can I open my application using http://localhost:8081/myAppFolder/ insteand of http://localhost:8081/Opportunities-Registration/web/index.jsp ?
Update:
All my servlet is also become 404 not found
Thank you

SOLVED
Solution:
1. copy .war file which is contained in dist folder of your netbeans project
2. Place your .war file to tomcat/webapps
3. Start your tomcat
4. You are good to go

Related

Eclipse Java Servlet access to higher level directory

I've installed Eclipse with web development and during download have installed Tomcat7 to dir E:\Eclipse\tomcat7.
When in Eclipse and trying to test the program I'm getting a realPath of
C:/Users/user/Documents/eclipseJEEWorkspace/javaWebPages/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/org.example.web/WEB-INF/classes/
as my real path and not what I expect which is E:\Eclipse\tomcat7\webapps\org.example.web/WEB-INF/classes/
1) how do I get the real path of the servlet rather than the temporary path...
or am I missing something with how Eclipse uses the installed server? If this is the way then do I have to continuously create the WAR and fiddle around recreating/deleting all the time?
The reason for this is I'm also trying to get a JAVA Servlet getting access to a file in a path higher than webapps. I'm new to servlets....
My development includes third party software that all reference an individual file our.properties so changing the structure is unfortunately not a option.
My directory structure is:
/tomcat
/mycompany
/properties
our.properties //the file we want to access
/*otherfiles
/html
/*not used in this context but to show usage
/javascript
/*not used in this context but to show usage
/webapps
/org.example01.web
/META-INF
/WEB-INF
/org.example02.web
/META-INF
/WEB-INF
/org.example03.web
/META-INF
/WEB-INF
How do I tell my Servlet to access the our.properties file?
I've tried getPath, getResource but without getting the first bit to work, I doubt I'll be getting anywhere fast.
Thanks
When you run Tomcat under Eclipse, via the Tomcat plugin, the webapps path is changed. Eclipse uses .metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/ folder to deploy the project. That's not a temporary path, it's the actual path since your web application is deployed there.
If you run tomcat from command line, or as a service and deploy your web application, you'll see that the path of the servlet will be as you expected.
In order the change the default path to deploy for Eclipse, double click to your Tomcat under Servers view and modify Server locations section.

Eclipse: Run on server error

Hello I'm facing strange problem while trying to run the Dynamic web project on eclipse. I have attached the screenshot of the error message.
If I open localhost:8080/, I can see Apache Tomcat home page. But when I use localhost:8080/projectName, it gives 404 error, resource not found. I believe it is because of the error I'm getting while trying to run the project.
You can try manually deployment of your web project.
Create a war file of the dynamic web project and put that war file under webapps folder of your tomcat installation directory.
Then restart the server and test in browser by entering localhost:8080/your_projectName
If it runs then there is problem in eclipse.You can reconfigure server in your eclipse.

java.io.filenotfoundexception jboss project localhost

I've been working on web project written in jsp and running on jboss. I have problem after deployment of project. I'm getting an error after hitting localhost:8080/Myapp : java.io.filenotfoundexception Null/easyfile.properties <Can't find easyfile.properties>. I have this file in conf folder in my app directory. For sure I need to properly point to this file or place it somewhere in jboss installation folder but unfortunately I'm new to Java and 've been working with PHP but I've been assigned to client who has home site written as one jsp site with some xml. I need to change their frontend a little bit but I'm trying to set up my local environment without success.
Any help would be great.
Regards Adam

Tomcat server could not start

I am developing a dynamic web application on JBoss developer, but I am getting an error message:
Could not load the Tomcat server configuration at
\Servers\Tomcat v6.0 Server at localhost-config. The Servers project
is closed.
Even when I try to start the server on the servers tab, it doesn't start.
Any suggestions?
Sounds to me as if you're doing this inside Eclipse with WTP?
If so then you need to make sure that the Eclipse project called Servers which is created and maintained by WTP is open.
Open the Navigator view
Locate the Servers project
right-mouse click
Open Project
You have been closed server project in eclipse which will come by default after adding tomcat into eclipse. So try to open server project and start Tomcat it will Work..
Steps:
Go to project explorer.
Double click on server project.
You installed Tomcat v6 within eclipse using the “Add server” wizard and the “download and install” button.
You tried to start Tomcat and got the following error:
****“Could not load the Tomcat server configuration at /Servers/Tomcat v6.0 Server at localhost-config. The configuration may be corrupt or incomplete”****
How to solve:
1) . Close Eclipse
2) . Copy all files from TOMCAT_6_HOME/conf to WORKSPACE_FOLDER/Servers/Tomcat v6.0 Server at localhost-config
3) . Start Eclipse
4) . Expand the Servers project, click on the Tomcat 6 project and hit F5
5) . Start Tomcat from Eclipse
6) . Enjoy!!!
Just after many trying I got the solution for this problem. The problem is when your server is created using your IDE(Eclipse, JBoss or any) that time the server is not getting the configuration file. To resolve this problem you need to copy all the configuration files from the tomcat conf directory to your IDE server directory. If I will step out the solution than I can list the steps as-
Locate your Tomcat installation directory
Find the conf directory, sometime you will get it into skel directory
Copy all the files from conf and now change the directory to your IDE workspace
In Server directory paste all the files in your Tomcat configuration directory.
If you are using a Linux-based Eclipse:
Check user and group ownership and permissions to your server directory and subdirectories inside Eclipse. It MUST allow read-write config files by the current Eclipse user. Test it copying config files directly to it and, after that, accessing it through Eclipse text/xml editor.
It's usefull too to check the same for tomcat directory, because Eclipse may be bloked if its owner doesn't have permissions to access that files.
the solution to this problem is :
cd /usr/local/tomcat//conf
chmod 777 *
and it's done
I got the same issue. This is because it's missing "Servers" folder that contains Tomcat in Project Explorer. I already downloaded and configured my Tomcat, but after I created another new java web project, Server stopped working.
To solve this problem right click on "Tomcat v6.0 Server at localhost
[Strated,Synchronized]"
at bottom of your Eclipse.
click "General"
click "Switch Location"
click "Apply"
enter image description here
This usually happens when the "Close unrelated projects" button is clicked. A simple and straightforward solution to this issue:
Go to the bottom of the Project Explorer tab and there will be a project named "Servers". If it's closed, the icon will have a different color than the projects that are open.
Double-click on "Servers". Now the project will be open and this issue will get resolved.

Deploy a .rar on cloudfoundry using eclipse plugin

I am currently using the cloudfoundry eclipse plugin to deploy my JSP/Servlet web application. My application is now using a Db (Sqlite). However I am having problem deploying the sqlitejdbc.rar to cloudfoundry (all i do to update the application is right click on my application under VMware Cloud-foundry server and select update. But that doesn't seem to work and i get an exception saying that it cant find the rar file.
In my local system i simply paste the sqlitejdb.rar to the lib directory of Tomcat and when i run the webapp locally it works
If you place the sqlitejdbc.rar file into your lib directory (inside your WEB-INF directory) that should get deployed as part of your application into cloudfoundry and become accessible.
You can also try to deploy your app using vmc push to see what errors you get from vmc.
I also recommend looking at the log files on cloudfoundry.com

Categories

Resources