简体   繁体   中英

404 Error with ajax call which works after page refresh (F5)

I have a javascript portal-like application (based on JPolite), when modules are loaded with $.ajax jquery call.

But the first request (when user has just started his browser) is failed with error 404. Supposing the app is hosted https://localhost:8443/context Firebug shows a request to /:8443/context/file.html which is incorrect

But after refreshing browser (F5) everything works fine and request became well-formed. The same issue was in another app based on JBoss portal but fixes after migrating to the latest version.

I suppose this may be connected with incorrect caching or so. Unfortunately google did not suggest anything useful so I'd appreciate any answers.

Seems I found the solution myself. The problem was that the log was not configured properly and I missed the important record: ERROR: org.hibernate.util.JDBCExceptionReporter - Already closed .
After some period of inactivity mysql server closes the current connection and request was failed with AlreadyClosedException. Adding validationQuery="select 1" to my context.xml seems fixed the issue.

After some period of inactivity mysql server closes the current connection

You should be closing connections as soon as you are finished with your database unit-of-work. Not just letting them sit idle until the SQL server closes the connection.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM