Apache POI 5.2.2 is not working on weblogic server14.1 - excel

I am working on uplift project to uplift Apache 412 to latest Apache POI 5.2.2 version. Everything is working fine on local standalone program in Netbeans IDE 12.2. But when I move it to server WebLogic 14C that run on Java 8, its not working. Also it does not give any errors in the logs.
When I try to export to Excel in my Jdeveloper, I am getting the error "<incident 305 created with problem key "DFW-99998 [java.lang.NoSuchMethodError]" with Apache POI 522 JARS. The same java program is working fine in Apache POI 4.1.2 API.
I enabled verbose classloading in Jdeveloper but it does not give any POI specific errors.
-verbose:class -XX:+UnlockDiagnosticVMOptions -XX:+LogVMOutput -XX:-DisplayVMOutput -XX:LogFile=C:\Record.log
I am using the below Apache POI JARS
commons-collections4-4.4.jar commons-compress-1.21.jar
commons-io-2.11.0.jar commons-math3-3.6.1.jar log4j-api-2.17.2.jar
log4j-core-2.17.2.jar poi-5.2.2.jar poi-ooxml-5.2.2.jar
poi-ooxml-full-5.2.2.jar SparseBitSet-1.2.jar xmlbeans-5.0.3.jar
In weblgic.xml I have below Configuration.
<prefer-application-packages>
<package-name>org.apache.commons.collections4.*</package-name>
<package-name>org.apache.commons.compress.*</package-name>
<package-name>org.apache.poi.*</package-name>
<package-name>org.apache.xmlbeans.*</package-name>
<package-name>org.openxmlformats.*</package-name>
<package-name>schemaorg_apache_xmlbeans.*</package-name>
<package-name>schemaorg_apache_xmlbeans.system.sXMLCONFIG.*</package-name>
<package-name>schemaorg_apache_xmlbeans.system.sXMLLANG.*</package-name>
<package-name>schemaorg_apache_xmlbeans.system.sXMLSCHEMA.*</package-name>
<package-name>schemaorg_apache_xmlbeans.system.sXMLTOOLS.*</package-name>
</prefer-application-packages>
<prefer-application-resources>
<resource-name>schemaorg_apache_xmlbeans/system/sXMLCONFIG/TypeSystemHolder.class</resource-name>
<resource-name>schemaorg_apache_xmlbeans/system/sXMLLANG/TypeSystemHolder.class</resource-name>
<resource-name>schemaorg_apache_xmlbeans/system/sXMLSCHEMA/TypeSystemHolder.class</resource-name>
<resource-name>schemaorg_apache_xmlbeans/system/sXMLTOOLS/TypeSystemHolder.class</resource-name>
</prefer-application-resources>
Do i need any add any configuration in weblogic.xml file ? please let me know. how to get more stacktrace and error information when the API fails. When i debugged this issue,below line fails and i am getting NoSuchMethodError.
**workbook = new SXSSFWorkbook(new XSSFWorkbook(), 100, true, true); - this line fails.
workbook.setCompressTempFiles(true);**

I found this article helpful, but there is a new dependency on IOUtils.byteArray that the answer doesn't handle. It results in this specific error because the version of commons IO that comes with WL doesn't support this method.
java.lang.NoSuchMethodError: org.apache.commons.io.IOUtils.byteArray(I)[B
Here is my modified weblogic.xml to account for that. We are on WL 14 with Java 11.
<weblogic-web-app
xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd
http://xmlns.oracle.com/weblogic/weblogic-web-app
http://xmlns.oracle.com/weblogic/weblogic-web-app/1.9/weblogic-web-app.xsd">
<context-root>xxx</context-root>
<container-descriptor>
<prefer-web-inf-classes>false</prefer-web-inf-classes>
<prefer-application-packages>
<package-name>org.apache.commons.*</package-name>
<package-name>org.apache.poi.*</package-name>
<package-name>org.apache.xmlbeans.*</package-name>
<package-name>org.openxmlformats.*</package-name>
<package-name>schemaorg_apache_xmlbeans.*</package-name>
</prefer-application-packages>
<prefer-application-resources>
<resource-name>schemaorg_apache_xmlbeans/system/sXMLCONFIG/TypeSystemHolder.class</resource-name>
<resource-name>schemaorg_apache_xmlbeans/system/sXMLLANG/TypeSystemHolder.class</resource-name>
<resource-name>schemaorg_apache_xmlbeans/system/sXMLSCHEMA/TypeSystemHolder.class</resource-name>
<resource-name>schemaorg_apache_xmlbeans/system/sXMLTOOLS/TypeSystemHolder.class</resource-name>
</prefer-application-resources>
</container-descriptor>
<description>xxx</description>
<weblogic-version>14.1.1</weblogic-version>
</weblogic-web-app>

Thanks, #kevin herein is my response to the above similar problem struggled for hrs to fix this.
Create your weblogic.xml file inside WEB-INF if not present and add the below code snippet
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app
xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app">
<container-descriptor>
<prefer-web-inf-classes>false</prefer-web-inf-classes>
<prefer-application-packages>
<package-name>org.apache.commons.*</package-name>
<package-name>org.apache.poi.*</package-name>
<package-name>org.apache.xmlbeans.*</package-name>
<package-name>org.openxmlformats.*</package-name>
<package-name>schemaorg_apache_xmlbeans.*</package-name>
</prefer-application-packages>
</container-descriptor>
</weblogic-web-app>

Related

Could not find backup for factory javax.faces.context.FacesContextFactory Weblogic

I'm using JSF2.1 Mojarra on Weblogic 12c with Servlet 3.0. jsf-api and jsf-impl are NOT in /WEB-INF/lib after build/deploy. I've tried checking for classpath pollution, but don't see anything. This is the error:
java.lang.IllegalStateException: Could not find backup for factory
javax.faces.context.FacesContextFactory.
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:1010)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:342)
at javax.faces.webapp.FacesServlet.init(FacesServlet.java:302)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction
.run(StubSecurityHelper.java:337)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction
.run(StubSecurityHelper.java:288)
Truncated. see log file for complete stacktrace
Here's what I found in my classpath that relates to JSF:
com.oracle.adf.library:JSF:pom:12.1.2-0-0
com.sun.faces:jsf-api:jar:2.1.7-01
com.sun.faces:jsf-impl:jar:2.1.7-01
Here's everything in my classpath:
com.bea.core.antlr:runtime:jar:1.0.0.0_3-2
com.oracle.adf.library:Contexts-and-Dependency-Injection:pom:12.1.2-0-0
com.oracle.adf.library:Java-EE:pom:12.1.2-0-0
com.oracle.adf.library:JSF:pom:12.1.2-0-0
com.oracle.adf.library:JSP-Runtime:pom:12.1.2-0-0
com.oracle.adf.library:JSTL:pom:12.1.2-0-0
com.oracle.adf.library:TopLink:pom:12.1.2-0-0
com.oracle.adf:eclipselink:jar:12.1.2-0-0
com.sun.faces:jsf-api:jar:2.1.7-01
com.sun.faces:jsf-impl:jar:2.1.7-01
com.sun.mail:javax.mail:jar:1.4.4
glassfish:el:jar:1.1.0.0_2-2
glassfish:jstl:jar:1.2.2.0
javax.enterprise:deploy:jar:1.3
javax.enterprise:inject:jar:1.1
javax.management:j2ee:jar:1.1.0.0
javax.security:jacc:jar:1.1.0.0_1-1
javax.servlet:jstl:jar:1.2
javax.servlet:servlet-api:jar:2.5
javax.xml:registry:jar:1.1.0.0_1-0-4
javax.xml:rpc:jar:1.2.3
javax.xml:stream:jar:1.1.1.0
javax.xml:ws:jar:2.3.0
javax:ejb:jar:3.2.0
javax:inject:jar:1.1
javax:interceptor:jar:1.2
javax:jms:jar:1.1.3
javax:jsp:jar:3.0.0.0_2-2
javax:resource:jar:1.6.1
javax:servlet:jar:2.1.0.0_3-0
javax:transaction:jar:2.1.0.0_1-1
javax:validation:jar:1.1.0
junit:junit:jar:4.4:test
log4j:log4j:jar:1.2.16
org.eclipse.persistence:javax.persistence:jar:2.0.5-SNAPSHOT
org.eclipse.persistence:nosql:jar:2.4.2.v20130514-5956486
org.eclipse.persistence:org.eclipse.persistence.oracle.nosql:jar:2.4.2-SNAPSHOT
org.glassfish:javax.annotation:jar:3.0.1
I found the issue. In WEB-INF/faces-config.xml, I had a navigation-handler that was pointing to a class that didn't exist. Correcting this resolved the issue.

Upgrading Hazelcast from 2.5 to 3.1

I was using Hazelcast 2.5. Recently we noticed "APPARENT DEADLOCK" issue on our production servers. Somewhere we find that upgrading to Hazelcast 3.0 or greater can solve the problem. Now when I am trying to upgrade to 3.1, i am getting following error in ApplicationContext.xml and it is not recognizing namespace "hz" anymore.
applicationContext-hazelcast.xml contents before upgrading to 3.1 (Removed some namespaces)
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:hz="http://www.hazelcast.com/schema/spring"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd
http://www.hazelcast.com/schema/spring http://www.hazelcast.com/schema/spring/hazelcast-spring-2.5.xsd">
applicationContext-hazelcast.xml contents after upgrading to 3.1 (Removed some namespaces)
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:hz="http://www.hazelcast.com/schema/spring"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd
http://www.hazelcast.com/schema/spring http://www.hazelcast.com/schema/spring/hazelcast-spring-3.1.xsd">
Error Message:
Multiple annotations found at this line:
- schema_reference.4: Failed to read schema document 'http://www.hazelcast.com/schema/spring/hazelcast-spring-3.1.xsd', because 1) could not find the document; 2) the document could not be read; 3)
the root element of the document is not <xsd:schema>.
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'hz:hazelcast'.
How can i do this ?
You're right looks like there's a problem downloading the 3.1 XSD. I'm getting a HTTP 403 when I try to use hazelcast-spring-3.1.
Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: http://www.hazelcast.com/schema/spring/hazelcast-spring-3.1.xsd
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1626)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:637)
at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:189)
at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:582)
at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:685)
at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaDOMParser.parse(SchemaDOMParser.java:530)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:2175)
... 31 more
When I upgrade to using hazelcast-spring-3.2 everything works for me and I can get a Hazelcast Instance via a Spring Bean. Could you try to upgrade to 3.2 and let me know if that works for you. In the meantime I'm going to raise an issue in github.com/hazelcast for the 3.1 issue.

Liferay deployment on weblogic10.3 fails?

I installed weblogic Server 10.3.Created a new domain.Downloaded liferay dependencies and additional war files.i copied the dependencies into lib folder and war into deploy folder and started server.But i am getting an error.
<Mar 7, 2014 2:35:20 PM IST> <Warning> <HTTP> <BEA-101342> <_appsdir_liferay-por
tal-6.1.1-ce-ga2-20120731132656558_war: Error(s) encountered while pre-compiling
jsp jspURI
configuration.jsp:17:18: Error in "init.jsp" at line 249: The code of method _j
spService(HttpServletRequest, HttpServletResponse) is exceeding the 65535 bytes
limit
<%# include file="/html/portlet/asset_publisher/init.jsp" %>
^--------------------------------------^
You seem to be running into LPS-27841. AFAIK a fix is available in EE, or you can search for the relevant commit(s) on github and apply them to your environment.
Note that Weblogic 10 is neither in the "certified" nor in the "supported" list of application servers for 6.2 (EE). E.g. it's untested and you might run into other issues. Weblogic 12 is "certified", 11 is "supported"

How to make WebLogic 12c to use Java EE version 5 instead of 6?

We are migrating our application that runs on WebLogic 10 to WebLogic 12.
I specified the Java EE version to be 5 in application.xml:
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd">
I don't understand why I still got this warning message on the console...
"<Warning> <Munger> <BEA-2156203> <A version attrib
ute was not found in element "application" in the deployment descriptor weblogic
.utils.classloaders.GenericClassLoader#1e21f52 finder: weblogic.utils.classloade
rs.CodeGenClassFinder#2696ac annotation: /META-INF/application.xml. A version at
tribute is required, but this version of the WebLogic Server will assume that th
e latest version is used. Future versions of WebLogic Server will reject descrip
tors that do not specify the Java EE version. To eliminate this warning, add an
appropriate "version=" to element "application" in the deployment descriptor.>"
I was able to deploy the application. But when I run the application, I got this error:
WARN - javax.servlet.ServletException: Could not find a RenderKit for "HTML_BASIC"
javax.servlet.ServletException: Could not find a RenderKit for "HTML_BASIC"
at javax.faces.webapp._ErrorPageWriter.throwException(_ErrorPageWriter.java:549)
at javax.faces.webapp.FacesServlet.handleLifecycleException(FacesServlet.java:293)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:187)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:242)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:216)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:132)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:338)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:74)
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:74)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:74)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3288)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3254)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2163)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2089)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2074)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1513)
at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
Caused by: java.lang.IllegalArgumentException: Could not find a RenderKit for "HTML_BASIC"
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getResponseStateManager(RendererUtils.java:1181)
at org.apache.myfaces.lifecycle.DefaultRestoreViewSupport.isPostback(DefaultRestoreViewSupport.java:141)
at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:80)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:103)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:76)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:178)
... 25 more
We are using JSF 1.2 and I did deploy jsf 1.2 before I deploy the application.
Here is my weblogic-application.xml:
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-application
xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-application"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/javaee_5.xsd http://xmlns.oracle.com/weblogic/weblogic-application http://xmlns.oracle.com/weblogic/weblogic-application/1.0/weblogic-application.xsd"
>
<wls:application-param>
<wls:param-name>webapp.encoding.default</wls:param-name>
<wls:param-value>UTF-8</wls:param-value>
</wls:application-param>
<wls:prefer-application-packages>
<wls:package-name>org.apache.*</wls:package-name>
<wls:package-name>javax.faces.*</wls:package-name>
<wls:package-name>com.sun.faces.*</wls:package-name>
<wls:package-name>org.mozilla.javascript.*</wls:package-name>
<wls:package-name>org.mozilla.classfile.*</wls:package-name>
</wls:prefer-application-packages>
<wls:prefer-application-resources>
<wls:resource-name>org.apache.*</wls:resource-name>
<wls:resource-name>javax.faces.*</wls:resource-name>
<wls:resource-name>com.sun.faces.*</wls:resource-name>
<wls:resource-name>META-INF/services/javax.servlet.ServletContainerInitializer</wls:resource-name>
<wls:resource-name>META-INF/services/com.sun.faces.spi.FacesConfigResourceProvider</wls:resource-name>
</wls:prefer-application-resources>
<wls:library-ref>
<wls:library-name>jsf</wls:library-name>
<wls:specification-version>1.2</wls:specification-version>
<wls:implementation-version>1.2.9.0</wls:implementation-version>
<wls:exact-match>true</wls:exact-match>
</wls:library-ref>
</wls:weblogic-application>
Update:
The 'Could not find a RenderKit for "HTML_BASIC"' error was caused by missing myfaces library. I added myfaces-api.jar and myfaces-imp.jar to /lib and the error is gone. After that my application runs fine. But I still get the warning message complaining about Jave EE Version descriptor missing.
Update 2:
It looks like the warning about Java EE version descriptor is caused by double deployments of jsf. Our application deploys jsf itself. If I don't deploy jsf 1.2 separately from admin console then I don't get the warning.

application.xml cannot be read due to XSD

I am using maven to build an ear and, after making it with java 1.6, I am trying to deploy on Websphere 6.1. Upon deployment it gives this warning and then the error below:
> +++ Warning +++: Sun Feb 12 10:17:03 AST 2012 org.xml.sax.SAXParseException: schema_reference.4: Failed to read
> schema document 'http://java.sun.com/xml/ns/javaee/application_6.xsd',
> because 1) could not find the document; 2) the document could not be
> read; 3) the root element of the document is not <xsd:schema>.
error:
> org.eclipse.jst.j2ee.commonarchivecore.internal.
> exception.DeploymentDescriptorLoadException: META-INF/application.xml
> Stack trace of nested exception:
> org.eclipse.jst.j2ee.commonarchivecore.internal.exception.ResourceLoadException:
> IWAE0007E Could not load resource "META-INF/application.xml" in
> archive "D:\IBM\SDP70\runtimes\base_v61\profiles\AppSrv
> 01\wstemp\0\upload\finapp-ear-1.0-SNAPSHOT.ear" Stack trace of nested
> exception: Wrapped exception org.xml.sax.SAXParseException: cvc-elt.1:
> **Cannot find the declaration of element 'application'.** at
> org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
> Source)
I tried searching on the forum and on Google but couldn't really find anything concrete on it.
I even tried to put the application_6.xsd in the {WAS_HOME}/runtimes/base_61/properties/schemas/ but to no avail.
The application.xml is actually made by maven so I don't think there should be any problem with it. This is what it looks like :
<?xml version="1.0" encoding="UTF-8" ?>
<application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/application_6.xsd" version="6">
Can anyone tell me whats wrong here?
The DeploymentDescriptorLoadException means that the application.xml is not valid. The generated code:
<?xml version="1.0" encoding="UTF-8" ?>
<application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/application_6.xsd" version="6">
is incomplete. Use the WebSphere Application Server Toolkit as in these questions:
deployment.xml for WebSphere and Maven
How to install ear in local web sphere (automatically)
References
Assembling a Web services-enabled client JAR file into an EAR file

Resources