RE: RE: when i upgrade poi.jar from 3.15 to 4.12 , portal started failed

Olaf Kock, modified 1 Year ago. New Member Posts: 2 Join Date: 11/20/23 Recent Posts

i use earlier portal.

i want to upgrade poi.jar from 3.15 to 4.1.2 or higher.

poi.jar located in /liferay/tomcat/webapps/ROOT/WEN-INF/lib/.

after i replace a new jar, portal start failed with info:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.kernel.metadata.RawMetadataProcessor' defined in class path resource [META-INF/util-spring.xml]: Cannot create inner bean 'org.apache.tika.parser.AutoDetectParser#7181cdd9' of type [org.apache.tika.parser.AutoDetectParser] while setting bean property 'parser'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.tika.parser.AutoDetectParser#7181cdd9' defined in class path resource [META-INF/util-spring.xml]: Cannot create inner bean 'org.apache.tika.config.TikaConfig#78d8c42f' of type [org.apache.tika.config.TikaConfig] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.tika.config.TikaConfig#78d8c42f' defined in class path resource [META-INF/util-spring.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.tika.config.TikaConfig]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/poi/poifs/filesystem/NPOIFSFileSystem
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:313)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:122)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1475)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1220)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:762)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:434)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
    at com.liferay.portal.spring.context.PortalContextLoaderListener.contextInitialized(PortalContextLoaderListener.java:294)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4763)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5232)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:727)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:673)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1881)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

 

what should i do?

or skip check the poi.jar and so i can delete poi.jar

thumbnail
Olaf Kock, modified 1 Year ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts

i use earlier portal.

Please give some more precise information: Which version are you using?

AFAIK Liferay does not come with poi, so this would be your custom version to begin with, so anything that you did for including it to begin with is 100% custom. And in case any earlier version of Liferay ever came with poi, then it has been compiled with exactly the version that's found there, and there's no guarantee that you can just replace it with a new one - especially with a different major version number.

Also, note that WEB-INF/lib is a really bad place for custom files to live to begin with. They should be local to your plugin (if you're on 6.x) or shared through OSGi.

Randomly updating major versions of any embedded component (built-in or custom) can be expected to require additional code changes. You might also be missing transitive dependencies, as packaging of poi might have changed from a single jar to multiple ones.

Olaf Kock, modified 1 Year ago. New Member Posts: 2 Join Date: 11/20/23 Recent Posts

Thanks for your answer and the poi version that i want to use is 4.12.

You are right , the portal which i used is customized and I have asked my working paterner for advice.

My paterner is working on it.

I have no more info with his process so far 😂

 

thumbnail
Olaf Kock, modified 1 Year ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts

You've mentioned the poi version earlier, just not the Liferay version (other than "earlier")

But either way: You're placing the library in a really unusual directory (don't!) and you're not mentioning anything about transitive dependencies that you originally brought (and that require update) or that the new version might need.