Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

REST WS service

managed BEANJun 15 2018 — edited Jun 20 2018

Hello,

I have developed an app that exposes rest methods.

One of them is to return an image:

@GET

@Path("/image")

@Produces({ "image/png", "image/jpg" })

public Response getImage(@QueryParam("pProperty") String pProperty,

                     @QueryParam("pWorkstationky") Integer pWorkstationky,

                     @QueryParam("pSourceId")      String  pSourceId,

                     @QueryParam("pMemoTyp")       Integer pMemoTyp,

                     @QueryParam("pImageRECCDate") String  pImageRECCDate) {

AppModuleImpl am = null;

        am = AMConfiguration.getAppModuleImpl(METHOD\_NAME, /\*pSessionId\*/"PreSession");

                     (...)

                                                 byte\[\] imageByte =

                        am.getImageByteArray(sessionId, pSourceId, pMemoTyp);

                    /\* DEFINIR RESULTADO COM\*/

                    if (imageByte != null && imageByte != new byte\[0\]) {

                        result = Response.ok(new ByteArrayInputStream(imageByte)).build();

                    } else {

                        result = null;

                    }

                    (...)

                     } finally {

                                if (null != am) {

        AMConfiguration.releaseAMContext();

    } else {

        AMConfiguration.resetADFContext();

    }

}

return result;

}

The am functions (release, reset, getAppMod) are in a class:

public class AMConfiguration {

private static final String filesAMParametersDef = "model.am.AppModuleImpl";

private static final String filesAMconfig = "AppModuleLocal";

private static ADFContext currentADFContext = null;

private static ApplicationModule am = null;

public AMConfiguration() {

    super();

}

public static AppModuleImpl getAppModuleImpl(String pContext, String pSessionId) {    

    currentADFContext = ADFContext.initADFContext(pContext, pSessionId, null, null);

    am = Configuration.createRootApplicationModule(filesAMParametersDef, filesAMconfig);

    return (AppModuleImpl) am;

}

public static void releaseAMContext() {

    Configuration.releaseRootApplicationModule(am, false);

    ADFContext.resetADFContext(currentADFContext); 

}    

public static void resetADFContext() {

    ADFContext.resetADFContext(currentADFContext);

}

}

The above is needed because of context leaks errors that appeared in console log.

My bc4j is :

<?xml version="1.0" encoding="UTF-8" ?>

<!---->

<BC4JConfig xmlns="http://xmlns.oracle.com/bc4j/configuration" version="11.1">

<AppModuleConfigBag ApplicationName="model.am.AppModule">

\<AppModuleConfig name="AppModuleLocal" jbo.project="model.Model"

                 ApplicationName="model.am.AppModule" DeployPlatform="LOCAL"

                 java.naming.factory.initial="oracle.jbo.common.JboInitialContextFactory">

  \<AM-Pooling jbo.ampool.sessioncookiefactoryclass="ng.shared.libws.dynamicdatasource.CustomHttpSessionCookieFactory"

                    jbo.doconnectionpooling="true"/>

        \<Database jbo.TypeMapEntries="OracleApps" JDBCDataSource="jdbc/conceptNG" jbo.locking.mode="optimistic"/>

        \<Security AppModuleJndiName="model.am.AppModule"/>

\</AppModuleConfig>

\<AppModuleConfig name="AppModuleShared" jbo.project="model.Model"

                 ApplicationName="model.am.AppModule" DeployPlatform="LOCAL">

  \<AM-Pooling jbo.ampool.maxpoolsize="1" jbo.ampool.isuseexclusive="false"/>

        \<Database jbo.TypeMapEntries="OracleApps" JDBCDataSource="jdbc/conceptNG"/>

        \<Security AppModuleJndiName="model.am.AppModule"/>

\</AppModuleConfig>

</AppModuleConfigBag>

</BC4JConfig>

In jsff page i have 'n' images calling this ws directly in source :

                        \<af:image source="#{viewScope.reportParametersBean.reportImageUrl}"

                                  id="imagePreview" inlineStyle="width: 500px; height: 750px;"/>

the bean is returning (each image has different inputParameters) e.g.: https://nextgen-wlui12c.conceptsoftware.eu:9075/NGFilesWS/resources/files/image?pWorkstationky=553&pProperty=ractest3&pMemoTyp=110&pSourceId=44062-074-0000000032

When i test with postman or paste the above in browser i get the image correctly.

Problem is in jsff most of times (e.g. 98%) i get no images at all.

checking the console log i have errors in release AM:

]] Root cause of ServletException.

oracle.jbo.common.ampool.ApplicationPoolException: JBO-29114 ADFContext is not setup to process messages for this exception. Use the exception stack trace and error code to investigate the root cause of this exception. Root cause error code is JBO-30014. Error message parameters are {0=64e4c07f-9621-4703-b7b6-d03d034e566f, 1=64e4c07f-9621-4703-b7b6-d03d034e566f, 2=model.am.AppModuleLocal}

at oracle.jbo.common.ampool.ApplicationPoolImpl.removeSessionCookie(ApplicationPoolImpl.java:831)

at oracle.jbo.client.Configuration.releaseRootApplicationModule(Configuration.java:1331)

at webservice.amconfigs.AMConfiguration.releaseAMContext(AMConfiguration.java:30)

at webservice.ImagesWS.getImage(ImagesWS.java:189)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)

at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)

at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)

at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160)

at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)

at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)

at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)

at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)

at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326)

at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)

at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)

at org.glassfish.jersey.internal.Errors.process(Errors.java:315)

at org.glassfish.jersey.internal.Errors.process(Errors.java:297)

at org.glassfish.jersey.internal.Errors.process(Errors.java:267)

at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)

at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)

at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)

at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:471)

at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:425)

at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:383)

at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:336)

at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:223)

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 oracle.adf.share.http.ServletADFFilter.doFilter(ServletADFFilter.java:77)

at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)

at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:141)

at java.security.AccessController.doPrivileged(Native Method)

at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)

at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:650)

at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:124)

at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:232)

at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:94)

at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)

at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:248)

at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)

at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3683)

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)

SUPP_ATTRS = {severity-value=8, rid=0, partition-id=0, partition-name=DOMAIN} SERVER = DefaultServer TIMESTAMP = 1529059922825 USERID = <WLS Kernel> MACHINE = ccarvalho-jdev122.conceptsoftware.eu MSGID = BEA-101017 DATE = 15-Jun-2018, 11:52:02,825 AM WEST SUBSYSTEM = HTTP CONTEXTID = 4d5ffd23-96a3-45da-b73d-5748dbf4070d-00000a70 TXID = SEVERITY = Error THREAD = [ACTIVE] ExecuteThread: '41' for queue: 'weblogic.kernel.Default (self-tuning)'

WatchAlarmType: AutomaticReset

WatchAlarmResetPeriod: 30000

because this is about the am, i found a link (https://tompeez.wordpress.com/2011/07/08/jdev-always-test-your-app-with-applicationmodule-pooling-turned-off/ ) from @"Timo Hahn" to test disabling the pooling.

results of console log:

]] Root cause of ServletException.

oracle.jbo.JboException: JBO-29114 ADFContext is not setup to process messages for this exception. Use the exception stack trace and error code to investigate the root cause of this exception. Root cause error code is JBO-33025. Error message parameters are {0=AppModule}

at oracle.jbo.client.Configuration.releaseRootApplicationModule(Configuration.java:1337)

at webservice.amconfigs.AMConfiguration.releaseAMContext(AMConfiguration.java:30)

at webservice.ImagesWS.getImage(ImagesWS.java:189)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

Truncated. see log file for complete stacktrace

>

Redefined all recompiled classes that are loaded in the debuggee process.

<oracle.adf.common> <ADFConfigFactory> <findOrCreateADFConfig> <Resource META-INF/adf-config.xml not found on the classpath.>

<oracle.adf.common> <ADFConfigFactory> <findOrCreateADFConfig> <A default implementation of ADFConfig is being created for application. This can lead to unexpected results in some cases. Please add a basic META-INF/adf-config.xml to your classpath to avoid functional errors.>

]] Root cause of ServletException.

oracle.jbo.common.ampool.ApplicationPoolException: JBO-29114 ADFContext is not setup to process messages for this exception. Use the exception stack trace and error code to investigate the root cause of this exception. Root cause error code is JBO-30014. Error message parameters are {0=72eec6ac-9a07-45b1-8ae2-3733075b6b34, 1=72eec6ac-9a07-45b1-8ae2-3733075b6b34, 2=model.am.AppModuleLocal}

at oracle.jbo.common.ampool.ApplicationPoolImpl.removeSessionCookie(ApplicationPoolImpl.java:831)

at oracle.jbo.client.Configuration.releaseRootApplicationModule(Configuration.java:1331)

at webservice.amconfigs.AMConfiguration.releaseAMContext(AMConfiguration.java:30)

at webservice.ImagesWS.getImage(ImagesWS.java:189)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

Truncated. see log file for complete stacktrace

and both leave the datasource of weblogic with active connections:

pastedImage_7.png

The only way i found to make images work correct is to decrease the maximum capacity of connection pool configurations in weblogic console for the datasource to 1.

But that is not the fix i need.

Can someone suggest please?

Thanks and regards,

Carlos

Jdev 12.2.1.2

This post has been answered by Timo Hahn on Jun 15 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 18 2018
Added on Jun 15 2018
9 comments
271 views