java.lang.NoClassDefFoundError: com.ibm.xsp.extlib.util.ExtLibUtil - xpages

Last week I was playing with sessionScope values being read and written from java code that was called from on beforePageLoad in an XPage. It was working when called on the server, but this week after rebooting the server it is now giving an error. The Java code still compiles.
To resolve the extlib in Designer I include the JAR "com.ibm.xsp.extlib.core_11.0.1.v00_00_20200319-1021.jar"
as an external JAR.
If I run "tell http osgi ss com.ibm.xsp.extlib" on the console I get:
The lines I am using in Java are:
import com.ibm.xsp.extlib.util.ExtLibUtil;
and
Map<String, Object> sessionScope = ExtLibUtil.getSessionScope();
Am I including the wrong JAR file? I can't understand why it worked Friday, but today isn't working.

Including the Jar is not necessary. Under XSP Configuration, Page Generation Tab, the extended XPage controls to use checkbox for com.ibm.xsp.extlib.library needs to be checked. This resolved the issue, and removed compilation errors too.

Related

#ConversationScoped bean behaves as #RequestScoped since OmniFaces 2.5 FacesViews

I tried to upgrade my Java EE 7 / JSF 2.2 application to Omnifaces 2.6. Currently I am running version 2.4.
After that, I have noticed a strange behavior when using #ConversationScoped and Ajax-Requests. When calling, the area, which should get rendered after the request, gets cleared (no exception on the server, response status code 200).
Next, I have a kind of wizard implementation, based on #ConversationScoped. It holds a class called ViewManager which has itself a List of Views. Initializing works fine and this list gets filled. But somehow it gets cleared (set to null) when the first form/view gets submitted. The setter for this is never called after the initialization, so it is not changed by my code. Somehow the view manager instance is still available, only this list of view within the view manager is null, which is kind of strange.
With omnifaces 2.4, everything did work fine (this is why I did not add some code of my wizard). I checked the changelog and noticed the MultiViews configuration when using ExtensionlessURLs. Don't know why this could effect my problem, but i tried it...with no success.
I have no idea what could be the problem, so maybe you can help me.
Thanks in advance :)
In OmniFaces, the FacesViews extensionless URLs feature got in version 2.5 an overhaul in order to support the so-called MultiViews as you can read on this blog.
During this overhaul I made a backwards compatibility mistake in the FacesViewsViewHandler where the <h:form> action URL is being manipulated in order to include the virtual folders of the MultiViews feature. The query string parameters were dropped from the original action URL and not added back.
The #ConversationScoped relies on the cid request parameter being present in the <h:form> action URL as in /context/page?cid=1. This thus became /context/page and therefore the conversation isn't retained across postbacks.
I will fix this in next OmniFaces release, for now you can get back the desired behavior by adding the below context parameter to web.xml.
<context-param>
<!-- Workaround for disappearing #ConversationScoped ?cid= parameter -->
<!-- This can be removed in next OmniFaces version after 2.6 -->
<param-name>org.omnifaces.FACES_VIEWS_VIEW_HANDLER_MODE</param-name>
<param-value>BUILD_WITH_PARENT_QUERY_PARAMETERS</param-value>
</context-param>
This parameter triggers a different way of building the URL whereby the entire query string from the original action URL is explicitly retained.

JSF / EL occasional failure to resolve action method

Environment:
JSF 2.1.11
el-api 2.2
Eclipse Kepler
Tomcat 7
Chrome
IE-11
I have a working xhtml and bean which contains several action methods and work fine.
I added another commandButton:
<h:commandButton id="idBtnSave" value="Save"
action="#{imageMetadataEditProvider.saveLabelWithBox}"></h:commandButton>
...and the action method:
public void saveLabelWithBox() {
saveBoundingBox();
saveImage();
}
... then for some inexplicable reason, EL cannot find method saveLabelWithBox on the bean.
I did several rounds of renaming the method, rebuilding, undeploying and cleaning the Tomcat environment, redeploy. That almost always failed.
HOWEVER, What seemed to work was simply to move the saveLabelWithBox(){} block to elsewhere in the bean. Suddenly, it worked again, so I gullibly renamed the method to something more meaningful, then it failed again... EL could not find the method. So I again renamed it and moved it, rebuilt, redeployed, now it works again.
I'm curious whether others have had such quirky behavior and what you think might cause this, beyond the typical suspects of corrupt Eclipse workspace, or being on a microwave beam path.
I finally resolved this quirky problem which seemed related to corruption in the environment. The cure seemed to be to create a new bean with a different name and import all the methods from the formerly unreliable bean. I also did the usual Eclipse -clean startup, although that seemed to have no effect. I also removed the Eclipse .metadata and restarted, although that also seemed to have no effect.
Oddly, after building a new replacement bean, it would not load via annotations:
#ManagedBean
#ViewScoped
...so I was obliged to define the replacement bean in faces-config, and then it would load at page request time. I think there is still something screwed up in the environment. But all the methods are now being resolved and it's been working OK for a couple of days.
Your mileage may vary.

How to catch runtime exceptions in jspx pages

This is in continuation with my previous question. I couldn't find solution for that. Hence I am trying to debug my application view layer jspx.
I realized that jspx is quite different from jsp, like it doesn't allow scriptlets. I know, that usage of this(scriptlets) is not at all recommended.
I have a particular SAP Net weaver server where hot deployment of jspx/jsp/html is not working. I have checked other alternatives like remote debugging, break points in jspx. But, its SAP net weaver, have some configuration issues. I have one option atleast to put sysouts, to trace runtime exceptions. But as its jspx files sysouts in scriptlets are not working. If it was jsp instead of jspx there, I could have traced/debugged the issues quickly using scriptlets temporarily until the issue got resolved atleast by using Sysouts.
Is there any equivalent code to this scriptlet(used in jsp)which we use very rarely.
<% System.out.println("The line above the null pointer exception : "+object.getPropery());%
Any equivalent code in jspx or icefaces components.
How do we debug a jspx page or handle exceptions inside a jspx page and find out errors.
Any eclipse plugins or tools available?

crystal viewer disrupts the log4j configuration

We have JBoss 4.0.3, log4j.xml in the jboss/server/default/conf folder. We set the system property ear.config.files.location to this folder. This log4j.xml gets loaded good when the application is running. We use crystal viewer components (java reporting component) to view few reports. The moment one of this report is loaded, our logging configuration is gone.
Almost nothing comes to the log file anymore. Is there a way to track down how this happens
The moment crystal report loads, SimpleLayout class gets loaded. i wonder why?
I am seeing DomConfigurator.configure can we use it to reload the file. Or can we use DomConfigurator.configureAndWatch to load it periodically.
Any ideas will be very helpful.
The solution posted here solved my issue
http://scn.sap.com/thread/1273402
In case the above link does not work, I have copy-pasted the necessary information below
After a long search, I have found the following :
In the JRCCommunicationAdapter class, a fonction is calling Logger.getRootLogger().setLevel(Level.ERROR).
So I'have made a copy of the rootLogger's level before I open the ReportClientDocument and re-set it after the open.
Level rootLevel = Logger.getRootLogger().getLevel();
...
oReportClientDocument.open (iRptName, OpenReportOptions._openAsReadOnly);
Logger.getRootLogger().setLevel(rootLevel);

Core Java Faces - 3rd edition (Cay Horstmann) : Chapter 4 selection tags pg 165 example not working

I'm not sure how i should put this question cos' there are couple of files (.java, .xhtml, etc) involved. Anyway this programs involves couple of checkboxes (selectmanycheckbox) and others. There is a onchange=submit() on this selectmanycheckboxes.
Here's what i noticed:
The generated html for each of those checkboxes there is a onchange=submit(). Kind of funny that by checking a checkboxes, it is submitting the form everytime.
The real issue is when i check one of the checkboxes, there is an error exactly as printed.
======================================================================
java.lang.ClassCastException: [I cannot be cast to [Ljava.lang.Object;
Caused by:
java.lang.ClassCastException - [I cannot be cast to [Ljava.lang.Object;
I don't understand the [I here. Any idea?
What i did after that was to remove all the checkboxes and submit the form. Still getting the same error.
Any idea?
The source code is available on their site. Your particular code is provided in javaee/ch04/select folder.
The generated html for each of those checkboxes there is a onchange=submit(). Kind of funny that by checking a checkboxes, it is submitting the form everytime.
It's been set by the <h:selectManyCheckbox onchange="submit()" /> in the code example. The onchange attribute is indeed totally unnecessary. It's likely an oversight of the author.
The real issue is when i check one of the checkboxes, there is an error exactly as printed.
java.lang.ClassCastException: [I cannot be cast to [Ljava.lang.Object;
I don't understand the [I here. Any idea?
The [I is the signature of an int[] type. The exception is telling that an instance of int[] type cannot be cast to an instance of Object[]. This makes in turn no sense, it should work fine. This particular problem is caused by something else.
What i did after that was to remove all the checkboxes and submit the form. Still getting the same error.
The <h:selectManyMenu> in the code example is also bound to an int[] property.
However removing them is not the right solution. It should work fine. Your problem is caused by something else deeper under the hoods. It's likely a bug in the EL implementation used. What servletcontainer make/version are you using? What servlet API version is your web.xml declared to? Did you try upgrading the servletcontainer?
I assume you are trying to run the example on Tomcat 6
Your WEB-INF/lib folder should have only these files: jsf-api.jar, jsf-impl.jar. You can download them from http://javaserverfaces.dev.java.net/
On your Tomcat/lib folder, you should replace the file el-api.jar by the file el-api2.2.jar. You can download it from http://download.java.net/maven/2/javax/el/el-api/2.2/

Resources