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

Usage with CommandBox #32

Open
jamiejackson opened this issue Dec 30, 2022 · 4 comments
Open

Usage with CommandBox #32

jamiejackson opened this issue Dec 30, 2022 · 4 comments

Comments

@jamiejackson
Copy link
Contributor

jamiejackson commented Dec 30, 2022

I thought I'd look into the path translation problem on Windows but I fell into a bunch of rabbit holes.

I've been toying with the idea of having a working commandbox and/or docker example that people could try so I tried spinning things up in commandbox, but first, there was a learning curve to commandbox, and finally and I wasn't able to run it.

Any ideas?

{
    "name":"[email protected]",
    "jvm":{
        "args":[
            "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=localhost:9999",
            "-javaagent:C:/Users/jamie/projects/luceedebug/luceedebug/build/libs/luceedebug.jar=jdwpHost=localhost,jdwpPort=9999,debugHost=0.0.0.0,debugPort=10000,jarPath=C:/Users/jamie/projects/luceedebug/luceedebug/build/libs/luceedebug.jar"
        ],
        "javaVersion":"openjdk11"
    },
    "app":{
        "cfengine":"[email protected]"
    }
}

server run gave the following:

[INFO ] Runwar: ******************************************************************************
[INFO ] Runwar: Starting RunWAR 4.7.16
[INFO ] Runwar: Binding HTTP on 127.0.0.1:23481
[INFO ] Runwar: Enabling HTTP/2
[INFO ] Runwar: Starting background [email protected] [lucee 5.3.10+97] from: /C:/Users/jamie/.CommandBox/lib/runwar-4.7.16.jar
[INFO ] Starting in background -
[INFO ] Runwar: ******************************************************************************
[INFO ] Runwar: Starting RunWAR 4.7.16
[INFO ] Runwar: Binding HTTP on 127.0.0.1:23481
[INFO ] Runwar: Enabling HTTP/2
[INFO ] Runwar: Servlet Context: /
[INFO ] Runwar: Log Directory: C:\Users\jamie\.CommandBox\server\[email protected]\lucee-5.3.10.97\logs
[INFO ] Runwar: ******************************************************************************
[INFO ] Runwar: Parsing 'C:\Users\jamie\.CommandBox\server\[email protected]\lucee-5.3.10.97\WEB-INF\web.xml'
[INFO ] Runwar: Creating deployment [default] in C:\Users\jamie\projects\luceedebug\sample
CommandBox:sample> server log
[INFO ] Runwar: ******************************************************************************
[INFO ] Runwar: Starting RunWAR 4.7.16
[INFO ] Runwar: Binding HTTP on 127.0.0.1:23481
[INFO ] Runwar: Enabling HTTP/2
[INFO ] Runwar: Starting background [email protected] [lucee 5.3.10+97] from: /C:/Users/jamie/.CommandBox/lib/runwar-4.7.16.jar
[INFO ] Starting in background -
[INFO ] Runwar: ******************************************************************************
[INFO ] Runwar: Starting RunWAR 4.7.16
[INFO ] Runwar: Binding HTTP on 127.0.0.1:23481
[INFO ] Runwar: Enabling HTTP/2
[INFO ] Runwar: Servlet Context: /
[INFO ] Runwar: Log Directory: C:\Users\jamie\.CommandBox\server\[email protected]\lucee-5.3.10.97\logs
[INFO ] Runwar: ******************************************************************************
[INFO ] Runwar: Parsing 'C:\Users\jamie\.CommandBox\server\[email protected]\lucee-5.3.10.97\WEB-INF\web.xml'
[INFO ] Runwar: Creating deployment [default] in C:\Users\jamie\projects\luceedebug\sample
[INFO ] [luceedebug] Loaded luceedebug.coreinject.DebugManager@7ed9499e with ClassLoader 'lucee.core [49]'
[INFO ] [luceedebug] instrumented PageContextImpl <clinit> called spawnWorker...
[INFO ] [luceedebug] attempting jdwp self connect to jdwp on localhost:9999...
[ERROR] java.lang.NoClassDefFoundError: com/sun/jdi/Bootstrap
[ERROR]         at luceedebug.coreinject.DebugManager.getConnector(DebugManager.java:76)
[ERROR]         at luceedebug.coreinject.DebugManager.jdwpSelfConnect(DebugManager.java:89)
[ERROR]         at luceedebug.coreinject.DebugManager.spawnWorker(DebugManager.java:62)
[ERROR]         at luceedebug.LuceeTransformer.transform(LuceeTransformer.java:108)
[ERROR]         at java.instrument/java.lang.instrument.ClassFileTransformer.transform(Unknown Source)
[ERROR]         at java.instrument/sun.instrument.TransformerManager.transform(Unknown Source)
[ERROR]         at java.instrument/sun.instrument.InstrumentationImpl.transform(Unknown Source)
[ERROR]         at java.base/java.lang.ClassLoader.defineClass1(Native Method)
[ERROR]         at java.base/java.lang.ClassLoader.defineClass(Unknown Source)
[ERROR]         at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.defineClass(BundleWiringImpl.java:2312)
[ERROR]         at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.defineClassParallel(BundleWiringImpl.java:2130)
[ERROR]         at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.findClass(BundleWiringImpl.java:2064)
[ERROR]         at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1533)
[ERROR]         at org.apache.felix.framework.BundleWiringImpl.access$300(BundleWiringImpl.java:78)
[ERROR]         at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1950)
[ERROR]         at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
[ERROR]         at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
[ERROR]         at java.base/java.lang.Class.privateGetDeclaredMethods(Unknown Source)
[ERROR]         at java.base/java.lang.Class.getMethodsRecursive(Unknown Source)
[ERROR]         at java.base/java.lang.Class.getMethod0(Unknown Source)
[ERROR]         at java.base/java.lang.Class.getMethod(Unknown Source)
[ERROR]         at lucee.loader.engine.CFMLEngineFactory.getEngine(CFMLEngineFactory.java:1468)
[ERROR]         at lucee.loader.engine.CFMLEngineFactory.initEngine(CFMLEngineFactory.java:384)
[ERROR]         at lucee.loader.engine.CFMLEngineFactory.initEngineIfNecessary(CFMLEngineFactory.java:262)
[ERROR]         at lucee.loader.engine.CFMLEngineFactory.getInstance(CFMLEngineFactory.java:168)
[ERROR]         at lucee.loader.engine.CFMLEngineFactory.getInstance(CFMLEngineFactory.java:202)
[ERROR]         at lucee.loader.servlet.LuceeServlet.init(LuceeServlet.java:42)
[ERROR]         at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117)
[ERROR]         at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:309)
[ERROR]         at io.undertow.servlet.core.ManagedServlet.createServlet(ManagedServlet.java:145)
[ERROR]         at io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:588)
[ERROR]         at io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:559)
[ERROR]         at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
[ERROR]         at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
[ERROR]         at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
[ERROR]         at io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:601)
[ERROR]         at runwar.Server.createServletDeployment(Server.java:1360)
[ERROR]         at runwar.Server.startServer(Server.java:527)
[ERROR]         at runwar.Start.main(Start.java:51)
[ERROR] Caused by: java.lang.ClassNotFoundException: com.sun.jdi.Bootstrap not found by lucee.core [49]
[ERROR]         at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1565)
[ERROR]         at org.apache.felix.framework.BundleWiringImpl.access$300(BundleWiringImpl.java:78)
[ERROR]         at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1950)
[ERROR]         at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
[ERROR]         ... 39 more
[INFO ] Runwar: ******************************************************************************
[INFO ] Runwar: *** stopping server '[email protected]' (socket 23482)
[INFO ] Runwar: ******************************************************************************
@jamiejackson
Copy link
Contributor Author

Solved. It was another CommandBox learning opportunity. :-/

Turns out javaVersion defaults to a JRE, unless you explicitly append _jdk.

{
    "name":"[email protected]",
    "jvm":{
        "args":[
            "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=localhost:9999",
            "-javaagent:C:/Users/jamie/projects/luceedebug/luceedebug/build/libs/luceedebug.jar=jdwpHost=localhost,jdwpPort=9999,debugHost=0.0.0.0,debugPort=10000,jarPath=C:/Users/jamie/projects/luceedebug/luceedebug/build/libs/luceedebug.jar"
        ],
        "javaVersion":"openjdk11_jdk"
    },
    "app":{
        "cfengine":"[email protected]"
    }
}

@jamiejackson
Copy link
Contributor Author

jamiejackson commented Dec 30, 2022

I posted more information here: #23 (comment)

My takeaway is that it could be good idea to have a CommandBox and/or docker example since I didn't find it straightforward.

I can work on that if you're game.

@carehart
Copy link

Did anything ever come of this, @jamiejackson? I'd think a large percent of the luceedebug audience would ALWAYS welcome any more info on using it with Commandbox. :-)

@psarin
Copy link

psarin commented Feb 18, 2024

With CommandBox 6 (Mac/Docker), I had to:

  1. Modify Docker files to manually install openjdk11 as using the above "javaVersion": "openjdk11_jdk" server.json option didn't work.
    • Apparently, Ortus uses Adoptium API for d/l java and Adoptium has archived openjdk11_jdk for ARM. CommandBox can't find it.
    • Code I added to my Dockerfile:
# Following command since update-alternatives for openjdk-11 install uses this directory
RUN mkdir -p /usr/share/man/man1

# Add ca-certificates-java to prevent a no certs found error for install of openjdk-11
RUN apt-get update -y && \
	apt-get install -y openjdk-11-jdk ca-certificates-java && \
	rm -rf /var/lib/apt/lists/*
  1. Then, for server.json:
"jvm":{
        "heapSize":512,
        "minHeapSize":256,
		"javaHome":"/usr/lib/jvm/java-11-openjdk-arm64",
		"args":[
			"-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=localhost:9999",
			"-javaagent:/app/debug/luceedebug.jar=jdwpHost=localhost,jdwpPort=9999,debugHost=0.0.0.0,debugPort=10000,jarPath=/app/debug/luceedebug.jar"
		]
    }
  1. Celebration!

Hope this helps someone! Thank you for developing luceedebug - I think it will be quite helpful to our team! Let us know how we can contribute to your efforts.

@softwareCobbler softwareCobbler changed the title Issues with CommandBox on Windows Use with CommandBox Feb 19, 2024
@softwareCobbler softwareCobbler pinned this issue Feb 19, 2024
@softwareCobbler softwareCobbler changed the title Use with CommandBox Usage with CommandBox Feb 19, 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

No branches or pull requests

3 participants