Getting Tomcat to Serve up pages in Eclipse - java

I'm able to run local host and see the Apache Tomcat congratulations screen. In Eclipse I have a src/main/webapp/index.jsp file. When I start up my server I want to see this page, but it just displays the default Tomcat page. How do I get Tomcat to serve up my Eclipse files rather than the default page in Tomcat? Thank you.

Related

Tomcat 6 is running in Eclipse but localhost:8080 never responds in browser

I integrated Tomcat 6 into Eclipse Indigo. When I start the server in Eclipse, it shows that Tomcat is up and running, but when I go to localhost:8080 in my browser, it does not respond at all.
I have Tomcat server entry in the Servers tab with "Use Tomcat Installation" and it didnt help me.
I have removed my entire projects from eclipse and started importing it again to set it up from the beginning and it didnt help either.
Could you please some help me out?
It is most probable that you are running Tomcat from eclipse as Use workspace metadata (does not modify Tomcat installation). While running under metadata, tomcat's default welcome page is not deployed. So you wont be able to view the welcome page under localhost:8080/ but you can access your application with the application context in the url ( something like localhost:8080/yourApplicationContext/hello.jsp)
See below the image where you can set the server location. If you change it to Use Tomcat Installation, eclipse will use the actual installation of tomcat. You can even see this by deploying the application and then open up your file browser, navigate to tomcat directory and you will see your application deployed there in the webapps folder. But if you use use workspace metadata option, eclipse makes a stripped copy of your tomcat's installation and places it in the .metadata folder of the workspace. Something like eclipse_workSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\
The question as to which technique is better totally depends on your use.

How to deploy and run javafx application in tomcat

I have a requirement in my application ,Running the javafx application in browser from web-server. how can i achieve this thing.
Thanks in advance.
Solution
Place a copy of the jar, jnlp and html file output by the NetBeans build into a directory of your webserver, then access the html file in your browser.
For example, let's say you called your application MyPowerApp and netbeans output MyPowerApp.html and you wanted to deploy that to a local Tomcat server.
Download and install a copy of Tomcat (http://tomcat.apache.org/download-70.cgi)
Copy the jar, jnlp and html file into tomcat's webapps/ROOT directory.
Start tomcat.
Access your application via http://localhost:8080/MyPowerApp.html
The applet will start automatically and you can click on the link to launch the application via WebStart.
To update the application just rebuild it in NetBeans, copy it over into the tomcat webapps/ROOT directory and refresh your browser link (no need to restart Tomcat).
In practice you will want to modify the html rather than use the generated html to embed either the applet or WebStart link somewhere on your website (you won't need both execution modes in a single page like the Netbeans generated sample).
Background
JavaFX applications do not run in Tomcat.
Tomcat can be used to host a html page embedding a JavaFX application jar. A browser with the JavaFX plugin installed and activated can download the the JavaFX application from Tomcat and execute the application in the browser window using a Java runtime environment installed on the client browser machine. See the JavaFX Deployment Guide for more details and the JavaFX deployment quick start for short info on getting started.
Note that getting JavaFX to work correctly in a browser across a wide range of client machines may prove a difficult task for you, so you may want to investigate alternate deployment methods as outlined in the JavaFX deployment guide (such as WebStart, Standalone or Self-contained application deployment modes).

How to Deploy Eclipse servlet in mozilla or chrome browser? [duplicate]

I have create My First "Hello World" Servlet in Eclipse.
It is running properly in Eclipse Browser.
I'm using Apache Tomcat, and it is also running properly.
How can I deploy my Servlet in Web browser like Internet Explorer, Chrome, Mozilla Firefox etc? I don't want to deploy my servlet in Eclipse browser.
You don't deploy to a browser. You deploy to a server. Just deploy to server and start the server the usual way (as you did in Eclipse). Then, just enter the servlet's URL in the address bar of the webbrowser of your choice yourself. It can be exactly the same URL as you see in Eclipse browser's address bar. If necessary, bookmark this URL in your favourite webbrowser so that you don't need to copypaste/enter it yourself everytime.
Go to Window menu in eclipse then click on "web browser" then click on "Internet explorer".That't it.....
Firstly, servlets are not deployed in Browsers, they are deployed on server and accessed through browsers.
Secondly: what you can do is, just copy paste the URL from eclipse browser to mozilla or chrome to access your servlet. All that you have to make sure is that the tomcat server configured in your eclipse and on which application containing this servlet is deployed, is up and running.
If you want to access this without eclipse tomcat, goto the local tomcat installation, you should have a deploy folder there, create a war file of your webapplication and copy it to the deploy folder and start te tomcat server.
You deploy application in WebServer (Tomcat in your case) not in browsers.
In eclipse, add your application in tomcat server (in servers view), start the server and open a browser of your choice.
Then put in url http://localhost:8080/NameOfYourServlet
Just copy the url from eclipse browser and paste on url bar of which browser you need. There is no separate deploy for each browser. Another thing you can change your eclipse default browser.If you changed, project will start in browser you selected instead of eclipse browser.

alfresco tomcat not getting started

I downloaded alfresco CMS for java and i installed it but the tomcat installed by alfresco is not getting started. and thats why i cant use alfresco.
in event viewer log it says "The alfrescoTomcat service terminated with service-specific error 0 (0x0).
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp."
anyone has solution for this ????
It seems that unfit memory settings on the Windows Service can cause the issue you describe. To configure it, open the configuration window for the Alfresco service using (adjust the path accordingly):
C:\Alfresco\tomcat\bin\timcat6w //ES//AlfrescoTomcat
then on the Java tab try to adjust the values to fit your machine (e.g. you should not give the process more memory than the available physical RAM)
Sometimes it best to break out tomcat from Alfresco and to install Tomcat separately with version that installs Tomcat as a service. There are .exe installers for this.
Apache Tomcat can be found
https://tomcat.apache.org/download-80.cgi
After Tomcat is installed start it up in Services.msc, then validate if the Tomcat console comes up. http://localhost:8080, then deploy your alfresco war file.
I like this approach better since I can verify tomcat before I deploy Alfresco.

Trying to use tomcat with eclipse

I am trying to use tomcat with eclipse. I have installed it all and got the tomcat plugin installed. I have put a .war file in the webapps folder of tomcat and have made sure autodeploy is set to true. The problem I am having is that I can't get tomcat to run this .war file. The tomcat server is started and running as it tells me under the servers tab at the bottom of eclipse. It also shows the name of my .war file under it and says synchronized meaning it at least knows its there. But I can't get it to work at all. Even when I go to the local host page it shows the title of apache tomcat but does not show the file. I want it to show me the .war file. It has the correct xml files and everything in it. Any help is much appreciated.
You may try to check whether the application is deployed or not. You can directly go to the Tomcat directory to see this.
Another possible thing could be, you might be typing the incorrect url.
http://localhost:8080/[your_application]
where 8080 is the port you have specified for tomcat.
You need to let Eclipse publish your web project for you when using the Eclipse Tomcat plugin instead of trying to manually deploy it youself.
The Tomcat plugin for Eclipe supports hot deployment whereby you can change jsp's etc without having to manually redeploy your web application.
If you have a valid web project in eclipse then you can check that it is being deployed by looking at the Server View.
Window, Show View, Other, Server
This window should contain details of your Apache server. (If no server is listed then you'll need to right click on the list and set one up.)
To check that your application is being deployed right click on your server and select Add/Remove projects. Check that your web project is listed. If it is not listed under Configured Project then add it.
If your project does not appear in the list then it probably wasn't setup as a Dynamic Web Project. You can fix this by by right clicking on the project to bring up project properties and then clicking on facets and then enabling Dynamic Web Project.
It is also worth having the Console view visible when starting/stopping Tomcat so that you can see the server output.
Start tomcat from the command line (not eclipse) and see if your webapp shows up. It should if you have indeed created a valid war file. If it doesn't work, check the logs.
You shouldn't be manually deploying the war file if you are using eclipse to launch tomcat. Running tomcat from eclipse does not necessarily use the same default workspace as the standalone tomcat. Check the configurations for the 'server': it may be that the eclipse launched server's webapp folder is empty.
If for some reason your webapp failed to initialize properly (error in the descriptor, an uncaught exception in a context listener, ...) tomcat will unload it and you won't see anything at http://localhost:8080/yourwebapp.
Is it there in the list of applications in tomcat manager?
if you havent done this...then follow the steps...
Go to http://localhost:8080/
Go to Tomcat manager and check if your application is there in the list of deployed applications. Try redeploying or starting the application if running=false. It usually tells you what is wrong when you do that.

Categories