I have a strange problem here and I dont know if any one has an idea what could cause it. I'm working on a Java EE (Servlets & JSPs) web application project that uses AJAX to update the web page. When I test it on my localhost server (im using Tomcat 7.0.26) it works perfectly well. But when I run the same application on my hosting server, some of the values or the page itself refuse to update correctly. These values are stored in a session attribute and when they are typed in they are sent to the servlet via AJAX request, like I said, they work well as expected on my localhost but on the hosting server that I subscribed, there are errors. Does anyone have any idea what is going on there please? The site is http://www.optdesolver.com
I can think of a number of things
Your server configuration. How long that the session timeout is set?
Your app has a cache of files.
Your browser has some cache of files.
You are not deploying your proyect properly.
You have multple instances in your server.
You have to restart the server in order to make it refresh its contents.
I suggest you use some kind of version number in your html to verify that is not a cache realated problem.
I hope this helps.
Related
I have hosted Java Web application developed using RestFul Web services, hibernate and angularjs. MySql is the DB. After Hosting in Tomcat, restful webservices GET calls are not pulling correct data from the DB after making a transaction.
i.e.,
GET call is accessed for a resource
POST call is made to the Resource
Again the GET call is made, which shows the initial values alone but not the newly posted entry.
This happens in few machines only. While in few other machines, it works as expected.
I have cleared the browser cache as well. still not working.
Please help on this.
Hi I'm sorry for the naivety of this problem but I need some guidance as I have confused myself greatly.
I have been tasked with creating a database(mysql) and creating a web interface for i to be interacted with. I have experience with web design and database development. Previously I have used java to interact with a DB and was hoping I could use JSP for the web interface. This is where my problem is, how I would I deploy/host this website?
I have 2 theories which are misguided:
(A). Use a cms which has a web server for me to place the jsps in?
or
(B). Use a domian/web hosting site that has a server for me to place the jsps in?
I'm totally lost and any guidance would be greatly appreciated.
Simple answer is you will require a Java Application Server to host your JSPs.
You can use Apache Tomcat, GlassFish, or some other application server to do this.
You will also need a database e.g MySQL running on your host or some other host accessible by the machine running the Java application server.
You can choose to host all of this locally or farm it out to a web host provider depending on your resources.
A CMS seems like overkill. See this link for a description of CMS and its functionality. I don't believe this is what you are looking.
I don't know exactly what you're looking for, but I think you need (B)
You need a MySQL instance running your database and a servlet container (e.g. Tomcat) to host your JSPs.
Running a CMS which is just used to use the DB that it works with is a little bit heavy for that usecase.
As suggested by Mr #cmd , yes there is no need to go for an outsourced server just to host your website, unless you need it to be visible to the world.
Else for your testing purpose, you can use Any of the Apache Tomcat, Glassfish servers for hosting the applications designed in JSP or in other web interface language.
And Inside of the JSP coding itself you may write the interaction coding with your database.
your database also can be installed in the same server.
And actually instead of a server, you may even use your PC to install the Apache Tomcat and the database and start using it.
I have an application deployed to Heroku that uses Spring Security, and, by extension, HttpSessionSecurityContextRepository. Realizing that HttpSession will cause problems when scaling up to multiple dynos, I am trying to configure webapp-runner (https://github.com/jsimone/webapp-runner) with the --session_manager memcache flag (with the Heroku memcache addon).
A local configuration using Apache and mod_proxy, two Tomcat instances, and memcached 1.4.13 works fine. When deployed to Heroku, however, it fails, even with a single dyno - randomly redirecting to the login page as if unauthenticated, indicating that the session store is not working. Same Procfile, verified the MEMCACHE_* variables via heroku config, etc.
Does anyone have experience with a similar configuration?
Update: the configuration works as designed.
The issue was caused by a Spring Security mis-configuration. A bad image URL buried in the app triggered the redirect. While this should have simply been a 404, there was also a catch-all intercept-url pattern in context-security.xml with access set to IS_AUTHENTICATED_FULLY. The result was that any page with the bad URL redirected to the login page. Correcting those URLs addressed the problem when deployed to Heroku, though I can't explain why it did not manifest on a local system.
I have a web application project in which i develop Java servlets along with php. I have designed the client log in application based on Java servlets and display of databases using mysql query from php. I am developing these using xampp on localhost for php and tomcat server for my Java servlet.
My question is, do they share the same session? For example, this would mean that the client logs in using a Java servlet and client can log out (destroy session) using php code.
Nope, they don't share the session info. Java and php run on two different VM, and unless you've configured them to share this kind of information, they won't.
Honestly, I have not seen it implemented... IMHO it's just easier to manage the session in one of the VM.
HTH!
Your requirements / environment is unique. That said they cannot share the same session.
Cookies may help you.
In production box i want to change the web.xml in a J2EE web application but i don't want to restart the server or the application because this can create problem for lot of online users.
Suggest a way so that my web.xml changes should reflect in the web app.
As far as I know, there's no way of getting around restarting the server if you need it to read the new web.xml, because the config file is read when the server starts (ie. think about it being processed only on servlet init()).
If someone can point out how we can hot deploy config file, I would like to know too though.
Just to throw an idea out... You could embed your webserver (like embedded tomcat) and programmaticly restart it based upon some event. However, there will be a period of time where the webserver is down. Maybe create a new embedded tomcat instance using your new web.xml. You can now direct traffic to the new embedded webserver while you shutdown the old one.
I think we can try using annotations that come with servlet 3.0 specifications.