Solr6.6调试模式启动报错:-Xdebug不被支持,请教启动方法
Hey there, let's sort out this Solr 6.6 debugging error you're facing. That "ERROR: -Xdebug is not supported by this script" message pops up because newer Java versions (which Solr 6.6 likely uses under the hood) deprecated the old -Xdebug flag. Instead, we need to use the modern jdwp agent syntax to enable debugging. Here are two reliable methods to get this working:
Method 1: Use Solr's Built-in Debug Flag (Easy & Recommended)
Solr has a dedicated -debug flag that handles all the JVM configuration for you automatically. Just run this command to start Solr in debug mode:
./solr start -debug
By default, this sets up the debug listener on port 8984. You can connect your IDE (IntelliJ, Eclipse, etc.) to localhost:8984 using a standard remote debugging configuration—no manual JVM args needed.
Method 2: Manually Configure Custom Debug Settings
If you need to tweak the debug setup (like changing the port, or making Solr pause until your debugger connects), use the -a flag to pass custom JVM arguments:
./solr start -a "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8984"
Let's break down what each part does:
transport=dt_socket: Uses socket communication for the debug connectionserver=y: Sets Solr up as a debug server (listens for incoming debugger connections)suspend=n: Starts Solr right away without waiting for a debugger (swap tosuspend=yif you want Solr to pause until your IDE attaches)address=8984: The port your debugger will connect to—feel free to change this to any unused port on your machine
Verify the Debug Connection
Once Solr starts, check the logs and you should see a line like this:
Listening for transport dt_socket at address: 8984
That means the debug agent is running, and you can now connect your IDE's remote debugger to that port, set breakpoints, and start debugging your Solr code.
Quick Troubleshooting Tips
- Ensure the debug port you choose isn't already in use by another service.
- If you're running Solr as a system service (not via the
solrscript), you'll need to edit the service configuration to add theagentlib:jdwpargument to the JVM options. - Solr 6.6 requires Java 8 or later—while Java 8 technically still supports
-Xdebug, Solr's startup script blocks it to encourage using the modern, future-proofjdwpsyntax.
内容的提问来源于stack exchange,提问作者user1682076

