Migration from Weblogic server 12.2 to Payara server 5

I am new to Payara and trying to migrate my application which is deployed in weblogic server 12.2 with Java 7 to Payara 5. We could notice that since payara uses the latest java version, its not supporting Java.util.Date. What are the basic changes or issues that arises when we migrate to payara from weblogic server.

Hi,

can you clarify whet you mean with

Do you have a problem using JPA or JAX-RS and can you indicate the error you see?

Regards
Rudy

I successfully migrated from Weblogic 12./14.1. I am currently using Java8 and the application itself runs on JavaEE 8.0.1.
Everything runs great except that the EntityManager (OracleDB, EclipseLink) is closed very often. Payara seems to have a bug there.
We test this first to see if this database / entity manager problem has no problems in the productive environment.

WebLogic itself also has a Glassfish in the background and one of the most stable database connections ever. Nothing in the background ever broke away.
Since the WebLogic is not really maintained and the support for it is underground, we decided on Payara. Possibly also the Enterprise version, but first check whether Payara is really stable. Entitymanager Closed Exception starts with me but panic attacks. :slight_smile:

Hello Steven,
Can you send us the exception you are facing? In what situation this happens – randomly, under heavy load, after redeploy?
For beginning, it is possible to modify behavior of the pool, size, time to release connections etc.
Closed connection to the database makes me very nervouse as well :slight_smile:
Petr

hey Petr,

i use oracle db with ojdbc8 (Implements JDBC 4.2 spec and certified with JDK8 and JDK11) driver.

As soon as I define “Statement Cache Size: > 0” I have guaranteed exceptions with the EntityManager closed.

With “Statement Cache Size: = 0” I only have random closed EntityManagers under high load, but they are recreated when the database query is called again. Would be good if they stayed open all the time. :slight_smile:

Do I have to tick “Required” under “Connection Validation”? Somehow you have to manage that the connections don’t break away.

I just don’t see the reason why this is happening.

After a deploy I have no problems. Behavior is always the same, regardless of whether the server is restarted or redeployed.

Example:

                valueMap.put(AboMappingType.POOL, pool);
                aboEntityMappingTypeList.add(AboMappingType.POOL);

                    Query countQuery = dataAccessObjectService.getEntityManager(
                                    DataAccessObjectService.PersistenceUnitType.DEFAULT_ENTITY)
                            .createNativeQuery("SELECT COUNT(*) FROM (" + queryString[0] + ")");
                    aboEntityMappingTypeList.forEach(type -> countQuery.setParameter(type.name(), valueMap.get(type)));
                    BigDecimal singleResult = (BigDecimal) countQuery
                            .setHint(QueryHints.ALLOW_NATIVE_SQL_QUERY, HintValues.TRUE)
                            .setHint(QueryHints.CACHE_STATMENT, HintValues.TRUE)
                            .setHint(QueryHints.QUERY_RESULTS_CACHE, HintValues.TRUE)
                            .getSingleResult();
                    int count = singleResult.intValue();

@Stateless
public class DataAccessObjectServiceImpl implements DataAccessObjectService {

    @PersistenceContext(unitName = "hussodbPU")
    private EntityManager entityManager;
...

Exception:

java.lang.IllegalStateException: Attempting to execute an operation on a closed EntityManager.
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.verifyOpen(EntityManagerImpl.java:2067) ~[org.eclipse.persistence.jpa.jar:?]
	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.setParameter(EJBQueryImpl.java:608) ~[org.eclipse.persistence.jpa.jar:?]
	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.setParameter(EJBQueryImpl.java:1) ~[org.eclipse.persistence.jpa.jar:?]
	at com.sun.enterprise.container.common.impl.QueryWrapper.setParameter(QueryWrapper.java:284) ~[container-common.jar:?]
	at de.huss.component.abonnement.AboAdministrationImpl$1.lambda$getAboEntityLazyDataModel$2(AboAdministrationImpl.java:143) ~[business-persistence-impl-1.1-SNAPSHOT.jar:?]
	at java.lang.Iterable.forEach(Iterable.java:75) ~[?:1.8.0_331]
	at de.huss.component.abonnement.AboAdministrationImpl$1.getAboEntityLazyDataModel(AboAdministrationImpl.java:143) ~[business-persistence-impl-1.1-SNAPSHOT.jar:?]
	at de.huss.abo.application.controller.AboAdministrationControllerImpl.getLazyAboEntityList(AboAdministrationControllerImpl.java:428) ~[hussmediareloaded-abomodul-1.1-SNAPSHOT.jar:?]
	at de.huss.abo.application.controller.AboAdministrationControllerImpl$Proxy$_$$_WeldSubclass.getLazyAboEntityList$$super(Unknown Source) ~[hussmediareloaded-abomodul-1.1-SNAPSHOT.jar:?]
	at sun.reflect.GeneratedMethodAccessor2293.invoke(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_331]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_331]
	at org.jboss.weld.interceptor.proxy.TerminalAroundInvokeInvocationContext.proceedInternal(TerminalAroundInvokeInvocationContext.java:51) ~[weld-osgi-bundle.jar:?]
	at org.jboss.weld.interceptor.proxy.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:78) ~[weld-osgi-bundle.jar:?]
	at de.huss.commons.aspect.cache.SessionCacheAspect.lambda$action$2(SessionCacheAspect.java:54) ~[commons-1.1-SNAPSHOT.jar:?]
	at java.util.concurrent.ConcurrentSkipListMap.computeIfAbsent(ConcurrentSkipListMap.java:1699) [?:1.8.0_331]
	at de.huss.commons.aspect.cache.SessionCacheAspect.action(SessionCacheAspect.java:52) [commons-1.1-SNAPSHOT.jar:?]
	at sun.reflect.GeneratedMethodAccessor534.invoke(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_331]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_331]
	at org.jboss.weld.interceptor.reader.SimpleInterceptorInvocation$SimpleMethodInvocation.invoke(SimpleInterceptorInvocation.java:73) [weld-osgi-bundle.jar:?]
	at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.executeAroundInvoke(InterceptorMethodHandler.java:84) [weld-osgi-bundle.jar:?]
	at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.executeInterception(InterceptorMethodHandler.java:72) [weld-osgi-bundle.jar:?]
	at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.invoke(InterceptorMethodHandler.java:56) [weld-osgi-bundle.jar:?]
	at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:79) [weld-osgi-bundle.jar:?]
	at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:68) [weld-osgi-bundle.jar:?]
	at de.huss.abo.application.controller.AboAdministrationControllerImpl$Proxy$_$$_WeldSubclass.getLazyAboEntityList(Unknown Source) [hussmediareloaded-abomodul-1.1-SNAPSHOT.jar:?]
	at sun.reflect.GeneratedMethodAccessor1888.invoke(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_331]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_331]
	at javax.el.BeanELResolver.getValue(BeanELResolver.java:299) [jakarta.el.jar:3.0.3.payara-p5]
	at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:156) [jakarta.faces.jar:2.3.14.payara-p3]
	at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:184) [jakarta.faces.jar:2.3.14.payara-p3]
	at com.sun.el.parser.AstValue.getValue(AstValue.java:114) [jakarta.el.jar:3.0.3.payara-p5]
	at com.sun.el.parser.AstValue.getValue(AstValue.java:177) [jakarta.el.jar:3.0.3.payara-p5]
	at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184) [jakarta.el.jar:3.0.3.payara-p5]
	at org.jboss.weld.module.web.el.WeldValueExpression.getValue(WeldValueExpression.java:50) [weld-osgi-bundle.jar:?]
	at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:73) [jakarta.faces.jar:2.3.14.payara-p3]
	at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:170) [jakarta.faces.jar:2.3.14.payara-p3]
	at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:157) [jakarta.faces.jar:2.3.14.payara-p3]
	at javax.faces.component.UIData.getValue(UIData.java:736) [jakarta.faces.jar:2.3.14.payara-p3]
	at org.primefaces.component.api.UIData.getDataModel(UIData.java:839) [primefaces-8.0.18.jar:8.0.18]
	at org.primefaces.component.api.UIData.setRowModel(UIData.java:634) [primefaces-8.0.18.jar:8.0.18]
	at org.primefaces.component.api.UIData.setRowIndexWithoutRowStatePreserved(UIData.java:627) [primefaces-8.0.18.jar:8.0.18]
	at org.primefaces.component.api.UIData.setRowIndex(UIData.java:687) [primefaces-8.0.18.jar:8.0.18]
	at org.primefaces.component.api.UIData.visitTree(UIData.java:914) [primefaces-8.0.18.jar:8.0.18]
	at javax.faces.component.UIComponent.visitTree(UIComponent.java:1468) [jakarta.faces.jar:2.3.14.payara-p3]
	at javax.faces.component.UIComponent.visitTree(UIComponent.java:1468) [jakarta.faces.jar:2.3.14.payara-p3]
	at javax.faces.component.UIComponent.visitTree(UIComponent.java:1468) [jakarta.faces.jar:2.3.14.payara-p3]
	at javax.faces.component.UIComponent.visitTree(UIComponent.java:1468) [jakarta.faces.jar:2.3.14.payara-p3]
	at javax.faces.component.UINamingContainer.visitTree(UINamingContainer.java:150) [jakarta.faces.jar:2.3.14.payara-p3]
	at javax.faces.component.UIComponent.visitTree(UIComponent.java:1468) [jakarta.faces.jar:2.3.14.payara-p3]
	at javax.faces.component.UIForm.visitTree(UIForm.java:355) [jakarta.faces.jar:2.3.14.payara-p3]
	at javax.faces.component.UIComponent.visitTree(UIComponent.java:1468) [jakarta.faces.jar:2.3.14.payara-p3]
	at javax.faces.component.UIComponent.visitTree(UIComponent.java:1468) [jakarta.faces.jar:2.3.14.payara-p3]
	at javax.faces.component.UIComponent.visitTree(UIComponent.java:1468) [jakarta.faces.jar:2.3.14.payara-p3]
	at javax.faces.component.UIComponent.visitTree(UIComponent.java:1468) [jakarta.faces.jar:2.3.14.payara-p3]
	at javax.faces.component.UINamingContainer.visitTree(UINamingContainer.java:150) [jakarta.faces.jar:2.3.14.payara-p3]
	at javax.faces.component.UIComponent.visitTree(UIComponent.java:1468) [jakarta.faces.jar:2.3.14.payara-p3]
	at javax.faces.component.UIComponent.visitTree(UIComponent.java:1468) [jakarta.faces.jar:2.3.14.payara-p3]
	at javax.faces.component.UIComponent.visitTree(UIComponent.java:1468) [jakarta.faces.jar:2.3.14.payara-p3]
	at javax.faces.component.UIComponent.visitTree(UIComponent.java:1468) [jakarta.faces.jar:2.3.14.payara-p3]
	at javax.faces.component.UIComponent.visitTree(UIComponent.java:1468) [jakarta.faces.jar:2.3.14.payara-p3]
	at javax.faces.component.UIComponent.visitTree(UIComponent.java:1468) [jakarta.faces.jar:2.3.14.payara-p3]
	at org.omnifaces.eventlistener.ResetInputAjaxActionListener.processAction(ResetInputAjaxActionListener.java:194) [omnifaces-2.7.18.jar:2.7.18]
	at javax.faces.component.UICommand.broadcast(UICommand.java:222) [jakarta.faces.jar:2.3.14.payara-p3]
	at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:847) [jakarta.faces.jar:2.3.14.payara-p3]
	at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1396) [jakarta.faces.jar:2.3.14.payara-p3]
	at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:58) [jakarta.faces.jar:2.3.14.payara-p3]
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:76) [jakarta.faces.jar:2.3.14.payara-p3]
	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:177) [jakarta.faces.jar:2.3.14.payara-p3]
	at javax.faces.webapp.FacesServlet.executeLifecyle(FacesServlet.java:707) [jakarta.faces.jar:2.3.14.payara-p3]
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:451) [jakarta.faces.jar:2.3.14.payara-p3]
	at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1637) [web-core.jar:?]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:331) [web-core.jar:?]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:211) [web-core.jar:?]
	at de.huss.merlin.filter.MDCFilter.doFilter(MDCFilter.java:38) [MDCFilter.class:?]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:253) [web-core.jar:?]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:211) [web-core.jar:?]
	at org.omnifaces.filter.GzipResponseFilter.doFilter(GzipResponseFilter.java:181) [omnifaces-2.7.18.jar:2.7.18]
	at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:108) [omnifaces-2.7.18.jar:2.7.18]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:253) [web-core.jar:?]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:211) [web-core.jar:?]
	at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:81) [primefaces-8.0.18.jar:8.0.18]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:253) [web-core.jar:?]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:211) [web-core.jar:?]
	at org.glassfish.tyrus.servlet.TyrusServletFilter.doFilter(TyrusServletFilter.java:282) [tyrus-container-servlet.jar:?]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:253) [web-core.jar:?]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:211) [web-core.jar:?]
	at org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71) [log4j-web-2.17.0.jar:2.17.0]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:253) [web-core.jar:?]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:211) [web-core.jar:?]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257) [web-core.jar:?]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160) [web-core.jar:?]
	at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:757) [web-core.jar:?]
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:577) [web-core.jar:?]
	at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99) [web-glue.jar:?]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:158) [web-core.jar:?]
	at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:371) [web-core.jar:?]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:238) [web-core.jar:?]
	at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:520) [kernel.jar:?]
	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:217) [kernel.jar:?]
	at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:182) [nucleus-grizzly-all.jar:?]
	at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:156) [nucleus-grizzly-all.jar:?]
	at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:218) [nucleus-grizzly-all.jar:?]
	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:95) [nucleus-grizzly-all.jar:?]
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:260) [nucleus-grizzly-all.jar:?]
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:177) [nucleus-grizzly-all.jar:?]
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:109) [nucleus-grizzly-all.jar:?]
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:88) [nucleus-grizzly-all.jar:?]
	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:53) [nucleus-grizzly-all.jar:?]
	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:524) [nucleus-grizzly-all.jar:?]
	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:89) [nucleus-grizzly-all.jar:?]
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:94) [nucleus-grizzly-all.jar:?]
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:33) [nucleus-grizzly-all.jar:?]
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:114) [nucleus-grizzly-all.jar:?]
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:569) [nucleus-grizzly-all.jar:?]
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:549) [nucleus-grizzly-all.jar:?]
	at java.lang.Thread.run(Thread.java:750) [?:1.8.0_331]

Is there a trick to leaving the entity manager open?

Stven

Hi Steven,
I plan to look at it in the next two weeks. Thank you for the code, it’s much simpler.
A question - AboAdministrationImpl and AboAdministrationControllerImpl are EJBs, right? I suppose Stateless beans.
Petr

1 Like

Hey Petr,

AboAdministrationControllerImpl (CDI)

...
import javax.enterprise.context.SessionScoped;
...

@Named("aboAdministrationController")
@SessionScoped
public class AboAdministrationControllerImpl extends BusinessObjectEditorControllerAbstract<AboPresentation, ToolDescription, AboPresentationAdministration, ResultCommand> implements AboAdministrationController, BusinessFilter<AboFilter<AboFilterDescription>> {

    @Inject
    private AboAdministration<AboEntity> aboAdministration;

    ...

and AboAdministrationImpl (for data management)

@Stateless
public class AboAdministrationImpl extends CommonEntityAdministrationAbstract<AboEntity>
        implements AboAdministration<AboEntity> {
    
    ...

more classes for a little deeper insight

public abstract class CommonEntityAdministrationAbstract<E> implements CommonEntityAdministration<E> {

    @Inject
    protected DataAccessObjectService dataAccessObjectService;

    ...
@Stateless
public class DataAccessObjectServiceImpl implements DataAccessObjectService {

    @PersistenceContext(unitName = "hussodbPU")
    private EntityManager entityManager;

    ....

Many greetings
Steven