I have been attempting to incorporate Java into SSJS, using the technique described here:
This is representative, I have found numerous sources for this and all agree:
Add a directory under WEB-INF, like “src”.
Add that directory to the Java Build path in DDE.
Put your .java files under that directory.
Create your objects and use them.
This should work in SSJS and it should work in faces-config for managed beans. I am only interested in the former, at present.
When my SSJS gets to the line to create my Java object, it says that object is not …
(grimace)
Yesterday when I set this up, it failed. Repeatedly.
Today when I attempt to get the exact error message to report here, it works. No other change what-so-ever except the workstation was rebooted because I shut it down every night.
It’s good that it works. It’s bad that it’s so flaky about working. It does little to lend confidence.
As i see it there are two ways to use your own java files in xPages,
Using reference
this is the way you describe it
Using a bean
this is also done the way you describe it but you point out the bean in the facec.config.xml file
Even though I have not seen any documentation about these procedures I do believe #2 is prefered as this means the class is loaded into memory when the webpage loads. (probably faster)
It would be interested to get some information from IBM about how to do this, also I am interested in finding out how xpages are loaded into the server memory,
My experience is that the xpage is loaded into the server memory when first accessed but seem to be discarded after a period of time.
I had a simple class and it worked. I updated it to a singleton and it fails as before:
Reference error: ‘’ not found
There are zero compilation errors. Nothing has changed in the configuration except I updated the class code to make it a singleton, and added some code in the constructor to make that singleton usable, as opposed to a blank stub.
Again the inconsistency strikes me as undesirable. For instance, if there is some run-time problem, how do I ever find that out? That’s what this implies … a trivial do-nothing class works and an usable class does not, but I get zilch from the system.
Subject: Full clean & build is the first thing I tried…
But naturally that did nothing. Then again, a PMR I had a year ago pretty much indicated that a “full” clean and build does not … FULLY clean, as in utterly nuke everything ever built and rebuild it all, including automagic intermediaries. This was for “performance” reasons, and I pointed out that any developer who does a clean and build isn’t looking for performance. They are looking for a clean build. I think they made a SPR for it and pretty much ignored me.
I’m working on a remote server, which is my normal M.O. Yesterday I wasted hours trying to get it to preview local and gave up. I essentially never do local preview, anyway, because I prefer to develop in an environment that as closely mimics the deployment scenario as I possibly can. Local will never fit that that bill.
At least that’s what I presume you mean by “local” and server. (grin)
So, I’m still stuck on why all the blogs and XPage gurus seem to indicate this works, yet when I try it, it doesn’t work.