Debugging a JAR file

kirkr
Tera Expert

I've built a fairly simple JAR file that will be used to pull external credentials. This all works locally on development workstations, but deploying the JAR to a MID Server will fail to retrieve a credential.

Are there any methods that can be used to debug what is going on, even to just log output anywhere?

I've attempted to write to a file on the MID Server, but it's not being written to. Any suggestions on debugging?

1 ACCEPTED SOLUTION

Dave Smith1
ServiceNow Employee
ServiceNow Employee

That all sounds fine.   Did you compile the new JAR under the same environment as the MID (32bit, 64bit, etc)...?   Did you check it appears in "extlib" directory?



Also, checked the MID logs themselves to see what it's reported when attempting to use the JAR?   I think if it uses standard Java logging (log4j?) then something will be passed through to platform or MID logs.



I'll agree that it's a pain no drivers/struts are provided for a test harness for this particular JAR file. I really ought to knock one up.


View solution in original post

7 REPLIES 7

adamjgreenberg
ServiceNow Employee
ServiceNow Employee

You would need to hook in eclipse, netbeans or similar in order to properly debug a JAR.



java - Debugging jar file with source code attached in eclipse - Stack Overflow


Dave Smith1
ServiceNow Employee
ServiceNow Employee

I've built a fairly simple JAR file that will be used to pull external credentials.


How does it compare to the example JAR file that's used for Discovery's external credential storage?



deploying the JAR to a MID Server will fail to retrieve a credential.


The MID expects specific behaviour from the JAR.   How did you deploy it?


The JAR is similar to the example one at External credential storage configuration. The resolve() method has the same signature, as the example one, but the main change made is to the loadProps() method to retrieve from an encrypted file.



The JAR was deployed via the MID Server > JAR Files module.



The example JAR setup works fine, just not sure how to feasibly debug the custom one.


Dave Smith1
ServiceNow Employee
ServiceNow Employee

That all sounds fine.   Did you compile the new JAR under the same environment as the MID (32bit, 64bit, etc)...?   Did you check it appears in "extlib" directory?



Also, checked the MID logs themselves to see what it's reported when attempting to use the JAR?   I think if it uses standard Java logging (log4j?) then something will be passed through to platform or MID logs.



I'll agree that it's a pain no drivers/struts are provided for a test harness for this particular JAR file. I really ought to knock one up.