Skip to content

Conversation

@AM-19
Copy link
Contributor

@AM-19 AM-19 commented Mar 18, 2024

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.

@jbonofre
Copy link
Member

Which versions of AMQ are you refering ?

@AM-19
Copy link
Contributor Author

AM-19 commented Mar 18, 2024

Which versions of AMQ are you refering ?

Issue is Observed in 5.17.6, but will Ideally occur in 5.18.x and 6.0.x

@jbonofre
Copy link
Member

@AM-19 ok it's what I thought: let me check but I don't think it happens on 6.x.

@AM-19
Copy link
Contributor Author

AM-19 commented Mar 18, 2024

@AM-19 ok it's what I thought: let me check but I don't think it happens on 6.x.

Let me validate on 6.x, Will reply in this Thread.

@jbonofre
Copy link
Member

Ok, so I don't think we need it :)

@AM-19
Copy link
Contributor Author

AM-19 commented Mar 18, 2024

Ok, so I don't think we need it :)

Actually It does occur in 6.x

image

My bad I mis-spelled property while testing.

ERROR | Could not set property soTimeout on ServerSocket[addr=/0:0:0:0:0:0:0:0,localport=61616] 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 @6f0603b8 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) ~[activemq-client-6.1.0.jar:6.1.0] at org.apache.activemq.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:155) ~[activemq-client-6.1.0.jar:6.1.0] at org.apache.activemq.transport.tcp.TcpTransportServer.configureServerSocket(TcpTransportServer.java:204) ~[activemq-client-6.1.0.jar:6.1.0] at org.apache.activemq.transport.tcp.TcpTransportServer.bind(TcpTransportServer.java:146) ~[activemq-client-6.1.0.jar:6.1.0] at org.apache.activemq.transport.auto.nio.AutoNioSslTransportFactory.doBind(AutoNioSslTransportFactory.java:122) ~[activemq-broker-6.1.0.jar:6.1.0] at org.apache.activemq.transport.TransportFactorySupport.bind(TransportFactorySupport.java:40) ~[activemq-broker-6.1.0.jar:6.1.0] at org.apache.activemq.broker.TransportConnector.createTransportServer(TransportConnector.java:349) ~[activemq-broker-6.1.0.jar:6.1.0] at org.apache.activemq.broker.TransportConnector.getServer(TransportConnector.java:148) ~[activemq-broker-6.1.0.jar:6.1.0] at org.apache.activemq.broker.TransportConnector.asManagedConnector(TransportConnector.java:113) ~[activemq-broker-6.1.0.jar:6.1.0] at org.apache.activemq.broker.BrokerService.registerConnectorMBean(BrokerService.java:2248) ~[activemq-broker-6.1.0.jar:6.1.0] at org.apache.activemq.broker.BrokerService.startTransportConnector(BrokerService.java:2735) ~[activemq-broker-6.1.0.jar:6.1.0] at org.apache.activemq.broker.BrokerService.startAllConnectors(BrokerService.java:2631) ~[activemq-broker-6.1.0.jar:6.1.0] at org.apache.activemq.broker.BrokerService.doStartBroker(BrokerService.java:768) ~[activemq-broker-6.1.0.jar:6.1.0] at org.apache.activemq.broker.BrokerService.startBroker(BrokerService.java:730) ~[activemq-broker-6.1.0.jar:6.1.0] at org.apache.activemq.broker.BrokerService.start(BrokerService.java:628) ~[activemq-broker-6.1.0.jar:6.1.0] at org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:73) ~[activemq-spring-6.1.0.jar:6.1.0] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]

@jbonofre
Copy link
Member

It works for me. Which JDK are you using (provider) ?

I will do some tests but it looks like an environment issue to me. Let me double check.

@AM-19
Copy link
Contributor Author

AM-19 commented Mar 18, 2024

It works for me. Which JDK are you using (provider) ?

I will do some tests but it looks like an environment issue to me. Let me double check.

Hello, I tested using Java Runtime: Eclipse Adoptium 17.0.10.

Just to double check, can you share your Runtime, Ill test using the exact version, Will see how it goes,

@AM-19
Copy link
Contributor Author

AM-19 commented Mar 20, 2024

Hello, I checked with other JVM's as well. I see the same exception. Please share your Java version, let me test with that.

@jbonofre
Copy link
Member

I will double check. But I'm surprised that it doesn't fail on Jenkins too. I'm still convinced that it's environment related (I would have see that already else). I will check with different env.

@AM-19
Copy link
Contributor Author

AM-19 commented Mar 20, 2024

Can you try with following config:

<transportConnector name="auto+nio+ssl" uri="auto+nio+ssl://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600&amp;transport.soTimeout=30000"/>

@jbonofre
Copy link
Member

Oh you don't use the default activemq.xml ?

@jbonofre
Copy link
Member

I have to check if soTimeout exists with the transport connector you are using.

@jbonofre
Copy link
Member

Using the default conf/activemq.xml with JDK openjdk version "17.0.10" 2024-01-16, I don't have any problem (including with ActiveMQ 5.17.7-SNAPSHOT.
So, the problem is related to the transport connector URI you are using (that's why I was not able to reproduce the issue).
The problem is about transport.soTimeout.
I'm fixing. Thanks for your patience.

@jbonofre jbonofre self-requested a review March 22, 2024 07:31
@jbonofre jbonofre merged commit 9e524fc into apache:main Mar 22, 2024
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

Successfully merging this pull request may close these issues.

2 participants