I've been using this approach (Persist and pass FacesMessages over multiple page redirects) in my application and it has been working fine.
Recently, the application was heavily changed and now the messages are no longer showing up. I tried to compare the source code, but there are just too many differences.
Looking at the log, it seems that the messages are only being added after MultiPageMessagesSupport finishes processing, and are lost with the redirect:
[#|2017-01-23T09:23:18.321+0000|SEVERE|glassfish 4.1||_TimeMillis=1485163398321;|
SAVING MESSAGES RESTORE_VIEW 1|#]
[#|2017-01-23T09:23:18.331+0000|SEVERE|glassfish 4.1||_TimeMillis=1485163398331;|
SAVING MESSAGES RESTORE_VIEW 1|#]
[#|2017-01-23T09:23:18.333+0000|SEVERE|glassfish 4.1||_TimeMillis=1485163398333;|
SAVING MESSAGES RENDER_RESPONSE 6|#]
[#|2017-01-23T09:23:18.333+0000|SEVERE|glassfish 4.1||_TimeMillis=1485163398333;|
RESTORING MESSAGES RENDER_RESPONSE 6|#]
[#|2017-01-23T09:23:23.571+0000|INFO|glassfish 4.1||_TimeMillis=1485163403571;|
[ERROR] ecc_src - Failed to access the WSDL at: http://epms:10130/endpoint?wsdl. It failed with:
Connection refused: connect.|#]
[#|2017-01-23T09:23:23.571+0000|SEVERE|glassfish 4.1||_TimeMillis=1485163403571;|
MESSAGES ADDED AT PHASE RENDER_RESPONSE 6|#]
I've tried comparing the usual suspects (faces-config.xml, web.xml, filters), but can't find anything that justifies this change of behavior.
Can someone give me some hints on what should I be looking for?
EDIT #1
Following #Kukeltje suggestion, I've double checked all external components and noticed that Omnifaces' version was different (currently 2.5.1, previously 2.0). Switching back to version 2.0 was enough to make the issue go away.
I'll investigate further and check in which version of Omnifaces this behavior has changed (I'll try versions 2.1, 2.2, 2.3 and 2.4).
EDIT #2
It works fine with Omnifaces' versions 2.1 and 2.2 and stops working from versions 2.3 and on.
Related
I'm developing a new application using websockets and decided to use JSF 2.3 in wildfly 15. All is working fine until I try to redeploy my code using wildfly management console. Websockets stops working after this point and I can just make it work after a server restart. I made a simple application to test this behaviour with this code in the body of xhtml:
<f:websocket channel="test" />
When the application is redeployed I noticed that my page keeps trying to make requests to websocket endpoint and keeps receiving multiple 101 (Switching protocols) as response code in short intervals (about 5 requests/second).
Firefox network inspection
I used wireshark to capture traffic and discovered that just after this response wildfly send a websocket connection close [FIN].
I tried to narrow down this issue and seems to me like a wildfly bug. I used fresh installations of wildfly 15.0.1.Final and 16.0.0.Final. Does anyone have a workaround or a working solution for this?
I tested a very simple application on glassfish (with just f:websocket on xhtml - no backing bean, just to test network websocket connection) and couldn't get the same result I had on wildfly (repeated 101 responses), so I thought this wouldn't apply in glassfish (thus unrelated to Websocket PushContext not working anymore after application redeploy)
After reading Kukeltje comment I decided to make a more functional test application and noticed that websocket stopped working on glassfish after reload (but couldn't get multiple 101 responses - as in wildfly).
So this must be related to Websocket PushContext not working anymore after application redeploy
Test application source
Test application WAR
This is a bug in the source code. Omnifaces websocket implementation fixed the bug. I would recommend using that.
This has been fixed in Mojarra 2.3.15 (released May 2021).
It was initially already fixed at May 2019 for the imagined 2.3.10 version via issue 4565 wherein I have backported the fixes from <o:socket> into <f:websocket>. Unfortunately it was done during the Oracle -> Eclipse transition and in hindsight the changes appear to have completely slipped through during the chaos. So it was re-done via issue 4802 for 2.3.15.
Background -
I am currently working on a JSF migration project. The JSF application is written long back in JSF 1.2 and now we are required to migrate it to JSF 2.2/2.3.
Issue -
The application is using externalContext.dispatch() method to forward it to launch page. We have moved to latest JSF jars and done the necessary java changes. Now when we are trying to launch the home page, the application launch is going into infinite loop. When I run the application in DEBUG mode, I can see the message as :
ENV_UNSUPPORTED for externalContext.dispatch() = "This operation is not supported in this version of java. Java EE 5 required".
I am out of ideas now how to solve this.
Since I am working in a secured environment, I can not paste any code or logs. Apologies for it!
My problem is this exception:
Caused by: <openjpa-2.1.1-r422266:1148538 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: This configuration disallows runtime optimization, but the following listed types were not enhanced at build time or at class load time with a javaagent: "
I'm trying to get an very simple java application with jsf and jpa running, but there seems to be a problem with the enhancement of my entities. As far as I know, tries OpenJPA to enhance my entities at runtime, which are listet in the persistence.xml, however there is no agent to do this. The keyword for this is: Enhancing at Runtime, right?
I thought the enhancement will automatically done by the application server at deployment? How can I configure this?
My exactly environment:
Glassfish 3.1.1
Derby, which is integrated in Glassfish
OpenJPA 2.1.1
Mojarra JSF 2.1.3
Update #1:
After some comments I've added the following lines to my persistence.xml:
<property name="openjpa.DynamicEnhancementAgent" value="false"/>
<property name="openjpa.RuntimeUnenhancedClasses" value="supported" />
It works now, but OpenJPA throw this warning:
SEVERE: 52 myApp WARN [http-thread-pool-8080(5)] openjpa.Enhance - Creating subclass for "[class myApp.model.entities.AbstractEntity, class myApp.model.entities.Post]".
This means that your application will be less efficient and will consume more memory than it would if you ran the OpenJPA enhancer. Additionally, lazy loading will not be available for one-to-one and many-to-one persistent attributes in types using field access; they will be loaded eagerly instead.
I think this can't be the solution.
Update #2:
Refer to fvu's answer, I've tried to define the -javaagent jvm parameter in the domain.xml and over the web admin console. After a restart appeared the problem again.
Update #3:
Refer to update #2, I've played a bit around. There must be thrown an error, when the -javaagent parameter is used, but the file is missing, right?. Yes, there it is:
Waiting for domain1 to start .Command start-domain failed.
Error starting domain domain1.
The server exited prematurely with exit code 1.
Before it died, it produced the following output:
Error occurred during initialization of VM
agent library failed to init: instrument
Error opening zip file or JAR manifest missing : /tmp/openjpa.jar
If I copying the agent to this location, this error doesn't appear, but openjpa could still not enhance my entities!
If you're still having issues... I'd highly recommend biting the bullet and setting up build time enhancement. You'll be much happier in the long run if you get that going.
A couple of ideas:
add the Java agent for enhancement to GF's JVM option, see this link for an example of how to install a javaagent and OpenJPA's doc 5.2.3, enhancing at runtime. That emulates enhancer activation in desktop apps as closely as possible IMO.
However, when I read chapter 5.2.4 of the OpenJPA docs it might be capable of picking up the correct enhancer automatically. Try copying openjpa.jar to the domain's library directory, and check what happens after a server restart.
I am having an application which was developed using JSF 1.1 components. The tag libraries development team, is not going to support JSF 1.2, and we have to run the application on Webshere 7. As websphere 7, by default comes with JSF 1.2. Initially, i was able to deploy my application, but was unable to access it. Later, I read somewhere to remove "Precompile JSP" option, i did that and i was able to access the application. But i am facing some weird thing, first time i am able to login to application, but if i logout and then tries to login again, it is giving exceptions. The exception is javax.faces.el.EvaluationException: Exception while invoking expression #{login.authenticate}, where login is my bean name and authenticate is the method. Moreover, I want some other way, so that i should keep "Precompile jsp" option selected. I read somewhere about shared libraries, but not aware how to actually implement that. My war file contains jsf-api.jar and jsf-impl.jar of JSF 1.1.
Do you see some errors regarding propertyLoader? I had similar problem, and removed from config file custom propertyLoader (left standart), and it became almost ok.
I am trying to create an application where I combine jsf2, prettyfaces, jpa and glassfish 3.1. I had some trouble gettings prettyfilter to load properly, which was fixed by following the tutorial here.
However, after completing the steps I got a problem with the Glassfish log being flooded by some really really irritating warnings mesages. It seams they dont have any impact on the functionality of my page, but I would like to know if there is something that will make them go away? The warning is:
WARNING: Multiple JSF Applications found on same ClassLoader. Unable to safely determine which FactoryManager instance to use. Defaulting to first match
In addition I'm having problem undeploying this webapp. Glassfish admin gui will show a text saying "Long lasting process has been detected", before the admin gui is useless and I have to restart the gf server. I get an error in the gf log:
INFO: PrettyFilter shutting down...
INFO: Admin Console: Initializing Session Attributes...
WARNING: java.lang.reflect.InvocationTargetException while attempting to process a 'command' event for 'button1'.
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException while attempting to process a 'command' event for 'button1'.
Not sure if this makes any sense for anyone, but any help is much appreciated!!:)
Both issues are already reported to the Glassfish dev team.
Issue GLASSFISH-15809 - JSF PhaseListener executed for each virtual host
Issue GLASSFISH-16112 - Admin GUI fails with NPE when attempting to undeploy an application
Glassfish 3.2 will be the earliest version where both issues will be fixed.