Struts2 action namespace & Requested URL not found on tomcat in linux server - java

I have developed web application using Struts2 + Hibernate + Java7+ Mysql 5.5 and its working successfully in my local windows server.
I have deployed this (local working) code under public_html folder in production server. Production environment is Linux + Tomcat 7 + JDK 7 based server.
While accessing the example.com it displaying the index page only without listening struts2 action.
If I am trying to login or register into the application it says “Not Found The requested URL /myactionname was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.”
It should be look up myactionname in struts-default.xml file, and then process the business code, then its return to the jsp page to render view of this application. I don’t know why this not working in my application. Please help me to resolve this error.

What is the public_html folder of this production server? If I remember correctly, isn't this the public folder for any LAMP based sites hosting servers which are mapped with the local Apache server ?
For Tomcat7 deployments, it is required that you place your war ( or folder ) inside the webapps folder located at $Tomcat_dir$/webapps.
Also make sure from the logs that your application is getting properly deployed or not.

Related

Tomcat cannot find development build of Java servlet

My project has a Java servlet that extends HttpServlet. In ops this servlet responds properly to AJAX calls to the server, which runs Tomcat 6. The calls's URLs are of the form host:port/App/Servlet(query-string).
I am adding a new AJAX call to the servlet. I copy the servlet WAR file to the Tomcat webapps directory and bounce the tomcat service. Then I run my project (from a tcsh script). Calls to the servlet now return HTTP 404.
I see nothing in the Catalina log file indicating that the servlet even started, but no error messages as to why it wasn't found. (I suspect there's some other log setting that I need to tweak and some other log file I need to review.)
I cross checked with another development server that runs the original servlet, and it has no problems.
What's off with the routing to the servlet, and how do I fix it?
ETA1:
The servlet has a list of calls: Call1, Call2, etc. I added Call3 to the list and reused the pattern for Call1 as much as I could find. Now both Call1 and Call3 return 404 errors.
ETA2:
I dropped the servlet WAR file from the other development server -- where the existing AJAX calls work properly -- onto this development server. The calls continued to work properly. Although I did notice a quirk that the build system runs JDK 1.7.0_51 and the app runs JDK 1.7.0_71. I also copied the AJAX request's URL and went right to that location. With the existing servlet, I got an AJAX response that was pretty much correct. With my dev version, I got an empty page.
ETA3:
I'll clarify my scenario, based on feedback from the comments.
My project has a Java web app. It runs properly in and of itself.
The app sends AJAX calls to a Java servlet. This servlet works properly in operations. Also, when I copy the release version to my development Tomcat 6 server, the release version works properly.
I added a feature to the servlet and deployed the WAR file to the development Tomcat server. Now Tomcat complains it can't find the servlet (HTTP 404), even for identical calls and unmodified features that used to work properly.
As the release version works properly on the development web server, I conclude that Tomcat itself works properly. I also conclude that there is no issue with the URL or the port. As far as I can tell, Tomcat either can't start the servlet or the servlet fails before reaching its constructor. I have not found the log file or logging setting that would show the failure.

How to view all the published resources of my server RESTful web services

I've received a sample Java application, which contains some RESTFul web services. I've set it up in eclipse with Tomcat and it's in running state. Unfortunately I haven't received any information about the published Resources. So my question is:
How can I find out all the published resources of my app? Are they printed in any server logs at the time of server startup?
I have come to know about WADL file which serves my purpose. This file is generated automatically by Jersey-2.22 when the application is up & running. It is accessible by hitting
http://localhost:8080/<path to application>/application.wadl and
http://localhost:8080/<path to application>/application.wadl?detail in detail.
I've taken localhost because the app is deployed on my local machine and 8080 because app is deployed on Tomcat7 on that port.
Reference: https://jersey.java.net/documentation/latest/wadl.html

How to use the API Sesame with Tomcat server into a Java dynamic web project?

I developed an Java application who request in SPARQL on Sesame repositories.
I use currently a Tomcat server what I run on console (with ./startup.sh).
I must now include my application into a web page and I choose J2EE.
But I have a problem : I can't run a Sesame connection and use JSP files, servlets,...together.
I have this error :
Etat HTTP 404 : The requested resource is not available
How to "join" us ? Is it a conflict because of the "8080" port ?
You have not provided enough information about how you have configured your Tomcat to allow a meaningful diagnosis.
But I can say with certainty that it is possible to run Sesame repositories and JSPs on the same Tomcat service ... if you configure them correctly. Indeed it is possible that you are already doing this, but you are using the wrong URL to access the resource.
How to "join" us ?
I suggest that you start by looking at the Tomcat documentation on how to configure the server, and how to build a basic webapp.
Is it a conflict because of the "8080" port ?
That is unlikely.

http 404 tomcat4 eclipse MAC

I have recently downloading Tomcat 6 and switch the eclipse I was using to the EE edition.I am having trouble getting eclipse to run the JPA project, and I keeping getting the error message HTTP 404. When I open a web browser and type in http://localhost/8080/ I get the tomcat 6 info page so I think the server does work eclipse cannot connect to it.
I have going into the preferences and and made sure the path to the server in the directory was correct..
If you're using "your own" instance of tomcat you must specify the location in the server configuration view. Take a look at the screenshot :
My instance is located at C:\TOMCT. Hope that helps

What domain files would an application running in Glassfish have access to?

I'm working on a beta release of an application. This is a Java app that runs on Glassfish. Obviously we are getting bug reports from time to time. I would like to provide my users with a simple one-click button to get the server log from /domains/domain1/logs . I am not sure if the application is sandboxed in such a way that it can get to this log file.
Does glassfish sandbox the application in such a way that I would be prevented from getting the file? Is there a standard method or library I can use to get the logs?
If the file permissions on the server are correct, can I just have my application read the file using an absolute path?
You application can read the server.log file directly. Note that the logs are rotated, so your application would have to reload the log file and maybe even provide access to the rotated logs.
If you are using a web server front end, such as Apache, you could just serve the log directory. I think you could just create a symbolic link to that directory in your webroot.
Be careful you are not logging any sensitive information as exposing a log file could be a security risk.
If you are using GlassFish 2.1, you should look at AMX. The AMX class Logging seems to have the data that you want.
If you are using GlassFish 3.1, you should use the RESTful interface to the admin data. If you have an instance of GlassFish 3.1 running locally, right now, you can click this link to see the log data: http://localhost:4848/management/domain/view-log...
If you are using a WebKit based
browser, like Chrome or Safari, you
probably need to view the source of
the 'empty' page....
If you are using GlassFish 3.0, you will need to open the file directly.

Categories

Resources