English 中文(简体)
Occasional weird Glassfish errors, resolved by a restart?
原标题:

I m developing a web app using netbeans with GlassFishv3.

Every once in a while when I add a new feature in my app, glassfish starts nagging with stupid errors, after a lot of time wasting and panicking, i restart glassfish and run my application again, then suddenly the errors all go away and my site starts acting correctly. (or in case I have made a real mistake, i receive a reasonable & descriptive error from GF.)

[Edit: the rest of the question was revealed to have been my own mistake.]

But the problems don t end there. Recently, i added the ability to write comments in a (JSF) page, after the user submits their comment, i add it to the database and redirect to the same page, so that hopefully the page refreshes with the new comment, but it wont!

The underlying Mysql database shows that the new comment has been added, but the page just wont show the new comment! I ve tried everything (e.g. deleting browser cache, using different browsers) but only after restarting GF is when the page shows the new comment!

Do you have any idea what the problem could be? Could this be a Glassfish bug?

What i am using: JSF2, EJB3.1, JPA, MySql

最佳回答

Apparently the list of comments is not refreshed with new comment. Verify if the data loading logic is right. Maybe you ve put it in the constructor of a session scoped bean instead of a request scoped bean. Maybe you haven t reloaded the list from DB after insertion (and commit). Instead of restarting GF, try to restart the webbrowser (close ALL tabs/instances) and reopen the page. If it works, then the old/non-reloaded data has indeed just been displayed from the session scope. If that doesn t solve the problem, then the problem is maybe more in the JPA area, debug if the new comment is actually persisted and committed and/or if the list is actually requested from the DB and not from the cache, etcetera.

问题回答

thanks for the responses,

Yes, as Balus and Pascal mentioned, the problem lied in my own logic and fortunately not in Glassfish.

Incompetence was on my part, I admit and apologize;)

Indeed the problem was in the JPA area, I had forgotten to merge and refresh my JPA entity after adding the comments; so although the comments were added in the database, my JPA entities wouldn t reflect the changes.

By the way, FYI, I still have the occasional problem of my projects plain not building and/or not deploying into GF (while emitting weird error messages), which is always solved by restarting GF (more specifically, by restarting the default domain in GF);

It could probably be my mistake, or netbeans6.8 s deployment bug, or in the unlikely case, GF s fault.





相关问题
JSF a4j:support with h:selectManyCheckbox

I m having trouble with a JSF selectManyCheckbox and A4J support. The purpose is to run some action when a checkbox is selected. This works perfectly in Firefox. Yet, when testing in any IE (ie6 / ie7 ...

Mojarra for JSF Encoding

Can anyone teach me how to use mojarra to encode my JSF files. I downloaded mojarra and expected some kind of jar but what i had downloaded was a folder of files i don t know what to do with

如何拦截要求终止?

在共同基金中,如果用户要求终止,就需要采取一些行动。 我需要某种拦截器,但我不知道如何这样做。 我需要帮助。 增 编

ICEFaces inputFile getting the file content without upload

Is there any way of just getting the content of the browsed file without any upload/file transfer operations? I currently use ICEFaces inputFile component but I do not need the default uploading ...

Weird behaviour of h:commandLink action (MethodExpression)

I have two JSPs where I am displaying some info from database in a h:dataTable. One of them is showing all the info, and one of them user specifically. I have showXML.jsp that shows the "XML" column ...

How to correctly use ResultSet with h:dataTable

The problem is, that after displaying the ResultSet with <h:dataTable>, the connection is left open. If I close it, it closes the ResultSet too. I m thinking about copying the ResultSet data ...

热门标签