2

I have been trying to solve my problem for a while now and couldn't find a solution yet. I have migrated from Eclipse to Intellij IDEA a couple months ago and have been developing JSF/CDI web apps on Glassfish 5. Now, I had to reinstall my whole system lately and whenever I try to deploy my web apps I get the following error:

exception
javax.servlet.ServletException: sun/security/provider/SunEntries

root cause
java.lang.IllegalAccessError: sun/security/provider/SunEntries

The glassfish log shows the following:

java.lang.IllegalAccessError: tried to access class sun.security.provider.SunEntries from class com.sun.crypto.provider.SunJCE
    at com.sun.crypto.provider.SunJCE.putEntries(SunJCE.java:128)
    at com.sun.crypto.provider.SunJCE.<init>(SunJCE.java:111)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.lang.Class.newInstance(Class.java:442)
    at sun.security.jca.ProviderConfig$2.run(ProviderConfig.java:221)
    at sun.security.jca.ProviderConfig$2.run(ProviderConfig.java:206)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.security.jca.ProviderConfig.doLoadProvider(ProviderConfig.java:206)
    at sun.security.jca.ProviderConfig.getProvider(ProviderConfig.java:187)
    at sun.security.jca.ProviderList.getProvider(ProviderList.java:233)
    at sun.security.jca.ProviderList$ServiceList.tryGet(ProviderList.java:434)
    at sun.security.jca.ProviderList$ServiceList.access$200(ProviderList.java:376)
    at sun.security.jca.ProviderList$ServiceList$1.hasNext(ProviderList.java:486)
    at javax.crypto.KeyGenerator.nextSpi(KeyGenerator.java:338)
    at javax.crypto.KeyGenerator.<init>(KeyGenerator.java:168)
    at javax.crypto.KeyGenerator.getInstance(KeyGenerator.java:223)
    at com.sun.faces.util.ByteArrayGuardAESCTR.setupKeyAndCharset(ByteArrayGuardAESCTR.java:192)
    at com.sun.faces.util.ByteArrayGuardAESCTR.<init>(ByteArrayGuardAESCTR.java:97)
    at com.sun.faces.context.flash.ELFlash.<init>(ELFlash.java:272)
    at com.sun.faces.context.flash.ELFlash.getFlash(ELFlash.java:310)
    at com.sun.faces.context.flash.FlashFactoryImpl.getFlash(FlashFactoryImpl.java:60)
    at com.sun.faces.context.ExternalContextImpl.getFlash(ExternalContextImpl.java:1266)
    at javax.faces.context.ExternalContextWrapper.getFlash(ExternalContextWrapper.java:1034)
    at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:213)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:98)
    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:133)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:201)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:670)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1580)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:258)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:652)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:591)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:371)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:238)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:463)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:168)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:242)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:539)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:593)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:573)
    at java.lang.Thread.run(Thread.java:748)
]]

java.lang.IllegalAccessError: sun/security/provider/SunEntries
    at com.sun.crypto.provider.SunJCE.putEntries(SunJCE.java:128)
    at com.sun.crypto.provider.SunJCE.<init>(SunJCE.java:111)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.lang.Class.newInstance(Class.java:442)
    at sun.security.jca.ProviderConfig$2.run(ProviderConfig.java:221)
    at sun.security.jca.ProviderConfig$2.run(ProviderConfig.java:206)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.security.jca.ProviderConfig.doLoadProvider(ProviderConfig.java:206)
    at sun.security.jca.ProviderConfig.getProvider(ProviderConfig.java:187)
    at sun.security.jca.ProviderList.getProvider(ProviderList.java:233)
    at sun.security.jca.ProviderList$ServiceList.tryGet(ProviderList.java:434)
    at sun.security.jca.ProviderList$ServiceList.access$200(ProviderList.java:376)
    at sun.security.jca.ProviderList$ServiceList$1.hasNext(ProviderList.java:486)
    at javax.crypto.KeyGenerator.nextSpi(KeyGenerator.java:338)
    at javax.crypto.KeyGenerator.<init>(KeyGenerator.java:168)
    at javax.crypto.KeyGenerator.getInstance(KeyGenerator.java:223)
    at com.sun.faces.util.ByteArrayGuardAESCTR.setupKeyAndCharset(ByteArrayGuardAESCTR.java:192)
    at com.sun.faces.util.ByteArrayGuardAESCTR.<init>(ByteArrayGuardAESCTR.java:97)
    at com.sun.faces.context.flash.ELFlash.<init>(ELFlash.java:272)
    at com.sun.faces.context.flash.ELFlash.getFlash(ELFlash.java:310)
    at com.sun.faces.context.flash.FlashFactoryImpl.getFlash(FlashFactoryImpl.java:60)
    at com.sun.faces.context.ExternalContextImpl.getFlash(ExternalContextImpl.java:1266)
    at javax.faces.context.ExternalContextWrapper.getFlash(ExternalContextWrapper.java:1034)
    at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:213)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:98)
    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:133)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:201)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:670)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1580)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:258)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:652)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:591)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:371)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:238)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:463)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:168)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:242)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:539)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:593)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:573)
    at java.lang.Thread.run(Thread.java:748)
]]

The projects worked fine before and still do on Eclipse right now, on the same machine and the same glassfish server.

Could anybody enlighten me as to the cause of this error so I know at least how to start fixing it? I am using JDK 1.8 202 as a requirement if that helps.

Thanks in advance.

  • 1
    Are you sure the same JDK is used when the server is started in Eclipse and in IntelliJ IDEA? – CrazyCoder Aug 07 '20 at 17:37
  • I checked the project's JDK in both Eclipse and IntelliJ IDEA and made sure it was set to the same. Now as far as the server configuration is concerned I can set the JRE (not sure about the JDK as it didn't appear in the UI) and both are pointing to the same version. – Jawad Lotfi Aug 07 '20 at 19:47
  • please provide your code on github if possible or a minimal working sample here. it seems to be a problem of the jar versions you use. have you tried using java 1.7 or 1.6? also tried glassfish 4? – hce Aug 08 '20 at 12:32
  • I got rid of all concurrent JDKs and JREs on my machine, and now it works. It is very surprising how only one IDE was using the right project/server configuration. I hope this is just an isolated case and will not happen once development is over. Thanks again! – Jawad Lotfi Aug 08 '20 at 16:41

0 Answers0