Skip to main content

Hosting a Jmaki application

3 replies [Last post]
kouami
Offline
Joined: 2005-09-06
Points: 0

Hi,
I am new to this forum and to jmaki. I recently wrote a web app using jmaki and tried to deployed it to a hosting company that uses tomcat. I developed the app with netbeans 6.1 and it is displaying well on my computer but after deploying the app to the web server it is not displaying well anymore. I talked to the hosting company support team and they told me that I missplaced the .css files. My question is this: should that even be a problem since I deployed everything as a .war file?
Plz help me out on how I should configure my web app.
Thanks,

Emmanuel

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
marcfarrow
Offline
Joined: 2008-06-19
Points: 0

This is a "sticky" situation. They are so many factors involved here that this is not going to be easy for someone on a user forum to really analyze and help with. However, I will ramble on about a few things to check and see if maybe it helps out. If the hosting company allows Java code via Tomcat, it does not mean that Tomcat is the only HTTP server. I would venture to guess that the company may also use another HTTP server in front of Tomcat. Personally, we use Apache's HTTPD server and the MOD_JK2 connector. There is a configuration file that tells which HTTP requests should be sent to Tomcat (workers2.properties). We develop all our web applications under Tomcat. We keep our CSS, images, javascript files, etc in the project as well and they are deployed as a WAR file. However, since our properties file only tells Apache to forward pages requests ending in *.jsp and /servlet* all other requests are only serviced by Apache. So even though we have everything contained within our War file, the HTTP server does not know what to do with the other requests. (Hang in there. I will try to post example below). So if we access something else (something not *.jsp or /servlet*), we get the 404 error for that resource. Of course, you do not see the 404 error because the imports are just ignored if the server cannot find them. (Try pulling up your CSS and/or js and/or image file directly and see whether or not you get the 404 error). So how do we work around this? We simply create an alias in Apache that points to the deployed Tomcat application. Therefore, Apache is now aware of the directory and will pull up information from that directory for "url pattern matching" that is not included (in the above mentioned) MOD_JK2 properties file. So in conclusion, there is no way to be certain that this is your problem. You will have to speak to technical support for your hosting company and get more information from them about their setup. This is just something that we have personally experienced and we know the symptoms when we see things like this.

HTH,

Marc

Example:

Apache is running on port 80
Tomcat is running on port 8080
Create a NetBeans web application name --> TestWebApp
My web pages folder contains:
index.jsp
/js/test.js
/css/test.css

I deploy the application to Tomcat. I run the app from NB. The IDE pulls up the web page for me: http://localhost:8080/TestWebApp. My index.jsp runs, but my css and javascript pages are not working.

I remove the port designation: http://localhost/TestWebApp. My index.jsp runs, but my css and javascript are still not working.

I type in http://localhost/TestWebApp/js/test.js. I get 404 error (Apache error, not Tomcat error).

I type in http://localhost/TestWebApp/css/test.css. I get 404 error (Apache error, not Tomcat error).

I edit my Apache configuration file and add the deployment directory of TestWebApp in Tomcat as an alias

I type in http://localhost/TestWebApp/js/test.js. The javascript file is pulled up by the browser (either via the one with or save as or as a web page depending on browser set up).

I type in http://localhost/TestWebApp/css/test.css. The css file is pulled up by the browser (either via the one with or save as or as a web page depending on browser set up).

I type in http://localhost:8080/TestWebApp. My index.jsp page runs, but my css and js files still are not working. WHY?!?! Because I told the browser to go straight to Tomcat. If i remove the port designation (or change to :80 which is the same thing), then then every works fine.

Once again, (I will repeat myself) this may or may not be what you are running into. This post is for informational purposes only and is not intended to be 100% accurate. It is here to help you troubleshoot your problems and maybe push you in the right direction for a solution between you and your hosting company.

kouami
Offline
Joined: 2005-09-06
Points: 0

Hi Marcfarrow,
You hit my problem right on the money. This is exactly the problem I am having. Thanks for the reply and the solution provided. I will go ahead and talk to the support team at the hosting company and try to solve the issue.
Again thanks a lot. I really apreciated your help on this.

Emmanuel

karthikbalait
Offline
Joined: 2007-12-05
Points: 0

could you please tell me what domain hosting company are you using, i am currently using dreamhost which doesnt support tomcat, i also have an application written using jmaki and jsp which i want to host