Editing a managed bean for XPINC, rebuild and error 500 - xpages

Greeting, brethren,
So I inherited this app (yes, XPages can be legacy now ;-). It is meant for the Notes client only and one process takes a convoluted route via what I understand is called a Managed Bean (the Code/Java design element).
The database resides on a server.
When editing said bean.java, I meet two issues.
If I test immediately thereafter, I'm greeted with an Error 500 that won't go away unless I close then restart both Notes and Designer
In some cases, changes made to bean.java are not immediately available. So far I haven't been able to characterize those cases. For example, yesterday afternoon I could no anything, nothing would bring a change to the Notes client. (Yes, I cleaned & rebuilt and autobuild is disabled). This morning changes are apparent immediatly (save for the quit/relauch bore).
I've tried to set xsp.application.forcefullrefresh=true in the app's Xsp properties but haven't noticed much effect.
What am I doing wrong ? What could I do to fluidify the modifying of a bean ?

When working in XPiNC, after every change you have to close and restart designer. If I understand things correctly, it's trying to access class files that have been discarded. That's why whenever I've had to develop for XPiNC, my initial testing during development is on a browser, I would recommend this approach.
There are minimal differences in syntax, usually only encountered if manually creating URLs to files etc or using the bad practice "" to specify database location in #DbLookup. Wherever possible, avoid #Formula approaches, their performance is worse than object orientated methods (e.g. view.getAllEntriesByKey())
It's the same for the bean. There are only two ways to speed up picking up updates - use a browser or use XPiNC on a different PC.

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.

webstandard theme not rendering?

An application we're developing for a customer is running more or less fine on our internal development servers (V 8.5.3 with UP1 and FP5 as well as a secondary V 9). Our development is done using V 9 designer clients.
Yesterday we pushed a test version onto the customer's server (V 8.5.3 FP5 / UP1). The result rendered by their server however is completely different from what we get from our servers. It turns out that only custom style sheets are rendered while everything that usually should be coming from the server's webstandard theme is completely missing: no xsp.css, xsp_ie.css and the likes. Thus the pages are completely unusable: tabbed panels are rendered as standard elements, rich text editors are completely broken, just to name a few things.
We had the local admins check the server file system: webstandard theme appears to be there, and accessible to everyone.
Has anyone ever come across something like that? In 4 years of developing Xpages I've never seen something like that, at the moment I'm completely clueless in what to try next.
I really hope that this is just a minor flaw easy to be resolved.
Lothar
Have you checked the installation? I have seen servers that were upgraded the wrong way by copying the data directory, then upgrading and then moving back the data old directory, thus overwriting some important files or even loosing important files and directories...
This is hilarious: for security reasons the customer's admins deleted all files from the server's file system that they thought weren't needed. For some reasons they left the themes but removed all resources like css and js files (including all dojo dirs). No, I won't tell any names.
Lesson learned: never just assume a customer's setup to be fully functional until this fact is properly proved ;)

Scheduled agents nsf and ntf

Our products coded in Designer are usually structured as:
database1.nsf,
database2-production.nsf,
database3-devel.nsf,
then, all of them use the same template:
database-template-verX.X.ntf
Agents I code, are coded in NTF. After ntf is ready to be moved to NSF files, I usually just do Application > Refresh design. Everything works well. Now here is the thing...
When refreshing design and checking domino.log, usually newly created agents work great on:
database1.nsf,
database3-devel.nsf
However,
- database2-production.nsf doesn't seem to get agents properly. Even If I open NSF file directly in Designer, everything looks good. The agents just don't run. All agents are ENABLED, have proper permissions and are signed. That -production.nsf database just doesnt want to cooperate.
Usually we solve this with restarting domino and even then, sometimes we arent sure if agent will start running as scheduled or not.
Did someone else had similar problems or maybe knows what is wrong? It looks like there's some kind of cache or something..
We have no idea...
Any help would be great!
Thank you in advance!
You can use tell amgr debug * to have the agent manager output detailed information to the console. Unfortunately, if it seems that restarting the server solves the problem temporarily, you may have to collect debug information over a long period of time to see a before and after picture of what's going on -- and even then it might not point you toward the reason.
Check all the design elements property, Prohibit Design refresh or replace to modify should not be checked. Also check your acl for this database.

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.

Good reasons for not letting the browser launch local applications

I know this might be a no-brainer, but please read on.
I also know it's generally not considered a good idea, maybe the worst, to let a browser run and interact with local apps, even in an intranet context.
We use Citrix for home-office, and people really like it. Now, they would like the same kind of environment at work, a nice page where every important application/document/folder is nicely arranged and classified in an orderly fashion. These folks are not particularly tech savvy; I don't even consider thinking that they could understand the difference between remote delivered applications and local ones.
So, I've been asked if it's possible. Of course, it is, with IE's good ol' ActiveX controls. And I even made a working prototype (that's where it hurts).
But now, I doubt. Isn't it madness to allow such 'dangerous' ActiveX controls, even in the 'local intranet' zone? People will use the same browser to surf the web, can I fully trust IE? Isn't there a risk that Microsoft would just disable those controls in future updates/versions? What if a website, or any kind of malware, just put another site on the trust list? With that extent of control, you could as well uninstall every protection and just run amok 'till you got hanged by the IT dept.
I'm about to confront my superiors with the fact that, even if they saw it is doable, it would be a very bad thing. So I'm desperately in need of good and strong arguments, because "let's don't" won't do it.
Of course, if there is nothing to be scared of, that'll be nice too. But I strongly doubt that.
We use Citrix for home-office, and people really like it. Now, they would like the same kind of environment at work, a nice page where every important application/document/folder is nicely arranged and classified in an orderly fashion
I haven't used Citrix very many times, but what's it got to do with executing local applications? I don't see how "People like Citrix" and "browser executing local applications" relate at all?
If the people are accessing your Citrix server from home, and want the same experience in the office, then buy a cheap PC, and run the exact same Citrix software they run on their home computers. Put this computer in the corner and tell them to go use it. They'll be overjoyed.
Isn't it madness to allow such 'dangerous' ActiveX controls, even in the 'local intranet' zone ? People will use the same browser to surf the web, can I fully trust IE ?
Put it this way. IE has built-in support for AX controls. It uses it's security mechanisms to prevent them from running unless in a trusted site. By default, no sites are trusted at all.
If you use IE at all then you're putting yourself at the mercy of these security mechanisms. Whether or not you tell it to trust the local intranet is beside the point, and isn't going to affect the operation of any other zones.
The good old security holes that require you to reboot your computer every few weeks when MS issues a patch will continue to exist and cause problems, regardless of whether you allow ActiveX in your local intranet.
Isn't there a risk that Microsoft would just disable those controls in future updates / versions ?
Since XP-SP2, Microsoft has been making it increasingly difficult to use ActiveX controls. I don't know how many scary looking warning messages and "This might destroy your computer" dialogs you have to click through these days to get them to run, but it's quite a few. This will only get worse over time.
Microsoft is walking a fine line. On one hand, they regularly send ActiveX killbits with Windows Update to remove/disable applications that have been misbehaving. On the other hand, the latest version of Sharepoint 2007 (can't speak for earlier versions) allows for Office documents to be opened by clicking a link in the browser, and edited in the local application. When the edit is finished, the changes are transmitted back to the server and the webpage (generally) is refreshed. This is only an IE thing, as Firefox will throw up an error message.
I can see the logic behind it, though. Until Microsoft gets all of their apps 'in the cloud', there are cases that need to bridge the gap between the old client-side apps and a more web-centric business environment. While there is likely a non-web workaround, more and more information workers have come to expect that a large portion of their work will be done in a browser. Anything that makes the integration with the desktop easier is not going to be opposed by anyone except the sysadmins.
The standard citrix homepage (or how we use it) is a simple web page with program icons. Click on it, and the application get's delivered to you. People want the same thing, at work, with their applications/folders/documents. And because I'm a web developer, and they asked me, I do it with a web page... Perhaps I should pass the whole thing over to the VB guy..
Ahh... I know of 2 ways to accomplish this:
You can embed internet explorer into an application, and hook into it and intercept certain kinds of URL's and so on
I saw this done a few years ago - a telephony application embedded internet explorer in itself, and loaded some specially formatted webpages.
In the webpage there was this:
Call John Smith
Normally this would be a broken URL, but when the user clicked on this link, the application containing the embedded IE got notified, and proceeded to execute it's own custom code to dial the number from the URL.
You could get your VB guy to write an application which basically just wraps IE, and has handlers for executing applications. You could then code normal webpages with links to just open applications, and the VB app would launch them. This allows you to write your own security stuff (like, only launch applications in a preset list, or so on) into the VB app, and because VB is launching them, not IE, none of the IE security issues will be involved.
The second way is with browser plug-ins.
For example, skype comes with a Firefox plug-in, which looks for phone-numbers in web-pages, and attaches special links to them. When you click on these links it invokes skype - you could conceivably do something similar for launching your citrix apps.
You'd then be tied to firefox though. Writing plugins for IE is much harder than for FF, I wouldn't go down that path unless forced to.

Resources