How to get my Keystore file to work with my Java Vert.x project (Invalid keystore format)
up vote
0
down vote
favorite
I have a Java Vert.x Gradle project and I am trying to get Vert.x auth JWT working with it, but when I run my project I get a Invalid keystore format
error.
I am trying to do this locally; I am on an iMac.
Here is part of my build.gradle
file:
build.gradle
// Import to replace ant-style tokens (@environmentVariable@) with values
import org.apache.tools.ant.filters.ReplaceTokens
buildscript {
ext.vertxVersion = '3.5.4'
}
dependencies {
compile "io.vertx:vertx-core:$vertxVersion"
compile "io.vertx:vertx-web:$vertxVersion"
compile "io.vertx:vertx-web-client:$vertxVersion"
compile "io.vertx:vertx-web-templ-thymeleaf:3.5.4"
compile "io.vertx:vertx-unit:$vertxVersion"
compile 'io.vertx:vertx-auth-jwt:3.5.4'
compile group: 'io.jsonwebtoken', name: 'jjwt', version: '0.9.1'
compile "org.slf4j:slf4j-api:1.7.25"
testCompile group: 'junit', name: 'junit', version: '4.12'
implementation 'com.google.code.gson:gson:2.8.5'
}
//Replace ant-style tokens with properties.
processResources {
filter( ReplaceTokens, tokens: properties )
}
Here is how I am implementing in my Vert.x verticle.
MainVerticle.java
JWTAuthOptions config = new JWTAuthOptions();
config.setKeyStore(new KeyStoreOptions()
.setType(Constants.KEY_STORE_TYPE) /* = "jceks" */
.setPath(Constants.KEY_STORE_PATH) /* = "keystore.jceks" */
.setPassword(Constants.AUTH_KEY_STORE_PASSWORD)); /* correct password */
JWTAuth provider = JWTAuth.create(vertx, config);
router.route(Constants.HOME_PAGE + "/*").handler(JWTAuthHandler.create(provider));
Here is where I am keeping my keystore.jceks
file:
keystore.jceks
My-Project
|----src
|----main
|----resources
|----keystore.jceks
I first build my project with gradle:
$ ./gradlew clean build
Building my project works fine. Then I try to run my project:
$ java -jar build/libs/MyProject-far-1.0.jar
When I run my project, I get the following error:
java.lang.RuntimeException: java.io.IOException: Invalid keystore format
at io.vertx.ext.auth.jwt.impl.JWTAuthProviderImpl.<init>(JWTAuthProviderImpl.java:107)
at io.vertx.ext.auth.jwt.JWTAuth.create(JWTAuth.java:56)
at com.ucg.warehouselocationmapping.app.MainVerticle.start(MainVerticle.java:54)
at io.vertx.core.impl.DeploymentManager.lambda$doDeploy$8(DeploymentManager.java:491)
at io.vertx.core.impl.ContextImpl.lambda$wrapTask$2(ContextImpl.java:339)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:745)
I was using this as a reference of how to implement Vert.x auth JWT, as well as another project's code.
The keystore.jceks
file I am using was copied from another project where it works perfectly. It was first copied by dragging it around Eclipse. When that didn't work, I tried copying it in the terminal:
$ cp /Users/Me/workspace/My-Service/src/main/resources/keystore.jceks /Users/Me/workspace/My-Project/src/main/resources
That didn't work, so I tried copying it via Finder. That didn't work either.
Anyone ever come across this issue before? I'm not really familiar with jks/jceks files or authentication.
ANSWER
The import org.apache.tools.ant.filters.ReplaceTokens
plugin was finding @ signs in my keystore.jceks
file and manipulating them, when I really only wanted ant-style tokens to be replaced in my properties files. I updated my build.gradle
file to only replace files ending in .properties
, and that fixed my issue.
//Replace ant-style tokens with properties.
processResources {
filesMatching('**/*.properties') {
filter( ReplaceTokens, tokens: properties )
}
}
java gradle jwt keystore vert.x
add a comment |
up vote
0
down vote
favorite
I have a Java Vert.x Gradle project and I am trying to get Vert.x auth JWT working with it, but when I run my project I get a Invalid keystore format
error.
I am trying to do this locally; I am on an iMac.
Here is part of my build.gradle
file:
build.gradle
// Import to replace ant-style tokens (@environmentVariable@) with values
import org.apache.tools.ant.filters.ReplaceTokens
buildscript {
ext.vertxVersion = '3.5.4'
}
dependencies {
compile "io.vertx:vertx-core:$vertxVersion"
compile "io.vertx:vertx-web:$vertxVersion"
compile "io.vertx:vertx-web-client:$vertxVersion"
compile "io.vertx:vertx-web-templ-thymeleaf:3.5.4"
compile "io.vertx:vertx-unit:$vertxVersion"
compile 'io.vertx:vertx-auth-jwt:3.5.4'
compile group: 'io.jsonwebtoken', name: 'jjwt', version: '0.9.1'
compile "org.slf4j:slf4j-api:1.7.25"
testCompile group: 'junit', name: 'junit', version: '4.12'
implementation 'com.google.code.gson:gson:2.8.5'
}
//Replace ant-style tokens with properties.
processResources {
filter( ReplaceTokens, tokens: properties )
}
Here is how I am implementing in my Vert.x verticle.
MainVerticle.java
JWTAuthOptions config = new JWTAuthOptions();
config.setKeyStore(new KeyStoreOptions()
.setType(Constants.KEY_STORE_TYPE) /* = "jceks" */
.setPath(Constants.KEY_STORE_PATH) /* = "keystore.jceks" */
.setPassword(Constants.AUTH_KEY_STORE_PASSWORD)); /* correct password */
JWTAuth provider = JWTAuth.create(vertx, config);
router.route(Constants.HOME_PAGE + "/*").handler(JWTAuthHandler.create(provider));
Here is where I am keeping my keystore.jceks
file:
keystore.jceks
My-Project
|----src
|----main
|----resources
|----keystore.jceks
I first build my project with gradle:
$ ./gradlew clean build
Building my project works fine. Then I try to run my project:
$ java -jar build/libs/MyProject-far-1.0.jar
When I run my project, I get the following error:
java.lang.RuntimeException: java.io.IOException: Invalid keystore format
at io.vertx.ext.auth.jwt.impl.JWTAuthProviderImpl.<init>(JWTAuthProviderImpl.java:107)
at io.vertx.ext.auth.jwt.JWTAuth.create(JWTAuth.java:56)
at com.ucg.warehouselocationmapping.app.MainVerticle.start(MainVerticle.java:54)
at io.vertx.core.impl.DeploymentManager.lambda$doDeploy$8(DeploymentManager.java:491)
at io.vertx.core.impl.ContextImpl.lambda$wrapTask$2(ContextImpl.java:339)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:745)
I was using this as a reference of how to implement Vert.x auth JWT, as well as another project's code.
The keystore.jceks
file I am using was copied from another project where it works perfectly. It was first copied by dragging it around Eclipse. When that didn't work, I tried copying it in the terminal:
$ cp /Users/Me/workspace/My-Service/src/main/resources/keystore.jceks /Users/Me/workspace/My-Project/src/main/resources
That didn't work, so I tried copying it via Finder. That didn't work either.
Anyone ever come across this issue before? I'm not really familiar with jks/jceks files or authentication.
ANSWER
The import org.apache.tools.ant.filters.ReplaceTokens
plugin was finding @ signs in my keystore.jceks
file and manipulating them, when I really only wanted ant-style tokens to be replaced in my properties files. I updated my build.gradle
file to only replace files ending in .properties
, and that fixed my issue.
//Replace ant-style tokens with properties.
processResources {
filesMatching('**/*.properties') {
filter( ReplaceTokens, tokens: properties )
}
}
java gradle jwt keystore vert.x
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a Java Vert.x Gradle project and I am trying to get Vert.x auth JWT working with it, but when I run my project I get a Invalid keystore format
error.
I am trying to do this locally; I am on an iMac.
Here is part of my build.gradle
file:
build.gradle
// Import to replace ant-style tokens (@environmentVariable@) with values
import org.apache.tools.ant.filters.ReplaceTokens
buildscript {
ext.vertxVersion = '3.5.4'
}
dependencies {
compile "io.vertx:vertx-core:$vertxVersion"
compile "io.vertx:vertx-web:$vertxVersion"
compile "io.vertx:vertx-web-client:$vertxVersion"
compile "io.vertx:vertx-web-templ-thymeleaf:3.5.4"
compile "io.vertx:vertx-unit:$vertxVersion"
compile 'io.vertx:vertx-auth-jwt:3.5.4'
compile group: 'io.jsonwebtoken', name: 'jjwt', version: '0.9.1'
compile "org.slf4j:slf4j-api:1.7.25"
testCompile group: 'junit', name: 'junit', version: '4.12'
implementation 'com.google.code.gson:gson:2.8.5'
}
//Replace ant-style tokens with properties.
processResources {
filter( ReplaceTokens, tokens: properties )
}
Here is how I am implementing in my Vert.x verticle.
MainVerticle.java
JWTAuthOptions config = new JWTAuthOptions();
config.setKeyStore(new KeyStoreOptions()
.setType(Constants.KEY_STORE_TYPE) /* = "jceks" */
.setPath(Constants.KEY_STORE_PATH) /* = "keystore.jceks" */
.setPassword(Constants.AUTH_KEY_STORE_PASSWORD)); /* correct password */
JWTAuth provider = JWTAuth.create(vertx, config);
router.route(Constants.HOME_PAGE + "/*").handler(JWTAuthHandler.create(provider));
Here is where I am keeping my keystore.jceks
file:
keystore.jceks
My-Project
|----src
|----main
|----resources
|----keystore.jceks
I first build my project with gradle:
$ ./gradlew clean build
Building my project works fine. Then I try to run my project:
$ java -jar build/libs/MyProject-far-1.0.jar
When I run my project, I get the following error:
java.lang.RuntimeException: java.io.IOException: Invalid keystore format
at io.vertx.ext.auth.jwt.impl.JWTAuthProviderImpl.<init>(JWTAuthProviderImpl.java:107)
at io.vertx.ext.auth.jwt.JWTAuth.create(JWTAuth.java:56)
at com.ucg.warehouselocationmapping.app.MainVerticle.start(MainVerticle.java:54)
at io.vertx.core.impl.DeploymentManager.lambda$doDeploy$8(DeploymentManager.java:491)
at io.vertx.core.impl.ContextImpl.lambda$wrapTask$2(ContextImpl.java:339)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:745)
I was using this as a reference of how to implement Vert.x auth JWT, as well as another project's code.
The keystore.jceks
file I am using was copied from another project where it works perfectly. It was first copied by dragging it around Eclipse. When that didn't work, I tried copying it in the terminal:
$ cp /Users/Me/workspace/My-Service/src/main/resources/keystore.jceks /Users/Me/workspace/My-Project/src/main/resources
That didn't work, so I tried copying it via Finder. That didn't work either.
Anyone ever come across this issue before? I'm not really familiar with jks/jceks files or authentication.
ANSWER
The import org.apache.tools.ant.filters.ReplaceTokens
plugin was finding @ signs in my keystore.jceks
file and manipulating them, when I really only wanted ant-style tokens to be replaced in my properties files. I updated my build.gradle
file to only replace files ending in .properties
, and that fixed my issue.
//Replace ant-style tokens with properties.
processResources {
filesMatching('**/*.properties') {
filter( ReplaceTokens, tokens: properties )
}
}
java gradle jwt keystore vert.x
I have a Java Vert.x Gradle project and I am trying to get Vert.x auth JWT working with it, but when I run my project I get a Invalid keystore format
error.
I am trying to do this locally; I am on an iMac.
Here is part of my build.gradle
file:
build.gradle
// Import to replace ant-style tokens (@environmentVariable@) with values
import org.apache.tools.ant.filters.ReplaceTokens
buildscript {
ext.vertxVersion = '3.5.4'
}
dependencies {
compile "io.vertx:vertx-core:$vertxVersion"
compile "io.vertx:vertx-web:$vertxVersion"
compile "io.vertx:vertx-web-client:$vertxVersion"
compile "io.vertx:vertx-web-templ-thymeleaf:3.5.4"
compile "io.vertx:vertx-unit:$vertxVersion"
compile 'io.vertx:vertx-auth-jwt:3.5.4'
compile group: 'io.jsonwebtoken', name: 'jjwt', version: '0.9.1'
compile "org.slf4j:slf4j-api:1.7.25"
testCompile group: 'junit', name: 'junit', version: '4.12'
implementation 'com.google.code.gson:gson:2.8.5'
}
//Replace ant-style tokens with properties.
processResources {
filter( ReplaceTokens, tokens: properties )
}
Here is how I am implementing in my Vert.x verticle.
MainVerticle.java
JWTAuthOptions config = new JWTAuthOptions();
config.setKeyStore(new KeyStoreOptions()
.setType(Constants.KEY_STORE_TYPE) /* = "jceks" */
.setPath(Constants.KEY_STORE_PATH) /* = "keystore.jceks" */
.setPassword(Constants.AUTH_KEY_STORE_PASSWORD)); /* correct password */
JWTAuth provider = JWTAuth.create(vertx, config);
router.route(Constants.HOME_PAGE + "/*").handler(JWTAuthHandler.create(provider));
Here is where I am keeping my keystore.jceks
file:
keystore.jceks
My-Project
|----src
|----main
|----resources
|----keystore.jceks
I first build my project with gradle:
$ ./gradlew clean build
Building my project works fine. Then I try to run my project:
$ java -jar build/libs/MyProject-far-1.0.jar
When I run my project, I get the following error:
java.lang.RuntimeException: java.io.IOException: Invalid keystore format
at io.vertx.ext.auth.jwt.impl.JWTAuthProviderImpl.<init>(JWTAuthProviderImpl.java:107)
at io.vertx.ext.auth.jwt.JWTAuth.create(JWTAuth.java:56)
at com.ucg.warehouselocationmapping.app.MainVerticle.start(MainVerticle.java:54)
at io.vertx.core.impl.DeploymentManager.lambda$doDeploy$8(DeploymentManager.java:491)
at io.vertx.core.impl.ContextImpl.lambda$wrapTask$2(ContextImpl.java:339)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:745)
I was using this as a reference of how to implement Vert.x auth JWT, as well as another project's code.
The keystore.jceks
file I am using was copied from another project where it works perfectly. It was first copied by dragging it around Eclipse. When that didn't work, I tried copying it in the terminal:
$ cp /Users/Me/workspace/My-Service/src/main/resources/keystore.jceks /Users/Me/workspace/My-Project/src/main/resources
That didn't work, so I tried copying it via Finder. That didn't work either.
Anyone ever come across this issue before? I'm not really familiar with jks/jceks files or authentication.
ANSWER
The import org.apache.tools.ant.filters.ReplaceTokens
plugin was finding @ signs in my keystore.jceks
file and manipulating them, when I really only wanted ant-style tokens to be replaced in my properties files. I updated my build.gradle
file to only replace files ending in .properties
, and that fixed my issue.
//Replace ant-style tokens with properties.
processResources {
filesMatching('**/*.properties') {
filter( ReplaceTokens, tokens: properties )
}
}
java gradle jwt keystore vert.x
java gradle jwt keystore vert.x
edited Nov 21 at 3:36
asked Nov 19 at 21:10
aCarella
83452246
83452246
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
The import org.apache.tools.ant.filters.ReplaceTokens
plugin was finding @ signs in my keystore.jceks
file and manipulating them, when I really only wanted ant-style tokens to be replaced in my properties files. I updated my build.gradle
file to only replace files ending in .properties
, and that fixed my issue.
//Replace ant-style tokens with properties.
processResources {
filesMatching('**/*.properties') {
filter( ReplaceTokens, tokens: properties )
}
}
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
The import org.apache.tools.ant.filters.ReplaceTokens
plugin was finding @ signs in my keystore.jceks
file and manipulating them, when I really only wanted ant-style tokens to be replaced in my properties files. I updated my build.gradle
file to only replace files ending in .properties
, and that fixed my issue.
//Replace ant-style tokens with properties.
processResources {
filesMatching('**/*.properties') {
filter( ReplaceTokens, tokens: properties )
}
}
add a comment |
up vote
0
down vote
accepted
The import org.apache.tools.ant.filters.ReplaceTokens
plugin was finding @ signs in my keystore.jceks
file and manipulating them, when I really only wanted ant-style tokens to be replaced in my properties files. I updated my build.gradle
file to only replace files ending in .properties
, and that fixed my issue.
//Replace ant-style tokens with properties.
processResources {
filesMatching('**/*.properties') {
filter( ReplaceTokens, tokens: properties )
}
}
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
The import org.apache.tools.ant.filters.ReplaceTokens
plugin was finding @ signs in my keystore.jceks
file and manipulating them, when I really only wanted ant-style tokens to be replaced in my properties files. I updated my build.gradle
file to only replace files ending in .properties
, and that fixed my issue.
//Replace ant-style tokens with properties.
processResources {
filesMatching('**/*.properties') {
filter( ReplaceTokens, tokens: properties )
}
}
The import org.apache.tools.ant.filters.ReplaceTokens
plugin was finding @ signs in my keystore.jceks
file and manipulating them, when I really only wanted ant-style tokens to be replaced in my properties files. I updated my build.gradle
file to only replace files ending in .properties
, and that fixed my issue.
//Replace ant-style tokens with properties.
processResources {
filesMatching('**/*.properties') {
filter( ReplaceTokens, tokens: properties )
}
}
edited Nov 20 at 22:06
answered Nov 20 at 14:42
aCarella
83452246
83452246
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53382680%2fhow-to-get-my-keystore-file-to-work-with-my-java-vert-x-project-invalid-keystor%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown