JSF simple example on Tomcat works, but weird problem on GlassFish - jsf

I have a simple JSF application, a search form and results table, and a search button that calls a managed bean called SearchHandler.doSearch to populate the results. (I'm using Eclipse and WTP.)
On Tomcat everything works fine, the web page shows, click the button hits a break point in SearchHandler.doSearch, it does the search and populates the table.
However, running on GlassFish, the web page shows, click the button just causes the page to refresh. It never hits the breakpoint in SearchHandler.doSearch and doesn't do the search and populate the table.
Is there something simple I am missing?
rob

Answering my own question ...
It turns out my Eclipse (with WTP) project was configured to work with MyFaces. When I deployed it on Tomcat, everything worked fine.
But GlassFish has its own implementation of JSF in its classpath already (Mojarra). The two JSF implementations were stepping on each other's toes.
I created a new Eclipse "Dynamic Web Project" and specified "Disable Library Configuration" as the "JSF Implementation Library" and now it runs/debugs on GlassFish just fine.
Thanks for reading!

Related

xPages don't work after design update

Load any xPage
Refresh db design
Reload the xPage by either F5 or Ctrl+F5.
then almost all functions stop working without any errors. E.g. nothing happen if you click buttons or menu items. After restarting web browser some functions come back but some still doesn't work. After cleaning browser's cache almost 90% UI start working but some still need to reload the page few times. Is there any xPage app properties or Domino properties to adjust to fix that problem and make xPage app work smooth even after design refresh
Design Refresh didn't reload custom Java classes when refreshing with 8.5.3 FP1. This was fixed, I believe, in FP2. But that doesn't sound like it's causing the problem here.
Design Refresh will not reload jar files. That requires issuing "restart task http" to the console. ("tell http restart" doesn't properly reload everything XPages needs.)
If your application is using a Single Copy XPage Design to hold its XPages design, that too will not update until you issue "restart task http" to the server. The design seems to be cached by the server for better performance, but refreshing the design of the SCXD database doesn't reload that design. It's unclear if that's your scenario here.
XPiNC may also not update immediately, but I've not tried that. The runtime there is basically in the Notes Client itself, so I could understand that it would not update.
Otherwise, I would echo Thomas's experience, I've not seen any other issues (and my applications heavily use Java). I haven't needed to clean the application following a design refresh. Existing browser sessions will have problems with partial refresh calls, I would expect that. But a refresh of the page make all functionality work.
There are two scenarios I would expect to have problems.
The first is if you are storing anything in sessionScope or applicationScope variables that are required by your application, but your code only loads those on a specific page. If you refresh the design, the scopes will get dumped and so not reloaded until you go to the specific page. Typically I put such initialisation code on my layout custom control, so a page reload will always initialise it if it's dumped by a design refresh.
The second is if another user accesses the application and has Build Automatically switched on, which could result in the application being rebuilt without you realising it. It doesn't sound like this is happening for you though.

custom controls added as OSGI plugin appear twice

I added a couple of custom control into a plugin and imported them on the server using the update site. They are working quit well so far but when i open an application in the designer client i can see the custom control from the plugin twice.
I tried to add them the same way bootstrap4xpages is adding a plugin but mine is duplicated.
One entry is without any icon the other has the standard grey cc icon. Not the end of the world but i must have done something wrong. Any idea why that happens?
It's a known issue with 9.0 and 9.0.1, specific to components that are Custom Controls. I encountered it quite a while ago. Mark Leusink had the same problem for Debug Toolbar and discussed it with the IBM developers at IBM Connect last year. So I would hope it will be addressed in the next point release, 9.0.2.
It still works fine though, regardless of which one you select.

custom ascx control not working with Umbraco 7

I have a simple ascx contact us control that sends an email.
I have been using it over time to various umbraco websites running versions from 4 up to 6.1.5 and it has always worked fine. I have been also tried it with various versions of .NET without problems.
This time I updated it to .NET 4.5 and tested it and then added it in an Umbraco 7 project. It renders fine but when the submit button is pressed the page reloads without a postback and nothing happens.
There is no error message in the logs, there is no activity from the form.
The code is such that if there is an error that would be handled and shown on the screen after a postback but the form simply reloads.
I have tried all the usual checks and I can't find absolutely nothing wrong with it. Can anyone suggest why the control wouldn't work on Umbraco 7 or how to find the error that causes a full page refresh?
Thank you
You can't use usercontrols in MVC views. If you want to use usercontrols still then switch the render engine back to Webforms in umbracoSettings.config, recycle your app pool and recreate all your templates as masterpages. However, I'd advise you to redo the form in MVC. Google: SurfaceController contact form

xPage launched in Notes Client 853 FP5 on win7 displayed as html web pages, no error though

The xPage app was developed and compiled using 851 designer by someone else...
Were suppose to be used inside Notes Client.
Only two of my users when they open the xpage app in the Notes Client 853FP5 standard config on win7 everything displays and no error however it wasn't in xpage UI, instead it looks like some domino view being loaded in a web browser. but all xpage buttons and links are working and displayed. Just the not xpage UI.
If I try to load the app in a web browser, all seems to load fine.
Any ideas? as no other user has got the same issue. If it is an issue with win7, then they are all on win7 though, Or any suggestions in terms of where to start from to debug this issue?
Many thanks
You mention that it's not the "xpage UI" but that "xpage buttons and links are working". It sounds like a caching issue for the CSS files. Try the keyboard shortcut Ctrl-Shift-Delete to clear the local cache.
Source: http://ypastov.blogspot.dk/2013/08/xpinc-clearing-cache.html

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.

Resources