Menu

WARNING: An illegal reflective access operation has occurred

Help
sdr3
2019-10-31
2019-11-01
  • sdr3

    sdr3 - 2019-10-31

    Hello,

    I am revisiting Jadex after a long time. I could not setup the Jadex
    project manually in Eclispe (Please see this post), so I am using the Maven
    build to setup Jadex as a dependency of my project.

    I downloaded the jadex-example-project.zip and unpacked it. In eclipse
    (Eclipse IDE 2019-09) I opened this project as an existing Maven project.

    the pom.xml file specifies version: <jadex.version>3.0.115</jadex.version>

    I ran the tutorial.Main.class which launches a agent from the class
    tutorial.HelloAgent.class. This launches the platform and the agent runs
    successfully. However, if i write my own agent class and try to launch it
    using the main class I get the following warnings.

    WARNING: An illegal reflective access operation has occurred
    WARNING: Illegal reflective access by jadex.commons.HttpConnectionManager
    (file:/C:/Users/Steve/.m2/repository/org/activecomponents/jadex/jadex-commons/3.0.115/jadex-commons-3.0.115.jar)
    to field sun.net.www.protocol.http.HttpURLConnection.http
    WARNING: Please consider reporting this to the maintainers of
    jadex.commons.HttpConnectionManager
    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
    

    To test this, I created another agent in the same package location:
    tutorials.HelloAgent1.class. The contents of tutorial.HelloAgent1.class is
    identical to tutorial.HelloAgent.class. The error output is the following:

    Exception in thread "main" jadex.bridge.ComponentCreationException: No
    factory found for: tutorial.HelloAgent1.class
    at
    jadex.platform.service.cms.ComponentManagementService.selectFallbackFactory(ComponentManagementService.java:1200)
    at
    jadex.platform.service.cms.ComponentManagementService$12.customResultAvailable(ComponentManagementService.java:1159)
    at
    jadex.platform.service.cms.ComponentManagementService$12.customResultAvailable(ComponentManagementService.java:1135)
    at
    jadex.commons.future.ExceptionDelegationResultListener.resultAvailable(ExceptionDelegationResultListener.java:55)
    at
    jadex.commons.future.ExceptionDelegationResultListener.resultAvailableIfUndone(ExceptionDelegationResultListener.java:122)
    at
    jadex.bridge.ComponentResultListener.resultAvailable(ComponentResultListener.java:220)
    at
    jadex.bridge.ComponentResultListener.resultAvailableIfUndone(ComponentResultListener.java:345)
    at jadex.commons.future.Future.notifyListener(Future.java:641)
    at
    jadex.bridge.service.component.interceptors.DelegatingFuture.access$201(FutureFunctionality.java:1193)
    at
    jadex.bridge.service.component.interceptors.DelegatingFuture$1.execute(FutureFunctionality.java:1242)
    at
    jadex.bridge.service.component.interceptors.DelegatingFuture$1.execute(FutureFunctionality.java:1239)
    at
    jadex.bridge.service.component.interceptors.DecouplingReturnInterceptor$1$1$2.execute(DecouplingReturnInterceptor.java:72)
    at
    jadex.bridge.component.impl.ExecutionComponentFeature.execute(ExecutionComponentFeature.java:1176)
    at jadex.commons.concurrent.Executor.code(Executor.java:299)
    at jadex.commons.concurrent.Executor.run(Executor.java:126)
    at
    jadex.platform.service.execution.AsyncExecutionService$1.run(AsyncExecutionService.java:109)
    at
    jadex.commons.concurrent.ThreadPool$ServiceThread.run(ThreadPool.java:515)
    WARNING: An illegal reflective access operation has occurred
    WARNING: Illegal reflective access by jadex.commons.HttpConnectionManager
    (file:/C:/Users/Steve/.m2/repository/org/activecomponents/jadex/jadex-commons/3.0.115/jadex-commons-3.0.115.jar)
    to field sun.net.www.protocol.http.HttpURLConnection.http
    WARNING: Please consider reporting this to the maintainers of
    jadex.commons.HttpConnectionManager
    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
    

    I was originally using AdoptOpenJDK jdk-11.0.5.10-openj9. To ensure that
    there is no issues with AdoptOpenJDK compatibility, I also ran the test
    with OracleJDK jdk-11.0.5. There is no difference in the console outputs.

    I am I doing something wrong here?

     

    Last edit: sdr3 2019-10-31
  • sdr3

    sdr3 - 2019-10-31

    Edit: Placed formatting for console output text

     
  • sdr3

    sdr3 - 2019-11-01

    SOLVED!!!

    After reading this post, I deleted everything, inclusing the .m2/repository folder on my computer.

    I created a new maven project and set up the pom.xml file as shown below:

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>com.learn.jadex</groupId>
      <artifactId>tutorial</artifactId>
      <version>0.0.1-SNAPSHOT</version>
    
      <repositories>
        <repository>
          <id>jcenter</id>
          <url>https://jcenter.bintray.com/</url>
        </repository>
      </repositories>
    
      <dependencies>
    
          <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
          </dependency>
    
          <dependency>
            <groupId>org.activecomponents.jadex
            </groupId>
            <artifactId>jadex-distribution-standard</artifactId>
            <version>3.0.115</version>
          </dependency>
    
      </dependencies>
    </project>
    

    Using this pom.xml, maven repopulated my local repository which fixed the ComponentCreation exception. May have been some corrupted jars or an issue with dependency hierarchy.

    The warning for illegal reflective access operation was resoved by switching to Java JDK 8. I am using AdoptOpenJDK jdk-8.0.232.09-OpenJ9. The illegal reflective access seems to be occuring with Jadex due to a feature implemented in Java9 onwards. Here is a stackoverflow thread about the issue (link)

    Although, I do not understand how this error was not being thrown when i launched the HelloAgent.class in the jadex-example-project.zip. However it was thrown when I launched a duplicated class with a different name?

     
  • Lars Braubach

    Lars Braubach - 2019-11-01

    Hi, in Jadex 4 those problems are resolved and it will work also with newer JDKs. Best Lars

     

Log in to post a comment.

MongoDB Logo MongoDB