How to import a huge list of content in XML into Liferay? - liferay

I am new to Liferay. I am working on a task, in that I need to convert the list content in XML to liferay article. In short, I am converting huge list of content into Liferay article.
I have developed a portal, through that I am importing a content into liferay. During importing time,few minutes successfully import the content into liferay. After few minutes, I got below exception. I have tried many times to import, But I failed to import complete content into liferay.
importing:java.lang.ArrayIndexOutOfBoundsException
Aug 27, 2015 9:38:16 AM org.apache.catalina.core.ApplicationDispatcher invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
atcom.liferay.portal.service.permission.PortletPermissionImpl.contains(PortletPermissionImpl.java:305)
atcom.liferay.portal.service.permission.PortletPermissionImpl.contains(PortletPermissionImpl.java:226)
atcom.liferay.portal.service.permission.PortletPermissionImpl.contains(PortletPermissionImpl.java:211)
atcom.liferay.portal.service.permission.PortletPermissionImpl.hasAccessPermission(PortletPermissionImpl.java:436)
atcom.liferay.portal.service.permission.PortletPermissionUtil.hasAccessPermission(PortletPermissionUtil.java:278)
atcom.liferay.portlet.SecurityPortletContainerWrapper.hasAccessPermission(SecurityPortletContainerWrapper.java:344)
atcom.liferay.portlet.SecurityPortletContainerWrapper.check(SecurityPortletContainerWrapper.java:209)
atcom.liferay.portlet.SecurityPortletContainerWrapper.checkRender(SecurityPortletContainerWrapper.java:243)
atcom.liferay.portlet.SecurityPortletContainerWrapper.render(SecurityPortletContainerWrapper.java:139)
atcom.liferay.portlet.RestrictPortletContainerWrapper.render(RestrictPortletContainerWrapper.java:126)
atcom.liferay.portal.kernel.portlet.PortletContainerUtil.render(PortletContainerUtil.java:156)
atcom.liferay.portal.layoutconfiguration.util.PortletRenderer._render(PortletRenderer.java:125)
atcom.liferay.portal.layoutconfiguration.util.PortletRenderer.access$4(PortletRenderer.java:107)
atcom.liferay.portal.layoutconfiguration.util.PortletRenderer$PortletRendererCallable.doCall(PortletRenderer.java:180)
atcom.liferay.portal.layoutconfiguration.util.PortletRenderer$PortletRendererCallable.doCall(PortletRenderer.java:1)
atcom.liferay.portal.kernel.executor.CopyThreadLocalCallable.call(CopyThreadLocalCallable.java:69)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
atcom.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask._runTask(ThreadPoolExecutor.java:682)
atcom.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask.run(ThreadPoolExecutor.java:593)
at java.lang.Thread.run(Thread.java:745)
09:38:16,735 ERROR [http-bio-9001-exec-134][status_jsp:753] javax.servlet.ServletException: java.util.concurrent.ExecutionException: com.liferay.portal.kernel.portlet.PortletContainerException: com.liferay.portal.kernel.portlet.PortletContainerException: java.lang.NullPointerException

As a workaround of this, you can consider increasing the max queue size:
index.search.writer.max.queue.size=9999999
Also, you can add the following which makes disk writes less often:
lucene.commit.batch.size=10000
lucene.commit.time.interval=300000
You can consider referring this defect notes for more information.
Cheers!
AJ
P.S. This is just a possible workaround or tuning thing, but I think there would be a better solution somewhere in case the above is not.

Related

Access page custom field in Liferay 7.1 Free marker template

I have set a page custom field called CustomLogo in Liferay 7.1. I would like to access its value in Free marker template. After reading documentation & some posts related to it, i used following code to access custom field
<#assign page_custom_field_logo_url = layout.getGroup().getExpandoBridge().getAttribute("CustomLogo") />
<h1>${page_custom_field_logo_url }</h1>
I have set View Permission for the custom field (to all User roles). I have also checked if the column names and values are set properly in the liferay database (expando tables).
However i am getting following error:
FreeMarker template error: Java method "com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl.getAttribute(String)" threw an exception when invoked on com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl object "com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl#f2864c8"; see cause exception in the Java stack trace. FTL stack trace ("~" means nesting-related):
- Failed at: #assign page_custom_field_logo_url... [in template "/templates/portal_normal.ftl" at line 75, column 37]
Upon observing the stack trace , I saw there is a null pointer exception which states:
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
at com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl.getAttribute(ExpandoBridgeImpl.java:219)
at com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl.getAttribute(ExpandoBridgeImpl.java:199)
Caused by: java.lang.NullPointerException
at com.liferay.portlet.expando.service.permission.ExpandoColumnPermissionImpl.contains(ExpandoColumnPermissionImpl.java:73)
at com.liferay.expando.kernel.service.permission.ExpandoColumnPermissionUtil.contains(ExpandoColumnPermissionUtil.java:58)
at com.liferay.portlet.expando.service.impl.ExpandoValueServiceImpl.getData(ExpandoValueServiceImpl.java:121)
at sun.reflect.GeneratedMethodAccessor1066.invoke(Unknown Source)
As i stated above, i already set view permission for the custom field. I also double checked the key, typos and possible mistakes but no success.
Please let me know if you have any suggestions or things i missed out. Thanks
Try to get the expando bridge from the layout instead of the group, so
layout.getExpandoBridge().getAttribute("CustomLogo")
should work.

Class Cast Exception coming while Deploying in Liferay DXP

We are getting following below error when we deploy any application in Liferay DXP 7.
When we clean the Liferay DXP and then redeploy the below issue gets fixed.
But the problem with this approach is that all the caches gets deleted after cleaning and when we redeploy and access the site , the caches gets recreated but it takes lot of time to access any page on the site.
[2018-05-17 10:58:33,113] [DEBUG] [10.111.2.74] [] [http-nio-5443-exec-8] [com.fsvps.clientPortal.service.common.ProgramFilterPopulator] - Retrieving logged in user
[2018-05-17 10:58:33,137] [DEBUG] [10.111.2.74] [] [http-nio-5443-exec-8] [com.fsvps.clientPortal.util.common.UserContextInitializationInterceptor] - Portlet mode view and debug mode = false
[2018-05-17 10:58:33,137] [DEBUG] [10.111.2.74] [] [http-nio-5443-exec-8] [com.fsvps.clientPortal.util.common.UserContextInitializationInterceptor] - Checking to see if invalid filter view should be shown
[2018-05-17 11:07:40,859] [DEBUG] [] [] [http-nio-5443-exec-2] [com.fsvps.clientPortal.util.common.UserContextInitializationInterceptor] - Entering
[2018-05-17 11:07:40,859] [WARN] [] [] [http-nio-5443-exec-2] [org.springframework.web.portlet.DispatcherPortlet] - Handler execution resulted in exception - forwarding to resolved error view
java.lang.ClassCastException: com.fsvps.clientPortal.domain.common.UserContext cannot be cast to com.fsvps.clientPortal.domain.common.UserContext
at com.fsvps.clientPortal.domain.common.UserContext$$FastClassBySpringCGLIB$$818d2483.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673)
at com.fsvps.clientPortal.domain.common.UserContext$$EnhancerBySpringCGLIB$$830ac420.setIpAddress(<generated>)
at com.fsvps.clientPortal.util.common.UserContextInitializationInterceptor.preHandle(UserContextInitializationInterceptor.java:93)
at org.springframework.web.portlet.handler.HandlerInterceptorAdapter.preHandleRender(HandlerInterceptorAdapter.java:72)
at org.springframework.web.portlet.DispatcherPortlet.doRenderService(DispatcherPortlet.java:739)
at org.springframework.web.portlet.FrameworkPortlet.processRequest(FrameworkPortlet.java:537)
The exact cause is impossible to pinpoint with the information you give. However, the class of problem is easy to identify:
java.lang.ClassCastException:
com.fsvps.clientPortal.domain.common.UserContext cannot be cast to
com.fsvps.clientPortal.domain.common.UserContext
(separated to lines to illustrate the identical class name)
Whenever a class can't be typecasted to itself or a legitimate superclass/interface, you're dealing with duplicate code: There are two versions of the class with the same name available to the classloader, and the system is choosing both.
As the error message just contains the name of the class, not its classloader, a first glance at the error message doesn't make sense. Knowing that a class is uniquely described by its package, name, and its classloader leads you to the root cause.
Identify your modules and make sure that there's only one option for com.fsvps.clientPortal.domain.common.UserContext available.
Edit: Answering to your comments - without knowing your deployment details, there's no way to help you other than wild guesses. Please add more information to your question if the next wild guess doesn't help:
The name of the class, UserContext, suggests that you might store it somewhere, e.g. in a session. Doing so will prevent the original class from unloading when you're undeploying your plugin. Note that there is a huge difference between undeploying code and garbage collecting objects: GC can only happen, when there is no more reference.
If you deploy an updated version of your plugin, the old and existing objects still are referencing the previously loaded UserContext class, while the new code is trying to assign it to a new UserContext reference. Even though, both might be identical in implementation, they are different classes that just share the name.
You can't keep long living references to code that might undeploy, and expect them to stay usable. A quick fix (if you're deploying OSGi modules) might be to extract stable and long-used classes into its own bundle that you won't redeploy. Or replace session stored objects (assuming that this is it) with Java runtime classes, e.g. Map of built-in types, and build a UserContext object from those types whenever you need it.

Oracle ADF Unexpected Null Pointer Exception When accessing view objects in a seperate thread

I have a webservice in adf that treats requests, I use methods from a jar that run through view object iterators and so on.
In treating a request I call a method from the said jar that initializes a separate thread that manipulates and compares rows from view objects in that separate thread,
I am getting random exceptions like the following:
## Detail 0 ##
java.lang.NullPointerException
at oracle.jbo.server.ViewRowSetIteratorImpl.initViewRowSetIteratorImpl(ViewRowSetIteratorImpl.java:227)
at oracle.jbo.server.ViewRowSetIteratorImpl.(ViewRowSetIteratorImpl.java:176)
at oracle.jbo.server.ViewRowSetImpl.createNewRowSetIterator(ViewRowSetImpl.java:1434)
at oracle.jbo.server.ViewRowSetImpl.createViewRowSetIterator(ViewRowSetImpl.java:1485)
at oracle.jbo.server.ViewRowSetImpl.getDefaultRowSetIterator(ViewRowSetImpl.java:1704)
at oracle.jbo.server.ViewRowSetImpl.setRangeSize(ViewRowSetImpl.java:2936)
at oracle.jbo.server.ViewObjectImpl.doCreateViewLinkAccessorRS(ViewObjectImpl.java:16080)
at oracle.jbo.server.ViewObjectImpl.createViewLinkAccessorRS(ViewObjectImpl.java:16171)
at oracle.jbo.server.AssociationDefImpl.get(AssociationDefImpl.java:472)
at oracle.jbo.server.ViewAttributeDefImpl.get(ViewAttributeDefImpl.java:949)
at oracle.jbo.server.ViewRowStorage.getViewLinkAccessorResult(ViewRowStorage.java:1528)
at oracle.jbo.server.ViewRowStorage.getAttributeInternal(ViewRowStorage.java:1827)
at oracle.jbo.server.ViewRowImpl.getAttributeValue(ViewRowImpl.java:1923)
at oracle.jbo.server.ViewRowImpl.getAttributeInternal(ViewRowImpl.java:866)
and
## Detail 0 ##
java.lang.NullPointerException
at oracle.jbo.server.ViewRowImpl.getUseViewLogicGroupDef(ViewRowImpl.java:6078)
at oracle.jbo.server.ViewRowStorage.getViewAttributeDef(ViewRowStorage.java:1432)
at oracle.jbo.server.ViewRowStorage.getAttributeInternal(ViewRowStorage.java:1778)
at oracle.jbo.server.ViewRowImpl.getAttributeValue(ViewRowImpl.java:1923)
at oracle.jbo.server.ViewRowImpl.getAttributeInternal(ViewRowImpl.java:866)
and
Caused by: java.lang.NullPointerException
at oracle.jbo.server.ViewRowSetIteratorImpl.initViewRowSetIteratorImpl(ViewRowSetIteratorImpl.java:227)
at oracle.jbo.server.ViewRowSetIteratorImpl.(ViewRowSetIteratorImpl.java:176)
at oracle.jbo.server.ViewRowSetImpl.createNewRowSetIterator(ViewRowSetImpl.java:1434)
at oracle.jbo.server.ViewRowSetImpl.createViewRowSetIterator(ViewRowSetImpl.java:1485)
at oracle.jbo.server.ViewRowSetImpl.getDefaultRowSetIterator(ViewRowSetImpl.java:1704)
at oracle.jbo.server.ViewRowSetImpl.setRangeSize(ViewRowSetImpl.java:2936)
at oracle.jbo.server.ViewObjectImpl.doCreateViewLinkAccessorRS(ViewObjectImpl.java:16080)
at oracle.jbo.server.ViewObjectImpl.createViewLinkAccessorRS(ViewObjectImpl.java:16171)
at oracle.jbo.server.AssociationDefImpl.get(AssociationDefImpl.java:472)
at oracle.jbo.server.ViewAttributeDefImpl.get(ViewAttributeDefImpl.java:949)
at oracle.jbo.server.ViewRowStorage.getViewLinkAccessorResult(ViewRowStorage.java:1528)
at oracle.jbo.server.ViewRowStorage.getAttributeInternal(ViewRowStorage.java:1827)
at oracle.jbo.server.ViewRowImpl.getAttributeValue(ViewRowImpl.java:1923)
at oracle.jbo.server.ViewRowImpl.getAttributeInternal(ViewRowImpl.java:866)
The same method when it runs without the jar ( same code like in the jar but as a part of the same project ), it executes perfectly fine.
Could you please tell me why a NullPointerException is raised?
Thanks
You can not use the Business Components(ViewObject,Entities... etc) inside a thread.
There is no context (FacesContext cannot be initialized ).So you have to pass the ApplicationModule as a paramter to your method. But it will take a lot of time for processing
So the best way to access your data is to use CallableStatments PreparedStatments with Java Data Source connection.

getRowCount() method on viewPanel control & database full text index error

I have simple code to count the rows in view panel control:
getComponent("viewPanel1").getRowCount()
Error calling method 'getRowCount()' on java class 'com.ibm.xsp.component.xp.XspViewPanel'
Stack trace shows the details as below:
Caused by: com.ibm.jscript.InterpretException: Script interpreter error, line=1, col=64: Error calling method 'getRowCount()' on java class 'com.ibm.xsp.component.xp.XspViewPanel'
Caused by: com.ibm.xsp.FacesExceptionEx: Notes error: The full text index for this database is in use
Caused by: NotesException: Notes error: The full text index for this database is in use
at lotus.domino.local.View.FTSearchSorted(Unknown Source)
Any quick solution to avoid these errors on server?
This is, in fact, a server issue. Take a look here or google it to fine-tune your server.

WebSphereApplication NoClassDefFoundError while unmarshalling XML with JAXB

I´ve deployed an EAR on a Websphere Application Server 7. In my code there is a part where I try to unmarshall a XML file into an object. I get this error when trying to do that:
java.lang.NoClassDefFoundError: com.ibm.xtq.bcel.util.SyntheticRepository (initialization failure)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:140)
at com.ibm.xtq.bcel.classfile.JavaClass.<init>(JavaClass.java:109)
at com.ibm.xtq.bcel.classfile.JavaClass.<init>(JavaClass.java:228)
at com.ibm.xtq.bcel.generic.ClassGen.getJavaClass(ClassGen.java:174)
at com.ibm.fcg.bcel.FcgClassGenBCEL.dump2(Unknown Source)
at com.ibm.fcg.bcel.FcgClassGenBCEL.dump(Unknown Source)
at com.ibm.xml.xlxp2.jaxb.unmarshal.codegen.fcg.FCGDeserializationStubGenerator.generate(FCGDeserializationStubGenerator.java:249)
at com.ibm.xml.xlxp2.jaxb.codegen.AbstractGeneratedStubFactory.generateByteCode(AbstractGeneratedStubFactory.java:96)
at com.ibm.xml.xlxp2.jaxb.unmarshal.codegen.fcg.FCGStubFactory.generateStubByteCode(FCGStubFactory.java:46)
at com.ibm.xml.xlxp2.jaxb.codegen.AbstractGeneratedStubFactory.getStubClassConstructor(AbstractGeneratedStubFactory.java:154)
at com.ibm.xml.xlxp2.jaxb.unmarshal.codegen.AbstractGeneratedDeserializationStubFactory.createStub(AbstractGeneratedDeserializationStubFactory.java:58)
at com.ibm.xml.xlxp2.jaxb.unmarshal.impl.DeserializationContext.startComplexType(DeserializationContext.java:662)
at com.ibm.xml.xlxp2.jaxb.unmarshal.impl.DeserializationContext.handleRootElementEvent(DeserializationContext.java:303)
at com.ibm.xml.xlxp2.jaxb.unmarshal.impl.JAXBDocumentScanner.produceRootElementEvent(JAXBDocumentScanner.java:186)
at com.ibm.xml.xlxp2.scan.DocumentScanner.scanRootElement(DocumentScanner.java:2234)
at com.ibm.xml.xlxp2.scan.DocumentScanner.scanProlog(DocumentScanner.java:1726)
at com.ibm.xml.xlxp2.scan.DocumentScanner.nextEvent(DocumentScanner.java:1316)
at com.ibm.xml.xlxp2.scan.DocumentScanner.parseDocumentEntity(DocumentScanner.java:1168)
at com.ibm.xml.xlxp2.jaxb.unmarshal.impl.JAXBDocumentScanner.unmarshal(JAXBDocumentScanner.java:125)
at com.ibm.xml.xlxp2.jaxb.unmarshal.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:120)
at com.inditex.lois.core.ws.utilidades.services.impl.AdaptadorServiceImpl.transformarXMLenObjeto(AdaptadorServiceImpl.java:137)
As far as I know that class is part of IBM JDK and cannot be found in runtime. Is there anything I have to modify in my ear or, as I guess, its all about configuring/modifiying WAS configuration (or even applying a patch if this is a bug).
Any help? Thanks a lot.
(Sorry for my english :) )
This exception means that the class com.ibm.xtq.bcel.util.SyntheticRepository is found, but failed static initialization. If there is no other message in the log about this, then this is the time to open a PMR with IBM. Static initializers in internal WebSphere code should never fail during normal usage course.
Same here, there is an APAR:
http://www-01.ibm.com/support/docview.wss?uid=swg1IV41639
Problem conclusion
This defect will be fixed in:
6.0.0 SR14
6.0.1 SR6
7.0.0 SR5
.
The fix resolved the AccessControlException. SyntheticRepository
class can be initialized properly, hence NoClassDefFoundError
does not occur.

Resources