Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backend-service.jar does not work. #233

Open
jfp404 opened this issue Apr 10, 2020 · 10 comments
Open

Backend-service.jar does not work. #233

jfp404 opened this issue Apr 10, 2020 · 10 comments

Comments

@jfp404
Copy link

jfp404 commented Apr 10, 2020

Description:

I am trying to launch the backend-service.jar but I get this error
java -jar backend-service.jar -introspection
Enabled true
2020-04-10 12:20:14 INFO BookingService:47 - Service properties loaded successfully.
2020-04-10 12:20:14 INFO BookingService:84 - Setting trust store path to : /tmp/wso2carbon.jks11159419101483655202
2020-04-10 12:20:14 INFO BookingService:109 - Starting backend service.
2020-04-10 12:20:14 INFO BookingService:110 - Configurations :
2020-04-10 12:20:14 INFO BookingService:113 - port: 39090
2020-04-10 12:20:14 INFO BookingService:113 - introspectionEndpoint: https://localhost:9443/oauth2/introspect
2020-04-10 12:20:14 INFO BookingService:113 - introspectionEnabled: true
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/c/Learning/wso2/samples-is/etc/backend-service/target/backend-service.jar) to constructor java.nio.DirectByteBuffer(long,int)
WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Exception in thread "main" java.lang.NoClassDefFoundError: javax/annotation/PostConstruct
at org.wso2.msf4j.internal.router.MicroserviceMetadata.lambda$new$33(MicroserviceMetadata.java:63)
at java.base/java.util.HashMap.forEach(HashMap.java:1336)
at java.base/java.util.Collections$UnmodifiableMap.forEach(Collections.java:1505)
at org.wso2.msf4j.internal.router.MicroserviceMetadata.(MicroserviceMetadata.java:61)
at org.wso2.msf4j.internal.MicroservicesRegistryImpl.updateMetadata(MicroservicesRegistryImpl.java:234)
at org.wso2.msf4j.internal.MicroservicesRegistryImpl.addService(MicroservicesRegistryImpl.java:80)
at org.wso2.msf4j.MicroservicesRunner.deploy(MicroservicesRunner.java:111)
at org.wso2.sample.identity.backend.BackendApplication.main(BackendApplication.java:116)
Caused by: java.lang.ClassNotFoundException: javax.annotation.PostConstruct
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 8 more

Suggested Labels:

Suggested Assignees:

Affected Product Version:

OS, DB, other environment details and versions:

Steps to reproduce:

Related Issues:

@Srywards
Copy link

Hey, you try to launch with this exactly : java -jar backend-service.jar -introspectionEnabled true ?

@jfp404
Copy link
Author

jfp404 commented Apr 10, 2020

Yes, it is what I tried.

@souvikdotdas
Copy link

Perhaps the issue is with JDK version. If JDK 8 is used then it works as expected

@souvikdotdas
Copy link

I have verified on Windows and Ubuntu for both Open JDK and Oracle flavours

@Asifislam110
Copy link

I am training in this course WSO2 Identity Server Fundamentals - V5.11
but when i go through the lab document (Access Delegation - OAuth 2.0), getting issues to follow the same instruction given by trainer.
At this point i am stuck
Navigate to the location, where backend-service.jar resides and then start thebackend service by executing the following command.(Tip - For more information about the backend service,seeIntroduction toBackend Service)
java -jar backend-service-.jar-introspectionEnabled true
When i run this command getting below error
C:\WINDOWS\system32>java -jar "C:\Users\Lenovo\Downloads\IAM_5.10.Samples-master\IAM_5.10.Samples-master\Access_Delegation_Samples\backend-service.jar" -introspectionEnabled true
2021-05-30 14:10:01 INFO BookingService:47 - Service properties loaded successfully.
2021-05-30 14:10:01 INFO BookingService:84 - Setting trust store path to : C:\Users\Lenovo\AppData\Local\Temp\wso2carbon.jks15529500538398575811
2021-05-30 14:10:01 INFO BookingService:109 - Starting backend service.
2021-05-30 14:10:01 INFO BookingService:110 - Configurations :
2021-05-30 14:10:01 INFO BookingService:113 - port: 39090
2021-05-30 14:10:01 INFO BookingService:113 - introspectionEndpoint: https://localhost:9443/oauth2/introspect
2021-05-30 14:10:01 INFO BookingService:113 - introspectionEnabled: true
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/C:/Users/Lenovo/Downloads/IAM_5.10.Samples-master/IAM_5.10.Samples-master/Access_Delegation_Samples/backend-service.jar) to constructor java.nio.DirectByteBuffer(long,int)
WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Exception in thread "main" java.lang.NoClassDefFoundError: javax/annotation/PostConstruct
at org.wso2.msf4j.internal.router.MicroserviceMetadata.lambda$new$33(MicroserviceMetadata.java:63)
at java.base/java.util.HashMap.forEach(HashMap.java:1336)
at java.base/java.util.Collections$UnmodifiableMap.forEach(Collections.java:1505)
at org.wso2.msf4j.internal.router.MicroserviceMetadata.(MicroserviceMetadata.java:61)
at org.wso2.msf4j.internal.MicroservicesRegistryImpl.updateMetadata(MicroservicesRegistryImpl.java:234)
at org.wso2.msf4j.internal.MicroservicesRegistryImpl.addService(MicroservicesRegistryImpl.java:80)
at org.wso2.msf4j.MicroservicesRunner.deploy(MicroservicesRunner.java:111)
at org.wso2.sample.identity.backend.BackendApplication.main(BackendApplication.java:116)
Caused by: java.lang.ClassNotFoundException: javax.annotation.PostConstruct
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 8 more (edited)

@chaminjay
Copy link

@souvikdotdas You're correct. This error occurs on JDK 11. When I tried with JDK 8, it worked without any error.

@charithjayasanka
Copy link

Migrating to JDK 8 sorted it out.

@lawipac
Copy link

lawipac commented Nov 29, 2021

open-Jdk11 has issues and Jdk8 has no problem.

@14R11A05N0
Copy link

I'm learning WSO2 Identity Server Fundamentals - V5.11 now, the wso2 application is not working for me on JDK8 & backend-service.jar doesn't work on JDK11....what should i do???

@aortiz90
Copy link

aortiz90 commented Dec 1, 2022

JDK11 removed some dependency JARs that are needed. Here is a diff of the changes needed in your backend-service/pom.xml so the dependency JARs are pulled into the backend JAR.

diff --git a/etc/backend-service/pom.xml b/etc/backend-service/pom.xml
index 65c01bbc..765e72b2 100644
--- a/etc/backend-service/pom.xml
+++ b/etc/backend-service/pom.xml
@@ -38,6 +38,16 @@
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>javax.annotation-api</artifactId>
+ <version>1.2-b04</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.3.1</version>
+ </dependency>
</dependencies>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants