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

IntrospectionSupport.setProperty should call method.setAccessible(true)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 5.15.8
    • 5.16.0
    • None
    • None
    • Patch Available

    Description

      We are trying to run a broker in JDK 11 and run into the following exception:

      2018-12-07 12:44:41,363 ERROR main o.a.a.u.IntrospectionSupport Could not set property soTimeout on ServerSocket[addr=/0:0:0:0:0:0:0:0,localport=9505]
      java.lang.IllegalAccessException: class org.apache.activemq.util.IntrospectionSupport cannot access a member of class sun.nio.ch.ServerSocketAdaptor (in module java.base) with modifiers "public"
      at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:361)
      at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:591)
      at java.base/java.lang.reflect.Method.invoke(Method.java:558)
      at org.apache.activemq.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:184)
      at org.apache.activemq.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:155)
      at org.apache.activemq.transport.tcp.TcpTransportServer.configureServerSocket(TcpTransportServer.java:187)
      at org.apache.activemq.transport.tcp.TcpTransportServer.bind(TcpTransportServer.java:142)
      at org.apache.activemq.transport.tcp.TcpTransportFactory.doBind(TcpTransportFactory.java:62)
      at org.apache.activemq.transport.TransportFactorySupport.bind(TransportFactorySupport.java:40)
      at org.apache.activemq.broker.TransportConnector.createTransportServer(TransportConnector.java:318)
      at org.apache.activemq.broker.TransportConnector.getServer(TransportConnector.java:141)

      Note that we also see

      Could not set property reuseAddress ...

      These are caused by sun.nio.ch.ServerSocketAdaptor becoming a non-public class in JDK 11 (if not earlier).

      It can be fixed simply by having IntrospectionSupport.setProperty call setter.setAccessible(true) before it invokes any methods on it.

      Otherwise we find our local broker runs perfectly fine. 

      Attachments

        1. AMQ-7121_Set_accessible.patch
          2 kB
          Ollie Robertshaw

        Issue Links

          Activity

            People

              jbonofre Jean-Baptiste Onofré
              ollierob Ollie Robertshaw
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 2m Original Estimate - 2m
                  2m
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m