java.io.NotSerializableException using Primefaces and Weblogic - jsf

I'm using Primefaces 6.1 running on a clustered WebLogic Server (Mojarra 2.2.8) Version: 12.2.1.3.0 and during the session replication i'm getting the following exception:
<Jan 30, 2018 4:08:08,727 PM CET> <Error> <Cluster> <BEA-003144> <All session objects should be serializable to replicate. Check the objects in the session. Failed to replicate a non-serializable object in context /app.
java.rmi.MarshalException: failed to marshal create(Lweblogic.rmi.spi.HostID;ILweblogic.cluster.replication.ROID;Ljava.io.Serializable;); nested exception is:
java.io.NotSerializableException: org.primefaces.model.SortMeta
at weblogic.rjvm.BasicOutboundRequest.marshalArgs(BasicOutboundRequest.java:100)
at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:297)
at weblogic.cluster.replication.RemoteReplicationServicesInternalImpl_12213_WLStub.create(Unknown Source)
at sun.reflect.GeneratedMethodAccessor1191.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Truncated. see log file for complete stacktrace
Caused By: java.io.NotSerializableException: org.primefaces.model.SortMeta
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
at java.util.ArrayList.writeObject(ArrayList.java:766)
at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Truncated. see log file for complete stacktrace
JSF component binding is never used in the application. Looking at the Primefaces source I can see that the model SortMeta (does not implements Serializable) is only used in the DataTable component.
The view state saving method has to be server side.
How to solve or avoid this exception?
EDIT:
Problem was caused by the "new" datatable attribute multiViewState.
https://forum.primefaces.org/viewtopic.php?f=3&t=54138&p=164132
Class SortMeta is now Serializable:
https://github.com/primefaces/primefaces/issues/3272

Related

Integrate Lombok with OpenCSV and JAXB

I am trying to write a code to convert csv to bean using opencsv and xml to bean using jaxb.
I tried using lombok.
The getters are not getting resolved even after lombok has generated them.
Exception with JAXB:
019-05-07 13:06:43.571 ERROR 16964 --- [nio-8080-exec-2] c.r.readerimpl.XMLStatementReaderImpl : JAXBException While reading the statement from XML
Exception with opencsv:
Caused by: java.lang.InstantiationException: com.rabobank.readerrows.Record
Caused by: java.lang.NoSuchMethodException: com.***.readerrows.Record.<init>()
Can someone help me?

Kie Server - JAXB error

I'm working with a third-party jar for the fact. In this jar there are some interfaces, so when I consume the kie server REST API, I get a JAXB error, the log is at the bottom.
If I try to marshal / un-marshal the BatchExecutionCommand using kie rest api libraries I get no error.
I tried to change the webapps\kieserver\WEB-INF\lib jaxb libraries to the 2.3 versions but the error persists.
Thanks!
org.kie.server.api.marshalling.MarshallingException: Error while creating JAXB context from default classes! 9 counts of IllegalAnnotationExceptions
org.kie.server.api.marshalling.jaxb.JaxbMarshaller.<init>(JaxbMarshaller.java:177)
org.kie.server.api.marshalling.MarshallerFactory.getMarshaller(MarshallerFactory.java:39)
org.kie.server.services.impl.KieContainerInstanceImpl.getMarshaller(KieContainerInstanceImpl.java:111)
org.kie.server.services.impl.marshal.MarshallerHelper.marshal(MarshallerHelper.java:47)
org.kie.server.remote.rest.drools.CommandResource.manageContainer(CommandResource.java:75)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:168)
org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269)
org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227)
org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216)
org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:541)
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:523)
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:125)
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.kie.server.services.impl.security.web.CaptureHttpRequestFilter.doFilter(CaptureHttpRequestFilter.java:42)
Root Cause: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 9 counts of IllegalAnnotationExceptions
uk.co.portaltech.rulesengine.wrappers.Order is an interface, and JAXB can't handle interfaces.
this problem is related to the following location:

Getting a custom class to be recognized as an fxml tag

I have a custom textfield, PersistentPromptTextField that extends TextField and would like to be able to add it my .fxml file. When I do and I run it, I get a list of errors such as this:
Caused by: java.lang.InstantiationException: gui.PersistentPromptTextField
at java.lang.Class.newInstance(Unknown Source)
at sun.reflect.misc.ReflectUtil.newInstance(Unknown Source)
... 75 more
Caused by: java.lang.NoSuchMethodException: gui.PersistentPromptTextField.<init>()
at java.lang.Class.getConstructor0(Unknown Source)
... 77 more
In my .fxml file I have included <?import gui.PersistentPromptTextField?> as well, but obviously I am missing something.
The error raised due to the FXMLLoader is (by default) tried to instantiate the given class using its a no-arg constructor. If you didn't define, try it.
Instantiating using a constructor having some arguments, you need to use #NamedArgs annotation. See this comprehensive answer for more details.

Problems using the XSP Starter Kit

I followed the instructions to install the XSP Starter kit from openntf. Everything mentioned in the video I was able to do but I am not able to activate it.
When I activate the plugin in my application and try to open it I get an Error 500. Anybody any idea?
The server console tells me:
https://www.dropbox.com/s/w2a0nlmjj5prnxs/Error%20OSGI.jpg?dl=0
The log file contains:
<extendedDataElements name="CommonBaseEventLogRecord:Exception" type="string">
<values>java.lang.RuntimeException: com.ibm.xsp.FacesExceptionEx: javax.faces.FacesException: java.lang.InstantiationException: org.openntf.xsp.starter.renderkit.AbstractHtmlTagRenderer
at com.ibm.designer.runtime.domino.adapter.ComponentModule.initModule(ComponentModule.java:461)
at com.ibm.domino.xsp.module.nsf.NSFComponentModule.initModule(NSFComponentModule.java:498)
at com.ibm.domino.xsp.module.nsf.NSFService.createNSFModule(NSFService.java:752)
at com.ibm.domino.xsp.module.nsf.NSFService.loadModule(NSFService.java:735)
at com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:588)
at com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:482)
at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:350)
at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:306)
at com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.j</values>
<values>ava:272)
Caused by: com.ibm.xsp.FacesExceptionEx: javax.faces.FacesException: java.lang.InstantiationException: org.openntf.xsp.starter.renderkit.AbstractHtmlTagRenderer
at com.ibm.xsp.config.CLBootStrap.initContext(CLBootStrap.java:89)
at com.ibm.xsp.config.BootStrap.init(BootStrap.java:82)
at com.ibm.xsp.config.ConfigureCoreListener.contextInitialized(ConfigureCoreListener.java:39)
at com.ibm.designer.runtime.domino.adapter.ComponentModule.initModule(ComponentModule.java:453)
... 8 more
Caused by: javax.faces.FacesException: java.lang.InstantiationException: org.openntf.xsp.starter.renderkit.AbstractHtmlTagRenderer
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:417)
at com.ibm.xsp.config.CLBootStrap.initContext(CLBootStrap.java:81)
... 11 more
Caused by: java.lang.InstantiationException: org.openntf.xsp.starter.renderkit.AbstractHtmlTagRenderer
at java.lang.J9VMInternals.newInstan</values>
<values>ceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1549)
at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:926)
at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:965)
at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:489)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:410)
... 12 more
</values>
</extendedDataElements>
There is a component that was available in the starter kit for org.openntf.xsp.starter.renderkit.AbstractHtmlTagRenderer. It's hitting an error trying to create that component. It's not a component designed to be used in a particular way, it's really there to show what needs to be created for a component - org.openntf.xsp.starter.AbstractHtmlTag is the component, html.xsp-config in META-INF defines the properties available to Domino Designer, html-faces-config adds the component to the server and defines which Java class to use for the component and which one for the renderer (to display the HTML). org.openntf.xsp.starter.renderkit.AbstractHtmlTagRenderer handles printing content to the browser.
I've not used the starter kit as is, but I did use it as a basis for my session at ICON UK http://www.slideshare.net/paulswithers1/from-xpages-hero-to-osgi-guru-taking-the-scary-out-of-building-extension-libraries-icon-uk-2014

can not find org.apache.myfaces.el.ValueBindingImpl class in myfaces-impl 2.1.6

I am working on a jsf migration project. In the process of migration to jsf 2.0, I have replaced myfaces-api-1.1.5 and myfaces-impl1.1.5 with myfaces-impl(2.1.6). I got the following Exception.
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_22]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_22]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_22]
Caused by: java.lang.NoClassDefFoundError: org/apache/myfaces/el/ValueBindingImpl
at java.lang.Class.getDeclaredConstructors0(Native Method) [:1.6.0_22]
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) [:1.6.0_22]
at java.lang.Class.getConstructor0(Class.java:2699) [:1.6.0_22]
at java.lang.Class.getConstructor(Class.java:1657) [:1.6.0_22]
at org.jboss.as.web.deployment.jsf.JsfManagedBeanProcessor.deploy(JsfManagedBeanProcessor.java:105)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115)
... 5 more
Caused by: java.lang.ClassNotFoundException: org.apache.myfaces.el.ValueBindingImpl from [Module "deployment.ASSET.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:361)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:333)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:310)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:103)
... 11 more
When I try to find out ValueBindingImpl in the jar files, I am not able to find org.apache.myfaces.el.ValueBindingImpl in the myfaces-impl(2.1.6).. Is there any alternative?
It seems that your code is using MyFaces 1.1 specific implementation classes instead of the JSF 1.1 API classes. For example,
ValueBinding binding = new ValueBindingImpl(...);
instead of
ValueBinding binding = application.createValueBinding(...);
You'd need to fix the code to remove MyFaces 1.1 specific implementation classes.
Note that ValueBinding is deprecated since JSF 1.2, if you can, replace by ValueExpression.

Resources