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

SOLR-16973: fix REMOTE_JMX_OPTS to delayed expansion #1917

Merged
merged 3 commits into from
Sep 13, 2023

Conversation

tizianodeg
Copy link
Contributor

https://issues.apache.org/jira/browse/SOLR-16973

Description

On windows RMI can not be enabled using the solr.in.cmd.
This is because the REMOTE_JMX_OPTS is changed in solr.cmd but it is used as static %REMOTE_JMX_OPTS% instead using delayed expansion !REMOTE_JMX_OPTS!

Solution

use !REMOTE_JMX_OPTS! instead of %REMOTE_JMX_OPTS%

Tests

manual tested by enabling RMI on windows

Checklist

Please review the following and check all that apply:

  • I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • I have created a Jira issue and added the issue ID to my pull request title.
  • I have given Solr maintainers access to contribute to my PR branch. (optional but recommended)
  • I have developed this patch against the main branch.
  • [-] I have run ./gradlew check.
  • [-] I have added tests for my changes.
  • [-] I have added documentation for the Reference Guide

@colvinco
Copy link
Contributor

Delayed expansion is a pain, but it looks okay to me. Can you merge main into your branch and resolve the CHANGES.txt merge?

When starting with JMX enabled, do you also see this error?

java.lang.ClassNotFoundException: org.apache.logging.log4j.jul.LogManager
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
        at java.logging/java.util.logging.LogManager$1.run(LogManager.java:239)
        at java.logging/java.util.logging.LogManager$1.run(LogManager.java:223)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
        at java.logging/java.util.logging.LogManager.<clinit>(LogManager.java:222)
        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)
        at java.management/sun.management.ManagementFactoryHelper$LoggingMXBeanAccess.getMXBeanImplementation(ManagementFactoryHelper.java:243)
        at java.management/sun.management.ManagementFactoryHelper$LoggingMXBeanAccess.<init>(ManagementFactoryHelper.java:259)
        at java.management/sun.management.ManagementFactoryHelper$PlatformLoggingImpl.getInstance(ManagementFactoryHelper.java:339)
        at java.management/sun.management.ManagementFactoryHelper$PlatformLoggingImpl.<clinit>(ManagementFactoryHelper.java:342)
        at java.management/sun.management.ManagementFactoryHelper.getPlatformLoggingMXBean(ManagementFactoryHelper.java:160)
        at java.management/java.lang.management.DefaultPlatformMBeanProvider$9.nameToMBeanMap(DefaultPlatformMBeanProvider.java:378)
        at java.management/java.lang.management.ManagementFactory.lambda$getPlatformMBeanServer$0(ManagementFactory.java:488)
        at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273)
        at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
        at java.base/java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1779)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
        at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
        at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
        at java.management/java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:489)
        at jdk.management.agent/sun.management.jmxremote.ConnectorBootstrap.startRemoteConnectorServer(ConnectorBootstrap.java:476)
        at jdk.management.agent/jdk.internal.agent.Agent.startAgent(Agent.java:447)
        at jdk.management.agent/jdk.internal.agent.Agent.startAgent(Agent.java:599)
Waiting up to 30 seconds to see Solr running on port 8983
Started Solr server on port 8983. Happy searching!

Solr Node (id node1) on port 8983: Started

@tizianodeg
Copy link
Contributor Author

Delayed expansion is a pain, but it looks okay to me. Can you merge main into your branch and resolve the CHANGES.txt merge?

When starting with JMX enabled, do you also see this error?

java.lang.ClassNotFoundException: org.apache.logging.log4j.jul.LogManager
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
        at java.logging/java.util.logging.LogManager$1.run(LogManager.java:239)
        at java.logging/java.util.logging.LogManager$1.run(LogManager.java:223)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
        at java.logging/java.util.logging.LogManager.<clinit>(LogManager.java:222)
        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)
        at java.management/sun.management.ManagementFactoryHelper$LoggingMXBeanAccess.getMXBeanImplementation(ManagementFactoryHelper.java:243)
        at java.management/sun.management.ManagementFactoryHelper$LoggingMXBeanAccess.<init>(ManagementFactoryHelper.java:259)
        at java.management/sun.management.ManagementFactoryHelper$PlatformLoggingImpl.getInstance(ManagementFactoryHelper.java:339)
        at java.management/sun.management.ManagementFactoryHelper$PlatformLoggingImpl.<clinit>(ManagementFactoryHelper.java:342)
        at java.management/sun.management.ManagementFactoryHelper.getPlatformLoggingMXBean(ManagementFactoryHelper.java:160)
        at java.management/java.lang.management.DefaultPlatformMBeanProvider$9.nameToMBeanMap(DefaultPlatformMBeanProvider.java:378)
        at java.management/java.lang.management.ManagementFactory.lambda$getPlatformMBeanServer$0(ManagementFactory.java:488)
        at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273)
        at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
        at java.base/java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1779)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
        at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
        at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
        at java.management/java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:489)
        at jdk.management.agent/sun.management.jmxremote.ConnectorBootstrap.startRemoteConnectorServer(ConnectorBootstrap.java:476)
        at jdk.management.agent/jdk.internal.agent.Agent.startAgent(Agent.java:447)
        at jdk.management.agent/jdk.internal.agent.Agent.startAgent(Agent.java:599)
Waiting up to 30 seconds to see Solr running on port 8983
Started Solr server on port 8983. Happy searching!

Solr Node (id node1) on port 8983: Started

No, but I must admit I testet it against solr 9.2.1 it looks like the logger was introduced in Solr 9.3?
https://issues.apache.org/jira/browse/SOLR-16878

@colvinco colvinco merged commit e77e3dc into apache:main Sep 13, 2023
3 of 4 checks passed
colvinco added a commit that referenced this pull request Sep 13, 2023
* fix REMOTE_JMX_OPTS to delayed expansion
* Update CHANGES.txt

---------

Co-authored-by: Colvin Cowie <[email protected]>
@colvinco
Copy link
Contributor

Ok, I've raised https://issues.apache.org/jira/browse/SOLR-16976 for it

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