We have spring mvc application in which we implemented JWT authentication. It is working fine in local environment but getting below error after deploying as a war file in linux server. Facing this issue for few API calls only some APIs are working fine with out any error.
I have checked policy jars already available
/jre/lib/security/policy/unlimited/US_export_policy.jar
/jre/lib/security/policy/unlimited/local_policy.jar
/jre/lib/security/policy/limited/US_export_policy.jar
/jre/lib/security/policy/limited/local_policy.jar
500 Internal Server Error: Root Cause
java.lang.NoClassDefFoundError: Could not initialize class javax.crypto.JceSecurity
javax.crypto.Mac.getInstance(Mac.java:176)
io.jsonwebtoken.impl.crypto.MacSigner.doGetMacInstance(MacSigner.java:64)
io.jsonwebtoken.impl.crypto.MacSigner.getMacInstance(MacSigner.java:53)
io.jsonwebtoken.impl.crypto.MacSigner.sign(MacSigner.java:47)
io.jsonwebtoken.impl.crypto.MacValidator.isValid(MacValidator.java:33)
io.jsonwebtoken.impl.crypto.DefaultJwtSignatureValidator.isValid(DefaultJwtSignatureValidator.java:61)
io.jsonwebtoken.impl.DefaultJwtParser.parse(DefaultJwtParser.java:408)
io.jsonwebtoken.impl.DefaultJwtParser.parse(DefaultJwtParser.java:541)
io.jsonwebtoken.impl.DefaultJwtParser.parseClaimsJws(DefaultJwtParser.java:601)
io.jsonwebtoken.impl.ImmutableJwtParser.parseClaimsJws(ImmutableJwtParser.java:173)
com.gsshop.api.jwt.JWTManager.validateJwtToken(JWTManager.java:66)
Related
I am new to java servlets. I have installed apache-tomcat-9.0.0.M21.
When I run the project containing servlet in eclipse browser, sometimes I get the error-
Error resolving 'localhost': Name or service not known.
Other times the error is -
Error resolving 'localhost' : Temporary failure in name resolution.
This project runs fine in my web browser.
Also, after I add <servlet>...</servlet> and <servlet-mapping>...<servlet-mapping> in web.xml, I get the error - Server Tomcat v9.0 Server at localhost failed to start.
One more thing, I use Ubuntu operating system (if it has to do something with the question).
Please help. I googled for the solution but I am not able to resolve the error.
Try adding the below to your /etc/hosts file.
127.0.0.1 localhost
I have my application as .war file and I want to run it in my tomcat server but it is giving me error when I try to start my application after deploy or uploading war file on server. it gives error as:
FAIL - Application at context path /jauction could not be started
FAIL - Encountered exception org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/jauction]]
while as other applications are running smoothly.
As pointed out by #Jens, you should look at logs/catalina.out to see more details about what's wrong.
You might also want to check WEB-INF/web.xml and verify the servlet mapping.
due to some company requirement I have enable the asadmin> create-service and set the GlassFish Server as a windows service while setting it to Start in a Automatic way. I am using Netbean 8.0.
However after I enable the Glassfish server service in auto method and when I try to deploy a Try sample project (Java Web) in Netbeans, after I RUN the project I got the following error in the Internet explorer.
HTTP Status 500 - Internal Server Error
Exception report
Internal Server Error
The server encountered an internal error that prevented it from fulfilling this request.
org.apache.jasper.JasperException: PWC6345: There is an error in invoking javac. A full JDK (not just JRE) is required
The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 4.0 logs.
However when I remove the Glassfish server from windows service list and when I run the project back, then it successful.
since I have no idea on java and all, can kindly help me to find the root cause of this or what is the workaround?
Thanks
Hasitha
We are seeing the following errors being thrown while deploying a new application version on to our elasticbeanstalk environment(Tomcat 7 , Java 6).
The eb-version-deployment.log on a running backend EC2 instance shows this:
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>ExpiredToken</Code><Message>The provided token has expired.</Message>
Exception in downloading source bundle. Exception message: S3ResponseError: 400 Bad Request
The elasticbeanstalk event log on the console shows this:
[Instance: Module: AWSEBAutoScalingGroup ConfigSet: Infra-WriteApplication2] Command failed on instance. Return code: 1 Output: Error occurred during build: Command 01downloadVersion failed .
This error started appearing all of a sudden and without any changes being done to any of our underlying infrastructure components (S3,etc).
Any ideas to resolve this ?
Thanks in advance.
Make sure that you have defined AWS Credentials file and it contains valid tokens.
export AWS_CREDENTIAL_FILE=~/.aws/aws.cred
My Play 2.2.1 app works perfectly on my home machine.
After been pushed to Cloudbees it was compiled and deployed successfully.
But in runtime when I'm accessing the URL of the app I sometimes get 502 Bad Gateway. Then I can do bees app:restart and problem could disappear or could not. Then I do bees app:restart and it could appear again.
I can see absolutely no logic behind it. After 50% of restarts it appears.
Here is the stacktrace from logs:
Play server process ID is 782
[[37minfo[0m] play - database [default] connected at jdbc:mysql://ec2-23-21-211-172.compute-1.amazonaws.com:3306/totointer
Exception in thread "main" java.lang.NoSuchMethodError: com.avaje.ebean.config.AutofetchConfig.isGarbageCollectionOnShutdown()Z
at com.avaje.ebeaninternal.server.autofetch.DefaultAutoFetchManager.setOwner(DefaultAutoFetchManager.java:98)
at com.avaje.ebeaninternal.server.autofetch.AutoFetchManagerFactory.createAutoFetchManager(AutoFetchManagerFactory.java:29)
at com.avaje.ebeaninternal.server.autofetch.AutoFetchManagerFactory.create(AutoFetchManagerFactory.java:23)
at com.avaje.ebeaninternal.server.core.InternalConfiguration.createAutoFetchManager(InternalConfiguration.java:154)
at com.avaje.ebeaninternal.server.core.DefaultServer.<init>(DefaultServer.java:237)
at com.avaje.ebeaninternal.server.core.DefaultServerFactory.createServer(DefaultServerFactory.java:207)
at com.avaje.ebeaninternal.server.core.DefaultServerFactory.createServer(DefaultServerFactory.java:65)
at com.avaje.ebean.EbeanServerFactory.create(EbeanServerFactory.java:59)
at play.db.ebean.EbeanPlugin.onStart(EbeanPlugin.java:79)
at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:88)
at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:88)
at scala.collection.immutable.List.foreach(List.scala:318)
at play.api.Play$$anonfun$start$1.apply$mcV$sp(Play.scala:88)
at play.api.Play$$anonfun$start$1.apply(Play.scala:88)
at play.api.Play$$anonfun$start$1.apply(Play.scala:88)
at play.utils.Threads$.withContextClassLoader(Threads.scala:18)
at play.api.Play$.start(Play.scala:87)
at play.core.StaticApplication.<init>(ApplicationProvider.scala:52)
at play.core.server.NettyServer$.createServer(NettyServer.scala:243)
at play.core.server.NettyServer$$anonfun$main$3.apply(NettyServer.scala:279)
at play.core.server.NettyServer$$anonfun$main$3.apply(NettyServer.scala:274)
at scala.Option.map(Option.scala:145)
at play.core.server.NettyServer$.main(NettyServer.scala:274)
at play.core.server.NettyServer.main(NettyServer.scala)
Any ideas why?
Looks like conflicting version of same jar in classpath, one of them has AutofetchConfig class but no isGarbageCollectionOnShutdown method. I notice for sample on API doc that this method doesn't exist in 2.6.0, but exists in 3.2.2