SKM IT World

Just another blog about IT


1 Comment

How To Debug Groovy Script From Shell

Groovy is a scripting language, so it is possible to run Groovy code without compiling to Java byte code. The necessary condition is that Groovy is installed on your machine. Then, running a Groovy script in a shell looks like the following line.


~>groovy TestScript.groovy

Now, something is wrong with the script, only on a special environment. So you want to debug your Groovy script from the shell. Fortunately, it works for Groovy just like for Java. You only have to export the Java options for debugging.


~>export JAVA_OPTS="-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=y"

Now, we can debug our script running from the shell with our favorite IDE.


~>groovy TestScript.groovy
Listening for transport dt_socket at address: 4000

Advertisements


Leave a comment

Distinctive Feature of Running Nexus on Linux

I installed Nexus on Linux according to the step-by-step instruction of Sonatype. Everything looked fine during the installation. To find out, whether the installation was successful, I tried to go to the welcome page of my nexus installation. I got an error message. I looked in the log file of Nexus and found following exception:

 com.google.inject.internal.ComputationException: com.google.inject.internal.ComputationException: java.lang.TypeNotPresentException: Type org.codehaus.enunciate.contract.jaxrs.ResourceMethodSignature not present
 ....

ERROR [er_start_runner] - /nexus - unavailable java.lang.IllegalStateException: The PlexusServerServlet couldn't lookup the target component (role='org.restlet.Application', hint='nexus')

With Google’s help I found a fixed bug in the Nexus bug tracking system, that describes my problem. The reason for my problem was:
I had on my Linux machine an IBM JVM in an elder version. With this version Nexus doesn’t run because of a bug in the IBM JVM.  Two solutions and one workaround exist for this problem:

  • Workaround: Copying enunciate-core-*.jar to /runtime/apps/nexus/lib.
  •  First solution: Update the version of IBM JVM to 5.0.0 SR12 / 6.0.0 SR8 FP1 or later
  •  Second solution: Use the JVM of Oracle.

I decided to change the JVM to an Oracle JVM and after that, Nexus ran without errors.

Links:

  1. Installation Guide for Nexus by Sonatype
  2. Bug reported to Nexus 
  3. Bug reported to IBM