When my wildfly 8.1.0 server starts up, it should create an instance of a class.
I'm not sure whether that's happening or not, and I'm unable to change the source code, so I figured I would use Byteman to accomplish this.
I wrote this rule file for Byteman, stored at C:\app\ECLSManagedConnectionFactory.btm
:
RULE trace ECLSManagedConnectionFactory init entry
CLASS com.empolis.ecls.server.j2ee.jca.impl.ECLSManagedConnectionFactory
METHOD <init>
AT ENTRY
IF true
DO traceOpen("ECLSManagedConnectionFactory", "/app/ECLSManagedConnectionFactory.log");
traceln("entering <init>");
traceClose("ECLSManagedConnectionFactory");
ENDRULE
I downloaded Byteman and unzipped it to C:\byteman-3.0.3
.
I modified my java_opts
and have wildfly echo the value during startup:
-Xms64m -Xmx512m -XX:MaxPermSize=256m
-Dorg.jboss.byteman.transform.all
-javaagent:C:/byteman-3.0.3/lib/byteman.jar=script:C:/app/ECLSManagedConnectionFactory.btm,boot:C:/byteman-3.0.3/lib/byteman.jar:listener:true
-Dsun.rmi.dgc.client.gcInterval=3600000
-Dsun.rmi.dgc.server.gcInterval=3600000
-Djava.net.preferIPv4Stack=true
-Dorg.jboss.resolver.warning=true
-Djboss.modules.system.pkgs=org.jboss.byteman
-Djboss.server.default.config=cls.xml
My server successfully starts up if lines 2 and 3 of my java_opts
above aren't present, but the moment I add those in, the server simply doesn't start. Nothing to indicate what's happening goes to stdout or stderr. I get a message saying to check server.log
for more info, but that file doesn't exist.
What am I doing wrong? I've tried every combination of slash directions for the paths (on Windows 10 if that's important).
Does anyone actually use this byteman
tool? I'm surprised it doesn't have a tag on Stack Overflow and that there's so little information available on it online.
The issue was this line:
-javaagent:C:/byteman-3.0.3/lib/byteman.jar=script:C:/app/ECLSManagedConnectionFactory.btm,boot:C:/byteman-3.0.3/lib/byteman.jar:listener:true
This should have been a comma ^
Ditch the drive names, and put a comma between the boot jar and listener:true. Like this:
-javaagent:/byteman-3.0.3/lib/byteman.jar=script:/app/ECLSManagedConnectionFactory.btm,boot:/byteman-3.0.3/lib/byteman.jar,listener:true
This has been fixed - it is a comma as it should be ^