Freemarker directory path is not readable in UAT - java

I'm using freemarker template to create a pdf file. This code works in my local but when I deploy to UAT, it gives the below error:
| ERROR | PrintServlet | /templates does not exist.
java.io.FileNotFoundException: /templates does not exist.
at freemarker.cache.FileTemplateLoader$1.run(FileTemplateLoader.java:128)
at java.security.AccessController.doPrivileged(Native Method)
at freemarker.cache.FileTemplateLoader.<init>(FileTemplateLoader.java:125)
at freemarker.cache.FileTemplateLoader.<init>(FileTemplateLoader.java:101)
at freemarker.template.Configuration.setDirectoryForTemplateLoading(Configuration.java:1171)
at com.abg.wizardgui.servlet.PrintServlet.processRequest(PrintServlet.java:256)
at com.abg.wizardgui.servlet.PrintServlet.doPost(PrintServlet.java:420)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:286)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:260)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:137)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:350)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
at com.abg.wizardgui.filter.JsessionIdRemoverFilter.doFilter(JsessionIdRemoverFilter.java:88)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:32)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3706)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3672)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:328)
at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197)
at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)
at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71)
at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2443)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2291)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2269)
at weblogic.servlet.internal.ServletRequestImpl.runInternal(ServletRequestImpl.java:1705)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1665)
at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:272)
at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:352)
at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:337)
at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:57)
at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:652)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:420)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:360)
Code:
cfg.setDirectoryForTemplateLoading(new File("/templates/"));
Template template = cfg.getTemplate("template.ftl");
The template.ftl file is located inside src/templates/ folder. I tried multiple ways of defining the directory. I also tried using the setClassForTemplateLoading method instead but it keeps giving an error.

The src directory doesn't exist on the server after deployment (at least normally), since it's source code. Instead, you could put your templates under src/main/resources/templates (assuming Maven or usual Gradle project structure), so that it will be part of the deployed jar. Then use cfg.setClassForTemplateLoading(SomeClassFromTheSameJar.class, "/templates").

Related

Java determining reason of ClassNotFound

I have a Java EAR application deployed in a Oracle Weblogic Application Server.
The Application is processing among others some HTTP requests
In one of them it is processing some XML files (form the file system)
What makes this interesting is that the very same EAR file is deployed on another server machine, that was set up based on the same installation manual like the first one and there I get the following Class Not Found Exception:
org.xml.sax.SAXException: SAX2 driver class org.apache.xerces.parsers.SAXParser not found
java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser
at org.xml.sax.helpers.XMLReaderFactory.loadClass(XMLReaderFactory.java:230)
at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(XMLReaderFactory.java:191)
at org.example.application.BL.data.ResourceParser.parse(ResourceParser.java:178)
at org.example.application.BL.data.DataModel.validate(DataModel.java:323)
at org.example.application.BL.action.Update.execute(Update.java:165)
at org.example.application.webapp.ActionControl.doGet(ActionControl.java:78)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:286)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:260)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:137)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:350)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:247)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3682)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3649)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:326)
at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197)
at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)
at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71)
at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2433)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2281)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2259)
at weblogic.servlet.internal.ServletRequestImpl.runInternal(ServletRequestImpl.java:1691)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1651)
at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:270)
at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:348)
at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:333)
at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:54)
at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:640)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:406)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:346)
Caused by: java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:1026)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:987)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:83)
at weblogic.utils.classloaders.GenericClassLoader.doFindClass(GenericClassLoader.java:608)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:540)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:493)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:470)
at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:62)
at org.xml.sax.helpers.NewInstance.newInstance(NewInstance.java:82)
at org.xml.sax.helpers.XMLReaderFactory.loadClass(XMLReaderFactory.java:228)
... 32 more
on the suspect lines:
final XMLReader parser = XMLReaderFactory.createXMLReader();
I checked that on both servers (Same Java, Weblogic, ...) there is the same classpath available to the applications, the same commandline arguments and and as well checked that they have opened the same files (lsof) and they match for all the jar files etc (except for log files).
Currently I'm a bit irritated where the one loads the SAX form that is not accessible for the other.
Running on: Java 8, WebLogic 12c;
Edit: I've found a well this in the logs - but couldn't identify the cause:
Apr 15, 2019 12:30:04 PM weblogic.wsee.runtime.JMSStoreRoutableIDMapper addServerSetListener
INFO: add ServerSetListener for partition: DOMAIN
Warning: org.apache.xerces.parsers.SAXParser: Feature 'http://javax.xml.XMLConstants/feature/secure-processing' is not recognized.
Warning: org.apache.xerces.parsers.SAXParser: Property 'http://javax.xml.XMLConstants/property/accessExternalDTD' is not recognized.
Warning: org.apache.xerces.parsers.SAXParser: Property 'http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit' is not recognized.
Apr 15, 2019 12:30:38 PM [com.sun.xml.ws.policy.EffectiveAlternativeSelector] selectAlternatives
WARNING: WSP0075: Policy assertion "{http://docs.oasis-open.org/ws-tx/wsat/2006/06}ATAssertion" was evaluated as "UNKNOWN".
Apr 15, 2019 12:30:38 PM [com.sun.xml.ws.policy.EffectiveAlternativeSelector] selectAlternatives
WARNING: WSP0019: Suboptimal policy alternative selected on the client side with fitness "UNKNOWN".

Apache Camel stax2 NoSuchMethodError

I'm getting very weird behavior from the Apache Camel application. I'm deploying the EAR on WebLogic 12.2.1.3 server on our test environment, and everything works fine. The EAR contains all the dependencies used by the application.
However, when I deploy the same EAR to production (it deploys fine), it gives the following runtime exception during message handling:
Exception occurred during execution on the exchange: Exchange[ID-napoli-34361-1518770862962-0-99], StackTrace: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[ID-napoli-34361-1518770862962-0-99]
at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1790)
at org.apache.camel.impl.DefaultExchange.setException(DefaultExchange.java:350)
at org.apache.camel.component.cxf.CxfProducer.process(CxfProducer.java:141)
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145)
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:541)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:198)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:120)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:198)
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:97)
at org.apache.camel.component.cxf.CxfConsumer$CxfConsumerInvoker.syncInvoke(CxfConsumer.java:220)
at org.apache.camel.component.cxf.CxfConsumer$CxfConsumerInvoker.invoke(CxfConsumer.java:147)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$2.run(ServiceInvokerInterceptor.java:126)
at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:131)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:191)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:301)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:220)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:276)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:286)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:260)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:137)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:350)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:247)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3697)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3667)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:326)
at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197)
at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)
at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71)
at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2443)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2291)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2269)
at weblogic.servlet.internal.ServletRequestImpl.runInternal(ServletRequestImpl.java:1703)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1663)
at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:272)
at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:352)
at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:337)
at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:57)
at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:644)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:415)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:355)
Caused by: java.lang.NoSuchMethodError: org.codehaus.stax2.ri.EmptyIterator.getInstance()Lorg/codehaus/stax2/ri/EmptyIterator;
at com.ctc.wstx.sw.OutputElementBase.getPrefixes(OutputElementBase.java:358)
at org.apache.cxf.staxutils.StaxUtils.writeStartElement(StaxUtils.java:811)
at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:758)
at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:722)
at org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor$SAAJOutEndingInterceptor.handleMessage(SAAJOutInterceptor.java:214)
at org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor$SAAJOutEndingInterceptor.handleMessage(SAAJOutInterceptor.java:174)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:516)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:418)
at org.apache.camel.component.cxf.CxfProducer.process(CxfProducer.java:133)
... 51 more
, Out: null: ]
The camel route success all the way to the cxf component, which tries to call external web service, failing for some reason and causing the exception.
It's the same package with same dependencies on both environments, and in the production environment weblogic I can not see any external libraries installed, which could conflict with the EAR package. So, how do I trace what is causing the problem?
This seems to be a compatibility issue between Stax and Woodstox.
See this issue and try to fix your dependencies:
https://github.com/FasterXML/woodstox/issues/10
The problem was weblogic providing the following library
oracle_common/modules/org.codehaus.woodstox.stax2-api.jar
The different version of same library was also packaged within the EAR. The problem was solved by setting prefer-application-packages in the deployment descriptor.
It is still unknown, why the application worked in our environment without the prefer-application-packages attribute. Shouldn't it have loaded the weblogic-one in our environment too? What causes the seemingly random behavior in this case?

Eclipselink error 3002

I am doing a simple migration from Toplink 10g to native Eclipselink v2.6.4 by following the instructions here (particularly task 3 and 4). Everything compiles ok but when I try to run my app I get the error below.
I tried using the old mapping file (which is still compatible) as well as a new one generated from Eclipselink workbench by importing my old Toplink workbench project.
Note that I'm only doing a migration from Toplink to native Eclispelink. There is no JPA involved.
Any ideas on what`s wrong? It seems like it's trying to improperly using String instead of my actual class, but not sure.
Also, my app has never had a persistence.xml file. Do I need one now?
2017-02-20 14:55:52 ERROR - Presentation - Local Exception Stack:
Exception [EclipseLink-3002] (Eclipse Persistence Services - 2.6.4.v20160829-44060b6): org.eclipse.persistence.exceptions.ConversionException
Exception Description: The object [ca.ncams.wisor.refdata.AccessTandem], of class [class java.lang.String], from mapping [org.eclipse.persistence.oxm.mappings.XMLDirectMapping[javaClass-->class/text()]] with descriptor [XMLDescriptor(org.eclipse.persistence.descriptors.ClassDescriptor --> [DatabaseTable(class-mapping-descriptor)])], could not be converted to [class java.lang.Class].
Internal Exception: java.lang.ClassNotFoundException: ca.ncams.wisor.refdata.AccessTandem
at org.eclipse.persistence.exceptions.ConversionException.couldNotBeConvertedToClass(ConversionException.java:98)
at org.eclipse.persistence.internal.helper.ConversionManager.convertObjectToClass(ConversionManager.java:451)
at org.eclipse.persistence.internal.helper.ConversionManager.convertObject(ConversionManager.java:146)
at org.eclipse.persistence.internal.oxm.XMLConversionManager.convertObject(XMLConversionManager.java:197)
at org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform.convertObject(DatasourcePlatform.java:179)
at org.eclipse.persistence.oxm.mappings.XMLDirectMapping.getAttributeValue(XMLDirectMapping.java:301)
at org.eclipse.persistence.oxm.mappings.XMLDirectMapping.valueFromRow(XMLDirectMapping.java:364)
at org.eclipse.persistence.mappings.DatabaseMapping.readFromRowIntoObject(DatabaseMapping.java:1539)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder.java:462)
at org.eclipse.persistence.internal.oxm.XMLObjectBuilder.buildAttributesIntoObject(XMLObjectBuilder.java:378)
at org.eclipse.persistence.internal.oxm.XMLObjectBuilder.buildObject(XMLObjectBuilder.java:291)
at org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping.buildCompositeObject(XMLCompositeCollectionMapping.java:380)
at org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping.buildObjectFromNestedRow(XMLCompositeCollectionMapping.java:587)
at org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping.valueFromRow(XMLCompositeCollectionMapping.java:511)
at org.eclipse.persistence.mappings.DatabaseMapping.readFromRowIntoObject(DatabaseMapping.java:1539)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder.java:462)
at org.eclipse.persistence.internal.oxm.XMLObjectBuilder.buildAttributesIntoObject(XMLObjectBuilder.java:378)
at org.eclipse.persistence.internal.oxm.XMLObjectBuilder.buildObject(XMLObjectBuilder.java:291)
at org.eclipse.persistence.internal.oxm.record.DOMUnmarshaller.xmlToObject(DOMUnmarshaller.java:469)
at org.eclipse.persistence.internal.oxm.record.DOMUnmarshaller.unmarshal(DOMUnmarshaller.java:267)
at org.eclipse.persistence.internal.oxm.record.DOMUnmarshaller.unmarshal(DOMUnmarshaller.java:246)
at org.eclipse.persistence.internal.oxm.XMLUnmarshaller.unmarshal(XMLUnmarshaller.java:530)
at org.eclipse.persistence.sessions.factories.XMLProjectReader.readObjectPersistenceRuntimeFormat(XMLProjectReader.java:293)
at org.eclipse.persistence.sessions.factories.XMLProjectReader.read(XMLProjectReader.java:186)
at org.eclipse.persistence.sessions.factories.XMLProjectReader.read(XMLProjectReader.java:242)
at org.eclipse.persistence.sessions.factories.XMLProjectReader.read(XMLProjectReader.java:100)
at ca.ncams.wisor.persistence.toplink.PersistenceManager.initializeTopLink(PersistenceManager.java:491)
at ca.ncams.wisor.persistence.toplink.PersistenceManager.<init>(PersistenceManager.java:83)
at ca.ncams.wisor.persistence.toplink.PersistenceManager.getInstance(PersistenceManager.java:96)
at ca.ncams.wisor.persistence.toplink.AutoRollbackFilter.doFilter(AutoRollbackFilter.java:57)
at ca.ncams.wisor.filter.FilterChainImpl.doFilter(FilterChainImpl.java:124)
at ca.ncams.wisor.presentation.filters.CatchAllFilter.doFilter(CatchAllFilter.java:60)
at ca.ncams.wisor.filter.FilterChainImpl.doFilter(FilterChainImpl.java:124)
at ca.ncams.wisor.presentation.filters.NoCacheFilter.doFilter(NoCacheFilter.java:47)
at ca.ncams.wisor.filter.FilterChainImpl.doFilter(FilterChainImpl.java:124)
at ca.ncams.wisor.filter.FilterJspBase.service(FilterJspBase.java:111)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:286)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:260)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:137)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:350)
at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:489)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:376)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:247)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3679)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.__run(WebAppServletContext.java:3649)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:326)
at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197)
at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)
at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71)
at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2433)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2281)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2259)
at weblogic.servlet.internal.ServletRequestImpl.runInternal(ServletRequestImpl.java:1691)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1651)
at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:270)
at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:348)
at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:333)
at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:54)
at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:640)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:406)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:346)
Caused by: java.lang.ClassNotFoundException: ca.ncams.wisor.refdata.AccessTandem
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.eclipse.persistence.internal.helper.ConversionManager.convertObjectToClass(ConversionManager.java:448)
... 61 more
Here's what I ended up doing:
Add Eclipselink 2.6.4 dependency to pom (compile instead of provided)
Add to weblogic.xml:
<wls:container-descriptor>
<wls:prefer-application-packages>
<wls:package-name>org.eclipse.persistence</wls:package-name>
</wls:prefer-application-packages>
</wls:container-descriptor>
Now Eclipselink finds my classes and boots up.
Note that my code was only passing in the mapping file and not a classloader to XMLProjectReader.read(); so I guess was using the default classloader.
If anyone knows of how to pass in a classloader I'd still be curious to know (where do I get it from?).

Utility jar is not able to find its dependent jar files. War inside utility jar inside dependents jars

I am running into some issue, I have developed a utility web service client jar file which is build on springs. Reason behind build this jar its common jar for more than one project.
inside jar we have lib folder its has all its dependent jars. Its working able to load application context and able to do its job independently. Build it as Jar file using ant scripts and its MANIFEST.mf file look like this
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.3
Created-By: 1.6.0_45-b06 (Sun Microsystems Inc.)
Rsrc-Main-Class: ${main-class}
Rsrc-Class-Path: ./lib/com.ibm.jaxws.thinclient_8.0.0.jar lib/com.ibm.
ws.webservices.thinclient_8.0.0.jar lib/commons-logging-1.1.jar lib/j
axws-api.jar lib/junit-4.10.jar lib/log4j-1.2.9.jar lib/resolver.jar
lib/serializer.jar lib/spring-asm-3.1.0.RELEASE.jar lib/spring-beans-
3.1.0.RELEASE.jar lib/spring-context-3.1.0.RELEASE.jar lib/spring-cor
e-3.1.0.RELEASE.jar lib/spring-expression-3.1.0.RELEASE.jar lib/sprin
g-test-3.1.0.RELEASE.jar lib/xercesImpl.jar lib/xercesSamples.jar lib
/xml-apis.jar
Class-Path: ./ lib/com.ibm.jaxws.thinclient_8.0.0.jar lib/com.ibm.ws.w
ebservices.thinclient_8.0.0.jar lib/commons-logging-1.1.jar lib/jaxws
-api.jar lib/junit-4.10.jar lib/log4j-1.2.9.jar lib/resolver.jar lib/
serializer.jar lib/spring-asm-3.1.0.RELEASE.jar lib/spring-beans-3.1.
0.RELEASE.jar lib/spring-context-3.1.0.RELEASE.jar lib/spring-core-3.
1.0.RELEASE.jar lib/spring-expression-3.1.0.RELEASE.jar lib/spring-te
st-3.1.0.RELEASE.jar lib/xercesImpl.jar lib/xercesSamples.jar lib/xml
-apis.jar
Now Added that jar file in war file and deployed on web sphere server. Now I am getting
[10/12/16 14:48:01:422 EDT] 00001845 SystemOut XXXX - Add Document has been called
[10/12/16 14:48:01:425 EDT] 00001845 AxisEngine E org.apache.axis2.engine.AxisEngine receive null
org.apache.axis2.AxisFault
at org.apache.axis2.jaxws.server.dispatcher.JavaBeanDispatcher.createFaultResponse(JavaBeanDispatcher.java:407)
at org.apache.axis2.jaxws.server.dispatcher.JavaBeanDispatcher.invoke(JavaBeanDispatcher.java:138)
at org.apache.axis2.jaxws.server.EndpointController.invoke(EndpointController.java:111)
at org.apache.axis2.jaxws.server.JAXWSMessageReceiver.receive(JAXWSMessageReceiver.java:161)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:212)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
at com.ibm.ws.websvcs.transport.http.WASAxis2Servlet.doPost(WASAxis2Servlet.java:1632)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1232)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:781)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:480)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1114)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:940)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:463)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:530)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:316)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:88)
at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1820)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:816)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1881)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)
at java.lang.reflect.Method.invoke(Method.java:620)
at org.apache.axis2.jaxws.server.dispatcher.JavaDispatcher.invokeTargetOperation(JavaDispatcher.java:120)
at org.apache.axis2.jaxws.server.dispatcher.JavaBeanDispatcher.invoke(JavaBeanDispatcher.java:118)
... 29 more
Caused by: java.lang.NoClassDefFoundError: org.springframework.context.ApplicationContext
at com.nationwide.awd.documents.business.AddDocumentHelper.addDocument(Unknown Source)
at com.dstawd.custom.ws.CLT.addDocumentToFileNet(Unknown Source)
... 35 more
Caused by: java.lang.ClassNotFoundException: org.springframework.context.ApplicationContext
Basically its from application to utility jar call. Utility jar not able to find its dependents jar file in its lib
WAR file has utility Jar file in Web-int/lib/
utility jar has its dependents jar in utility/lib/
Please help me to fix this issue.
Thanks.

While compiling jsp WebLogic 12c throw error

weblogic.servlet.jsp.CompilationException: Failed to compile JSP /jspnew/loans/loanRepayment.jsp
loanRepayment.jsp:383:143: This attribute is not recognized.
branchBtnDisabled="" branchDescName="" branchDescValue="<%=branchDesc%>" branchDescCssClass = "FieldTextRO" branchTabIndex="<%=""+tabIndex++%>" branchDescReadonly="true" branchDescTabIndex="-1"
^------^
loanRepayment.jsp:386:122: This attribute is not recognized.
moduleDescName="" moduleDescValue="<%=moduleDesc%>" moduleDescCssClass = "FieldTextRO" moduleTabIndex="<%=""+tabIndex++%>" moduleDescReadonly="true" moduleDescTabIndex="-1"
^------^
loanRepayment.jsp:389:121: This attribute is not recognized.
schemeDescName="" schemeDescValue="<%=schemeDesc%>" schemeDescCssClass = "FieldTextRO" schemeTabIndex="<%=""+tabIndex++%>" schemeDescReadonly="true" schemeDescTabIndex="-1"
^------^
loanRepayment.jsp:392:133: This attribute is not recognized.
acctNoDescName="" acctNoDescValue="<%=custAcct.getNameLong()%>" acctNoDescCssClass = "FieldTextRO" acctNoTabIndex="<%=""+tabIndex++%>" acctNoDescReadonly="true" acctNoDescTabIndex="-1" noInputRequired="true"/>
^------^
at weblogic.servlet.jsp.JavelinxJSPStub.reportCompilationErrorIfNeccessary(JavelinxJSPStub.java:247)
at weblogic.servlet.jsp.JavelinxJSPStub.compilePage0(JavelinxJSPStub.java:183)
at weblogic.servlet.jsp.JavelinxJSPStub.access$000(JavelinxJSPStub.java:50)
at weblogic.servlet.jsp.JavelinxJSPStub$1.run(JavelinxJSPStub.java:111)
at java.security.AccessController.doPrivileged(Native Method)
at weblogic.servlet.jsp.JavelinxJSPStub.compilePage(JavelinxJSPStub.java:108)
at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:267)
at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:218)
at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:414)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:304)
at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:489)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:376)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
at dm.web.utils.SecurityCheck.doFilter(SecurityCheck.java:126)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:32)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3654)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3620)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:326)
at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:196)
at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)
at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71)
at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2423)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2280)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2258)
at weblogic.servlet.internal.ServletRequestImpl.runInternal(ServletRequestImpl.java:1626)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1586)
at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:270)
at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:348)
at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:333)
at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:54)
at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:617)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:397)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:346)
I found soln for this problem. In weblogic there is a setting for old jsp code. backward jsp compatibility have to select from weblogic console.
Here is menu path- Home >base_domain –> Under “Web Applications” Tab –> JSP Compiler Backwards Compatible it may solve ur problem.

Categories