Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-9459

Add appropriate JVM Args to allow access to sun.nio.* classes

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 5.17.6
    • 5.18.4, 5.17.7, 6.1.1
    • None
    • None

    Description

      When ActiveMQ running ActiveMQ on Java 17 or later JRE, it encounters following exception:

      ERROR | Could not set property soTimeout on ServerSocket[addr=/0:0:0:0:0:0:0:0,localport=xxxxx] | org.apache.activemq.util.IntrospectionSupport | main
      java.lang.reflect.InaccessibleObjectException: Unable to make public void sun.nio.ch.ServerSocketAdaptor.setSoTimeout(int) throws java.net.SocketException accessible: module java.base does not "opens sun.nio.ch" to unnamed module @4739cd70
      	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
      	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
      	at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
      	at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
      	at org.apache.activemq.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:179)
      	at org.apache.activemq.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:155)
      	at org.apache.activemq.transport.tcp.TcpTransportServer.configureServerSocket(TcpTransportServer.java:202)
      	at org.apache.activemq.transport.tcp.TcpTransportServer.bind(TcpTransportServer.java:144)
      	at org.apache.activemq.transport.auto.nio.AutoNioSslTransportFactory.doBind(AutoNioSslTransportFactory.java:122)
      	at org.apache.activemq.transport.TransportFactorySupport.bind(TransportFactorySupport.java:40)
      	at org.apache.activemq.broker.TransportConnector.createTransportServer(TransportConnector.java:340)
      	at org.apache.activemq.broker.TransportConnector.getServer(TransportConnector.java:148)
      	at org.apache.activemq.broker.TransportConnector.asManagedConnector(TransportConnector.java:113)
      	at org.apache.activemq.broker.BrokerService.registerConnectorMBean(BrokerService.java:2241)
      	at org.apache.activemq.broker.BrokerService.startTransportConnector(BrokerService.java:2728)
      	at org.apache.activemq.broker.BrokerService.startAllConnectors(BrokerService.java:2624)
      	at org.apache.activemq.broker.BrokerService.doStartBroker(BrokerService.java:762)
      	at org.apache.activemq.broker.BrokerService.startBroker(BrokerService.java:724)
      	at org.apache.activemq.broker.BrokerService.start(BrokerService.java:622) 

      According to Oracle, with JEP 403 (link1) and JEP 403 (link2) which has been decided to be delivered from JDK 17 and onwards , the setAccessible approach which was introduced as part of https://issues.apache.org/jira/browse/AMQ-7121 wont work.

       

      Fix:  Adding the following in activemq file should do the job:

      --add-opens java.base/sun.nio.ch=ALL-UNNAMED

       

       

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            jbonofre Jean-Baptiste Onofré
            akki1902 Anubhav Mishra
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 3h 20m
                3h 20m

                Slack

                  Issue deployment