Can Java Logger do this: logger.fine("foo = " + bar)? - debugging

I am trying to debug the value of an object in EJB
If I do logger.fine("foo"), then I can see foo, but if I do logger.fine("foo = " + bar) then i cant see anything. So how do I debug in EJB? I am using netbean 6.8 btw

Are you sure bar.toString() is not throwing some runtime exception? Otherwise it should work.
Try a try...catch block around it to be sure.

Related

#fieldNameConstant in lombok and compile time error on its usage in #schema of Spring doc

I am using lombok 1.18.24 and have used #FieldNameConstants for using it in Spring-Documentatoin of APIs. It was working fine but sometimes gets compiler errors
'''
error: cannot find symbol
"Mandatory conditional when '" + ASC_RealTimeRevocationUpdateDTO.Fields.useRpHaSettings + "' is 'true'.Empty or null would cause errors:" +
^
symbol: variable Fields
location: class ASC_RealTimeRevocationUpdateDTO
'''
Unable to track why it happens sometimes but often works fine

How do I resolve oracle jdbc proxy class error in Evosuite generated tests?

I've written a JDBC driver and I'm trying to use Evosuite to generate the tests for it.
I'm using the following command line:
mvn -Dcores=5 -DmemoryInMB=5000 -Dmock_if_no_generator=false -DextraArgs=' -Dmock_if_no_generator=false -Dskip_covered=true Duse_separate_classloader=false -Dmax_recursion=50 -Dlocal_search_restore_coverage=true -Duse_existing_coverage=true -Dsandbox=false -Dsort_calls=true 'evosuite:generate
The code that is generated is below:
oracle.1jdbc.1replay.1driver.1NonTxnReplayableBase.2java.1sql.1DatabaseMetaData...Proxy oracle_1jdbc_1replay_1driver_1NonTxnReplayableBase_2java_1sql_1DatabaseMetaData___Proxy0 = new oracle.1jdbc.1replay.1driver.1NonTxnReplayableBase.2java.1sql.1DatabaseMetaData...Proxy((DatabaseMetaData) null, "k-{`1N&KKC", proxyFactory0, hashtable0);
and I'm getting the following error on the first line:
:[4618,7] not a statement
:[4618,13] ';' expected
(getting this error three times on the same line)
I was hoping to turn off the mocking but it didn't work it seems.
I'll try to see if I can provide more details later, but any initial thoughts from anyone?
Thanks!

Unable to run write-attribute in jboss EAP 6.3.3 CLI

I am trying to run the below java code in my custom app:
I am using JBoss EAP 6.3.3 with Java 1.8.0_92 have also used Java 7. This used to work in JBoss EAP 6.3.2 (java 7)
ccp = new CLICommandParser(standalone + "/subsystem=security/security-domain=EncryptDBPassword/authentication=classic:write-attribute"
+ "(name=login-modules,value=["
+ "{flag=required,code=org.picketbox.datasource.security.SecureIdentityLoginModule,"
+ "module-options=[(username=" + dbUser + "),(password=" + dbPassword + "),(managedConnectionFactoryName=jboss.jca:name=jdbc/fooDS),(service=XATxCM)]}"
+ "])");
ccp.execute(client, true);
The error I get is, the security domain gets security-domain gets added by fails in next line of code mentioned above.
INFONFO: Command executed sucessfully: /subsystem=security/security-domain=EncryptDBPasswordXA/authentication=classic:add
Exception in thread "main" java.lang.IllegalArgumentException
at org.jboss.dmr.ModelValue.addChild(ModelValue.java:120)
at org.jboss.dmr.ModelNode.add(ModelNode.java:1116)
at org.jboss.dmr.ModelNode.add(ModelNode.java:930)
at com.foo.org.App$CLICommandParser.getListArgs(App.java:1417)
at com.foo.org.App$CLICommandParser.getNameOrValue(App.java:1448)
at com.foo.org.App$CLICommandParser.getListArgs(App.java:1380)
at com.foo.org.App$CLICommandParser.getNameOrValue(App.java:1460)
at com.foo.org.App$CLICommandParser.getListArgs(App.java:1363)
at com.foo.org.App$CLICommandParser.getNameOrValue(App.java:1448)
at com.foo.org.App$CLICommandParser.getListArgs(App.java:1380)
at com.foo.org.App$CLICommandParser.setOPArgs(App.java:1344)
at com.foo.org.App$CLICommandParser.setCommand(App.java:1253)
at com.foo.org.App$CLICommandParser.<init>(App.java:1224)
at com.foo.org.App.addSecurity(App.java:492)
at com.foo.org.App.run(App.java:176)
at com.foo.org.App.main(App.java:54)
I can however run the same command in JBoss CLI and this works. Is there a change I need to do around the code, seems like patch 3 doesn't like to use "write-attribute" in JBoss CLI.
Any pointers will be grateful.

AdminTask.listTCPEndPoints('abc(abc)') throws exception: ADMF0007E: target object is required

I'm working on deploying application to WebSphere 7 using python script and the script is throwing exception at this line:-
AdminTask.listTCPEndPoints('abc(abc)')
If I run the above command before I run the python script, it works fine. It gives me an error ADMF0003E: Invalid parameter value. But the same command fails in the python script with this error:
wsadmin>AdminTask.listTCPEndPoints('abc(abc)')
WASX7015E: Exception running command: "AdminTask.listTCPEndPoints('abc(abc)')"; exception information: com.ibm.websphere.management.cmdframework.CommandValidationException: ADMF0007E: target object is required.
I can guess that there something in the python script that is causing this issue, but I don't understand why is the AdminTask.listTCPEndPoints command is not able to see the parameter being passed. I'm new to WebSphere, I have only used it in past but never configured it. Any help/insight would be highly appreciated.
Thanks!
Added stack trace of interactive mode option
wsadmin>print AdminTask.listTCPEndPoints('-interactive')
List NamedEndPoints that can be used by a TCPInboundChannel
Lists all NamedEndPoints that can be associated with a TCPInboundChannel
*TCPInboundChannel: abc(abc)
excludeDistinguished (excludeDistinguished): 0
WASX7435W: Value 0 is converted to a boolean value of false.
unusedOnly (unusedOnly): 0
WASX7435W: Value 0 is converted to a boolean value of false.
List NamedEndPoints that can be used by a TCPInboundChannel
F (Finish)
C (Cancel)
Select [F, C]: [F] F
WASX7278I: Generated command line: AdminTask.listTCPEndPoints('[-excludeDistinguished false -unusedOnly false]')
WASX7015E: Exception running command: "AdminTask.listTCPEndPoints('-interactive')"; exception information:
com.ibm.websphere.management.cmdframework.CommandValidationException: ADMF0007E: target object is required.
Follow this link. It appears that you have not specified the target object that's why that error is coming.
I suggest use the following command as a starter
print AdminTask.listTCPEndPoints('-interactive')
Note: Instead of copying and pasting the command, type it on the command line. sometimes command editor does not take the command after pasting it directly.
Okay, I was able to fix the error. I was getting that error because as part of the application deployment script, I was copying few of my application jars to WebSphere's java/jre/lib/ext directory so that those are available in classpath. In one of those jar, I had bundled an IBM class (Base64Coder.class) which was required by a class in my jar and it was corrupting the WebSphere AdminTask utility. When I removed that Base64Coder.class from my jar, python script worked fine. I believe, the reason it corrupted WebSphere was that there was a duplication of the same class in the JVM as the class comes with IBM WebSphere installation and was present in AppServer/runtimes/com.ibm.ws.webservices.thinclient_7.0.0.jar

ehcache help needed

Hello i am trying to setup Ehcache on my local system , There is only java based caching ,i am performing . I got the exception when i just ran the main method " 10:16:32,637 INFO [main] Main - javax.xml.transform.TransformerFactory=null
10:16:32,684 FATAL [main] Main - No embedded stylesheet instruction for file: file:/C:/workspaces/Ehacache/EhcacheTest/src/config/ehcache.xml
org.eclipse.wst.xsl.jaxp.debug.invoker.TransformationException: No embedded stylesheet instruction for file: file:/C:/workspaces/Ehacache/EhcacheTest/src/config/ehcache.xml
at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.transform(JAXPSAXProcessorInvoker.java:225)
at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.transform(JAXPSAXProcessorInvoker.java:186)
at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.Main.main(Main.java:73)
Caused by: org.eclipse.wst.xsl.jaxp.debug.invoker.TransformationException: No embedded stylesheet instruction for file: "
In my Code i have put only this in the main method
CacheManager cm = new CacheManager("src/config/ehcache.xml");
String[] test = cm.getCacheNames();
System.out.println(test.length);
and also in my src/config/ i have put only ehcache.xml. I didnot put ehcache.xsd, Do i need to mention that also
My take is that you are not running your Java class' main method, but Eclipse is trying to execute your ehcache.xml file. You need to make sure you run the correct target.

Resources