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

Agent should not depend on java.rmi module #2235

Open
axelfontaine opened this issue Feb 5, 2025 · 2 comments
Open

Agent should not depend on java.rmi module #2235

axelfontaine opened this issue Feb 5, 2025 · 2 comments
Labels
feature request Suggestion for a new product enhancement or change

Comments

@axelfontaine
Copy link

Description

On a small JRE created with JDeps I get

Unable to start New Relic Agent. Please remove -javaagent from your startup arguments and contact New Relic support.
java.lang.NoClassDefFoundError: java/rmi/UnexpectedException
        at com.newrelic.agent.RPMServiceManagerImpl.createRPMService(RPMServiceManagerImpl.java:174)
        at com.newrelic.agent.RPMServiceManagerImpl.<init>(RPMServiceManagerImpl.java:78)
        at com.newrelic.agent.service.ServiceManagerImpl.doStart(ServiceManagerImpl.java:258)
        at com.newrelic.agent.service.AbstractService.start(AbstractService.java:63)
        at com.newrelic.agent.Agent.continuePremain(Agent.java:176)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at com.newrelic.bootstrap.BootstrapAgent.startAgent(BootstrapAgent.java:175)
        at com.newrelic.bootstrap.BootstrapAgent.premain(BootstrapAgent.java:117)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(Unknown Source)
        at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: java.rmi.UnexpectedException
        at java.base/java.net.URLClassLoader.findClass(Unknown Source)
        at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
        at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
        ... 13 more

Expected Behavior

Agent works without the java.rmi JDK module

Troubleshooting or NR Diag results

See above

Steps to Reproduce

Create a JRE with these modules:

java.base, java.compiler, java.datatransfer, java.desktop, java.instrument, java.logging, java.management, java.naming, java.net.http, java.prefs, java.security.sasl, java.sql, java.transaction.xa, java.xml, jdk.management, jdk.unsupported

and start the agent

Your Environment

Java 23

Additional context

The issue is this line:

Where an RMI exception is being abused instead of using a custom one.

@axelfontaine axelfontaine added the bug Something isn't working as designed/intended label Feb 5, 2025
@workato-integration
Copy link

@meiao meiao added feature request Suggestion for a new product enhancement or change and removed bug Something isn't working as designed/intended labels Feb 5, 2025
@meiao
Copy link
Contributor

meiao commented Feb 5, 2025

There are 3 places where this exception is being thrown. One on RPMService and two on DataSenderImpl.
Indeed it would be better to send a more appropriate exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Suggestion for a new product enhancement or change
Projects
Development

No branches or pull requests

2 participants