The best place to ask programming/development questions, imo. UPDATE: stackoverflow is the *worst* place to *ask* questions (if your first question/comment doesn't get any up-rating/response, then u can't ask anymore questions--ridiculously unrealistic), but a great reference for finding answers.

My Music (Nickleus)

20140416

jboss 8 wildfly: AIO wasn't located on this platform, it will fall back to using pure Java NIO. If your platform is Linux, install LibAIO to enable the AIO journal

noticed this warning in my eclipse console when i started up jboss 8:

09:56:37,832 WARN  [org.jboss.as.messaging] (MSC service thread 1-8) JBAS011600: AIO wasn't located on this platform, it will fall back to using pure Java NIO. If your platform is Linux, install LibAIO to enable the AIO journal


the libaio-dev library made the warning go away (ubuntu 13.04--yeah, still haven't upgraded):
sudo apt-get install libaio-dev


NIO means New I/O:
"a collection of Java programming language APIs that offer features for intensive I/O operations"

but why would jboss want me to install linux libs instead of "pure Java NIO"?

"The Java NIO journal gives great performance, but If you are running HornetQ using Linux Kernel 2.6 or later, we highly recommend you use the AIO journal for the very best persistence performance."

http://hornetq.sourceforge.net/docs/hornetq-2.1.2.Final/user-manual/en/html/persistence.html#installing-aio


"Using the operating system's own asynchronous I/O provides the best possible performance and scalability."
(Exploiting HornetQ's Support of Linux's Native Asynchronous I/O)


see also Java.nio vs Java.io

20140409

jboss 8 wildfly startup errors (WARN), jrebel 5.5.2 and how to debug/resolve: Failed to define class X, Failed to link X, NoClassDefFoundError, ClassNotFoundException

at work we're in the process of migrating from jboss 7 to 8 (wildfly/undertow) and i've had trouble starting the server when "JRebel agent" is enabled (v5.5.2). i get tons of WARN msgs like this:

15:08:21,372 WARN  [org.jboss.modules] (MSC service thread 1-8) Failed to define class net.sourceforge.barbecue.BarcodePortlet in Module "deployment.myApp.ear:main" from Service Module Loader: java.lang.LinkageError: Failed to link net/sourceforge/barbecue/BarcodePortlet (Module "deployment.myApp.ear:main" from Service Module Loader)
...
    Caused by: java.lang.NoClassDefFoundError: javax/portlet/GenericPortlet
...
    Caused by: java.lang.ClassNotFoundException: javax.portlet.GenericPortlet from [Module "deployment.takecargo.ear:main" from Service Module Loader]



HOW TO DEBUG

using the above WARN as an example, open a java file in your project and write something like this:
BarcodePortlet a = null;

save

ctrl+shift+o

if it resolves (adds an import line), then you have a library somewhere in your project that has that class file.

put the cursor on the class name, BarcodePortlet, then hit f3 to find the jar library, e.g.:
barbecue-1.5-alpha2.jar

in eclipse project settings:
"Java Build Path" > "Libraries" (tab) > select "barbecue-1.5-alpha2.jar" and hit "Remove" > "OK"

if you get errors in the "Markers" tab, under "Java Problems", then you need the library.
if you don't get any errors, then search your project in *.java and *.xml files to see if the class or package is referenced there. if you still don't find anything then you *probably* don't need it and can delete it from your project.

in my case, some classes were using "barbecue-1.5-alpha2.jar", so then we look at the next related stack trace element in the output console in eclipse:

Caused by: java.lang.NoClassDefFoundError: javax/portlet/GenericPortlet


there wasn't any module in the jboss wildfly modules folders for "javax/portlet":

<wildfly-8.0.0.Final>/modules/system/layers/base/javax


so i needed to find a jar library, by googling, that has the class "javax.portlet.GenericPortlet", e.g. here:
http://mirrors.ibiblio.org/pub/mirrors/maven2/javax/portlet/portlet-api/2.0/portlet-api-2.0.jar

i added "portlet-api-2.0.jar" to my eclipse project's "lib" folder (or wherever you place your jars to be bundled in your ear)

refreshed the "lib" folder in eclipse

added the jar to the "Libraries" tab:
"Java Build Path" > "Libraries" (tab) > "Add JARs..." > selected "portlet-api-2.0.jar" from the "lib" folder > "OK"

the project rebuilds automatically and no errors occurred from adding the jar, so we're good.

if you rebuild your project and start up wildfly, then that "WARN" should be gone from the output.


20140403

[SOLVED] sahi (OS v4.4) "did not complete in 150"

i upgraded from sahi v3.5 to v4.4 and when i ran one of my scripts, sahi would hang after logging into the application i'm testing, and after waiting a while, it would finally return this error message:
"did not complete in 150"

i had stumbled across something similar to this before and had documented it here: sahi how to test gmail

that gave me some clues about what to do to fix it:
1. make sure all the https sites in SSL Manager were displayed with a green checkmark, instead of a red dot.

in my case, "localhost" had a red dot, but when i clicked on "localhost", there was no way to accept the self-signed SSL certificate permanently--i only saw this in the iframe:

localhost uses an invalid security certificate. The certificate is not trusted because it is self-signed. (Error code: sec_error_ca_cert_invalid)

so i had to open a new browser tab at this address:
https://localhost

then i could accept the certificate.

2. then, as an educated trial-and-error guess attempt, i found out i needed this line, in userdata.properties, to fix it entirely:

xhr.wait_ready_states=2

20140402

[SOLVED] sahi _setSelected not working with primefaces 4, but works with richfaces 3. workaround

back when we were using richfaces 3, this code worked fine:
_setSelected(_select("myForm:ChrgTrsTbl:0:price_chargeCode_input"), "CustClearance");

but it doesn't seem to work with primefaces 4. this, however, seems to work fine:

_click(_listItem("CustClearance"));