tomcat6 application deployment error - deployment

I am new to tomcat and servlets and am trying to deploy my first web application in tomcat and the index.jsp page is showing up blank.
It works fine in eclipse. I have the web.xml for the application setup to have the index.jsp as the default page. I am able to run the application and debug it in eclipse but when I export it as a WAR file and deploy it in tomcat and try to access it through a regular browser I get a blank page.
What am I missing here? Any help is greatly appreciated.
Thanks,
- Vas

If you ever get a blank page, the most important information you (and we) need are:
The request URL.
The already sent data -if any- (webbrowser > View Source).
The response headers (Firebug? Webdeveloper Toolbar?).
The server logs (stdout, stderr, webapp).
This usually indicate a wrong URL (to be proven by 1), or an exception halfway a JSP page (to be proven by 2 and 4), or an internal server error without an error page (to be proven by 3 and 4).

You need to configure your server.xml file and declare a context for your web application. You can find the documentation here: http://tomcat.apache.org/tomcat-6.0-doc/config/context.html
But a blank page is kind of weird, because I think if your web application wasn't deploy correctly, you will get a Http 404 error.

Related

starting tomcat manually via startup.bat doesn't seem to work

I have a jsp web-project which i wrote in eclipse. I can run it within eclipse, no problems there.
Now i have the final war-file and can access it via firefox (localhost:8080/program) WHEN the tomcat server is still up within eclipse.
The thing is, i want the program for other people to test it, but without having them to start tomcat via eclipse.
So i tried to start tomcat manually via bin/startup.bat - no success.
I tried changing the port number within the server.xml and excluded the localhost from proxy in the firefox settings. Still no success.
What did i miss? Can you please help me, give me some clue?
I'd highly appreciate!
Greetings from Germany
---edit(03-17-2016)---
Some more information:
I tried to access (i started the server via eclipse beforehand) the default examples ROOT/index.jsp + manager/index.jsp and got the following exception:
HTTP Status 404 - /manager/index.jsp
type Status report message
/manager/index.jsp description
The requested resource is not
available. Apache Tomcat/7.0.67
On my program i only get
address unkown
Firefox can not connect to the server at localhost:8080
Website might be temporary out of order
Consider enabling Proxy
P.S.: I translated the last exception myself so it's not the real exception

Eclipse (Keplar) and Tomcat

I have an Eclipse workspace with a Web App (lets call it MyApp), and Tomcat server. When I run MyApp, Tomcat finds default.jsp and the opening page displays
http://localhost:8080/MyApp/Default.jsp?ActionPage=dashboard
- all fine and dandy.
This web page shows a menu. I choose a menu option from this page which should render
http://localhost:8080/MyApp/config.jsp,
and I get a HTTP Status 404 - /config.jsp ... ie it is looking for the page at
http://localhost:8080/config.jsp
and can't find it. Why is it looking there? It seems to have lost its context.
Netbeans doesn't exhibit this behaviour - it works fine. I just don't know where to look for a solution. Is it the Tomcat configuration or the Web App configuration?
All suggestions welcome!
When you choose your menu option, how is the URL called : simple form submit, ajax request?
In any case, you should have a URL looking like /MyApp/... in your code.
You can also check which URLs are effectively called by using a debug tool in your browser (ie Firebug for Firefox)
Another test to do if you use a Tomcat embedded in Eclipse is to start your Tomcat outside from your IDE, just to check the potential behaviour differences.

Cannot load anything on Tomcat 7 : configuration issue

I'm currently developing a web project running on Tomcat 7 and I cannot see anything who's suppose to be on Tomcat (blank page when I do a HTTP request in my browser).
My Modus Operandi:
I launch a new instance of server in locahost (apache-tomcat-7.0.34) within Eclipse (I work with Indigo and tried with Juno as well)
Tomcat's ROOT folder has been pasted in the 'wtpwebapps' folder of all my servers in my Workspace
I add a simple web project on this server instance and try to access it from a HTTP request and I get a blank page. If I try to run a .html file of this web project on this server, I get a 'HTTP 404 Not Found' Error.
What I tried:
I tried to build the whole configuration from scratch (new Eclipse, new Apache-Tomcat) and I still get the same result. But when I do that from my personal computer at home, everything's working fine!!
I tried to put an old version of my code or a tutorial project, but nothing can be launched (therefore, it must be a configuration issue).
I checked the server.xml and web.xml files and nothing looks suspicious (I can paste them if you want but those are the same than those who worked at home)
The only thing I can think of is that I changed the internet connection (and the IP address) of the computer I'm working on, but I don't think it could make any difference when trying to reach localhost, right?
When I follow the steps of the very good tutorial, I do get a blank page on the 'Run Tomcat' topic, but I don't get the Tomcat welcome page once I copied the ROOT folder into "wtpwebapps".
Does someone have any idea where it could come from?
Ok guys, finally got the solution.
I was about to format my computer when i realize that the port 8009 was actually used by another process.
I thought that's the kind of things who are checked when you launch a Tomcat server within Eclipse but it didn't show any error.
The HTTP request went through the port 80, but as the default AJP port is already in use, Apache could not forward this request to Tomcat, therefore a blank page was returned.
At least that's my understanding of this situation...
Hopefully this may help someone who'd run into a similar situation.
Thanks for your help.

How do I make Liferay 6.1.0 always redirect to a 404 page when a resource isn't found?

I have created a simple hook for a Liferay site I have. It contains a 404.jsp that overrides the default Liferay 404. It works fine if I type in a specific page. For example:
Going to http://localhost:8080/jooky.jsp throws
SEVERE: PWC6117: File "C%3A%5Cbundles%5Cliferay-portal-6.1.0-ce-ga1%5Cglassfish-3.1.1%5Cdomains%5Cdomain1%5Capplications%5Cliferay-portal%5Cjooky.jsp" not found
in my Glassfish server log and redirects me to my custom /errors/404.jsp without a problem.
However, going to http://localhost:8080/jooky throws a different error
INFO: 14:07:41,790 INFO [PortalImpl:4873] Current URL /jooky generates exception: null
and redirects to a page within the portal that looks like this:
Can anyone help me redirect these non-file type URL's to my 404 page as well?
Thanks.
I was still struggling to figure out how to do this until I read the section in the Liferay Developer's Guide about "Overriding a JSP".
That told me exactly what I needed to know. Where the 404.jsp file should be stored in my hook, why there was a .portal.jsp file appearing in my liferay installation, etc.
One other critical thing that was not mentioned was the addition required to the portal-ext.properties file.
I had to add the following:
# 404 page
layout.show.http.status=true
layout.friendly.url.page.not.found=/errors/404.jsp
After a server restart, the 404 page started displaying for all incorrect pages.

When debugging a servlet in Eclipse how do I pass my test URL (the request)

I am new to servlets and I am trying to debug one in Eclipse (Helios Service Release 2). I started with a Maven project and imported it to Eclipse, using the m2Eclipse plugin. I am using the Debug As -> Debug on Server option with JBoss 4.0 as my server. I can set a breakpoint and step through the code, until I need a domain name. I have not passed the servlet a URL, and it's not finding one. I have searched in Eclipse for a place to set the URL (perhaps as a parameter?) but I haven't found anywhere for that. The server is using localhost as host name and 8080 for the port. Am I supposed to refresh my browser, which is pointing to a test URL (http://localhost:8080/?site=www.testsite.com), at some point in the debugging process? Thanks in advance for any light you can shed on this conundrum.
I apologize for not being clearer. I think I figured it out. What I was looking for was somewhere to enter my URL request and I found it. After I started my debug session in Eclipse, I changed the perspective to Web Development and that gave me a browser window in the IDE for entering my URL. I then went back to the Debug perspective and the browser window stayed. So I could set my breakpoints and step through the code. I control the servlet through that browser window in Eclipse. There are still a few things that are a little murky about the whole process, but I think I can do this at will now. I hope this helps any other newbies in the same position.
Okay. I feel pretty stupid. I didn't need to enter the URL in Eclipse; I can use any browser and go back and forth between the debug session in Eclipse and the browser. Sorry if I wasted anyone's time.