1

Hi I have this project on netbeans a web project using xhtml and apache tomcat and when I run it, it opens my browser and says this:

    An Error Occurred:
Could not initialize class javax.crypto.JceSecurity

The last thing I remember doing that could've done something (because it worked fine before and I haven't touched it, was updating java (1.8.0_211), I've tried unisntalling netbeans and reinstalling and doing the same for java and the jdk. Also setting the enviromental variables for java_home and installing the default local_policy.jar and the US_export_policy.jar which I dlownaded on the website. All of these things were found in my search of a fix for this but so far no luck.

My code works fine in other pcs and i haven't touched it but now it's giving that error.

Full stacktrace:

java.lang.NoClassDefFoundError: Could not initialize class javax.crypto.JceSecurity
at javax.crypto.KeyGenerator.nextSpi(KeyGenerator.java:340)
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:200)
at com.sun.faces.util.ByteArrayGuardAESCTR.<init>(ByteArrayGuardAESCTR.java:97)
at com.sun.faces.context.flash.ELFlash.<init>(ELFlash.java:268)
at com.sun.faces.context.flash.ELFlash.getFlash(ELFlash.java:306)
at com.sun.faces.context.flash.FlashFactoryImpl.getFlash(FlashFactoryImpl.java:56)
at com.sun.faces.context.ExternalContextImpl.getFlash(ExternalContextImpl.java:1106)
at javax.faces.context.ExternalContextWrapper.getFlash(ExternalContextWrapper.java:991)
at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:214)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99)
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:121)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:836)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1839)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)

1 Answers1

0

From the javadoc of class NoClassDefFoundError

The searched-for class definition existed when the currently executing class was compiled, but the definition can no longer be found.

Most IDEs have a build configuration and a run configuration.
Perhaps the build configuration includes the JAR containing class javax.crypto.JceSecurity but the run configuration does not.

Abra
  • 19,142
  • 7
  • 29
  • 41