Skip to content

Ramblings

Musings of Matt Williams
  • Blog
  • About
  • Chibi
  • Ruby Blender
  • Archives
  • Log in
 
Less
More
Trim
Untrim
« Older
Home
Loading
Newer »
Archive for the 'jboss' Category
04Nov10 JBoss Client Jars for Messaging
jboss
2 Comments

Prior to JBoss 5, the jboss-all-client.jar was pretty much all you needed. However, the JBoss 5 Getting Started Guide states the following:

The client/jbossall-client.jar library that used to bundle the majority of jboss client libraries, is now referencing them instead through the Class-Path manifest entry. This allows swapping included libraries (e.g. jboss-javaee.jar) without having to re-package jbossall-client.jar. On the other hand, it requires that you have jbossall-client.jar together with the other client/*.jar libraries, so they can be found.

In order to access JBoss Messaging from a remote client, you need the following jars in the client’s CLASSPATH:

  • $JBOSS_HOME/client/jnp-client.jar
  • $JBOSS_HOME/client/jboss-javaee.jar
  • $JBOSS_HOME/client/jboss-messaging.jar
  • $JBOSS_HOME/client/jboss-remoting.jar
  • $JBOSS_HOME/client/jboss-serialization.jar
  • $JBOSS_HOME/client/javassist.jar
  • $JBOSS_HOME/client/jboss-aop-client.jar
  • $JBOSS_HOME/client/trove.jar
  • $JBOSS_HOME/client/log4j.jar
  • $JBOSS_HOME/client/jboss-logging-spi.jar
  • $JBOSS_HOME/client/jboss-logging-log4j.jar
  • $JBOSS_HOME/client/jboss-common-core.jar
  • $JBOSS_HOME/client/jboss-mdr.jar
  • $JBOSS_HOME/client/concurrent.jar
09Jun10 Torquebox and Cygwin: Take I
gotchas jboss jruby rails torquebox
0 Comments

Torquebox and Cygwin don’t work as nicely together as one might hope.

That said, here are a couple of findings:

  1. In order to deploy, you need to set the $JBOSS_HOME with the Windows path.  You can do this via export JBOSS_PATH=`cygpath -w PATH_TO_JBOSS`.
  2. Additionally, the JRUBY_HOME needs to be a windows path as well.   Otherwise you will see:

    org.jruby.exceptions.RaiseException: no such file to load — date

That’s it so far, more to follow as discovered….

25Aug09 Using jnp as a JBoss heartbeat
Computers jboss jruby
0 Comments

jnp is a JBoss protocol which exposes jndi.  It is, by default, bound to port 1099.  I’d been using that port as a heartbeat, but “cheating” — I would open a socket and then close it immediately.  However, this caused problems.  jnp is chatty.  And it got upset at my not letting it say ‘hi’ before I dropped the connection.   So, here’s a code snippet (jruby, the Java should be an exercise for the student) which allows you to actually do an intelligent check.

  def check_port(server)
    @logger.debug "check_port: #{server.fqdn}(#{server.host}:#{server.port})"
    begin

      env = java.util.Properties.new();
      env.set_property("java.naming.factory.initial",
                       "org.jnp.interfaces.NamingContextFactory");
      env.set_property("java.naming.provider.url",
                       "#{server.host}:#{server.port}");
      ctx = javax.naming.InitialContext.new(env);

      # if the server is not running, we'll get an error here because
      # it will timeout.
      ctx.list("")
      ctx.close
      @logger.debug "check_port: #{server.fqdn}(#{server.host}:#{server.port}): Succeeded"
    rescue javax.naming.CommunicationException => comm_error
      @logger.debug "check_port: #{server.fqdn}(#{server.host}:#{server.port}): Not Running"
      begin
        ctx.close
      rescue Exception => ignore_me
      end
      return false

    rescue Exception => e2
      @logger.info "check_port: #{server.fqdn}(#{server.host}:#{server.port}): FAILED: #{e2.to_s}"
      return false
    end
    return true
  end
Enhanced by Zemanta
29Jul09 JBoss port confusion
gotchas jboss
0 Comments

We ran into a case where JBoss was unable to come up; it gave the following (partial) exception:

java.rmi.server.ExportException: Port already in use: 1098; nested exception is:
java.net.BindException: Cannot assign requested address

After poking around with netstat and lsof, we couldn’t find anything that was binding to the port.  I’d made the assumption that it was bound, totally missing the next line.  As it turns out, we were attempting to bind to a vip which, although it existed in DNS, was not defined on the host on which the error occurred.  The “cannot assign requested address” was the clue.

Enhanced by Zemanta
17Dec08 JBoss and Sesame Street’s Count
jboss tips
0 Comments

One, One database record!
Two, Two database record!
Muahahaha!

By default, when using datasources with JBoss, it does a count to validate a connection, both on creation and when it is requested from the connection pool.  It looks something like:

select count(*) from x

Now, this can take take a while when working with tables containing 1.8 million rows and growing.  That said, the datasource config file has two properties which can be set:

  • new-connection-sql
  • check-valid-connection-sql

These allow you to specify something like

count 1 from x

which runs a good bit faster.

25Sep08 JBoss run.sh may be harmful
gotchas jboss
0 Comments

A coworker and I discovered an issue with jboss’ run.sh (which starts the app server).  The problem lies in different flavours of unix (or unix-like) shells returning different values for wait.

The relevant code is:

      # Wait until the background process exits
      WAIT_STATUS=0
      while [ "$WAIT_STATUS" -ne 127 ]; do
         JBOSS_STATUS=$WAIT_STATUS
         wait $JBOSS_PID 2>/dev/null
         WAIT_STATUS=$?
      done

This is all well and good in linux — redhat uses /bin/bash and ubuntu uses /bin/dash for /bin/sh — both of which return 127 when waiting for a process which does not exist. However, Solaris’ /bin/sh returns 0 (/bin/ksh returns 127).

So, the run.sh goes into an infinite loop, thrashing, badly. CPU gets pegged and all that fun stuff.

How to fix? Well in order to make it OS/shell dependant, we'll determine the value which is returned by wait when a process does not exist. We're guaranteed that there is one process id which won't be used in unix -- 0. So, we wait on PID 0, and use the return value, $? to determine how the environment handles the wait. The "fixed" code looks like:

      wait 0 2>/dev/null
      NO_SUCH_PID=$?
      # Wait until the background process exits
      WAIT_STATUS=0
      while [ "$WAIT_STATUS" -ne $NO_SUCH_PID ]; do
         JBOSS_STATUS=$WAIT_STATUS
         wait $JBOSS_PID 2>/dev/null
         WAIT_STATUS=$?
      done

EDIT:
This was fixed in 4.2.3 GA with the following code:

# Wait until the background process exits
      WAIT_STATUS=128
      while [ "$WAIT_STATUS" -ge 128 ]; do
         wait $JBOSS_PID 2>/dev/null
         WAIT_STATUS=$?
         if [ "${WAIT_STATUS}" -gt 128 ]; then
            SIGNAL=`expr ${WAIT_STATUS} - 128`
            SIGNAL_NAME=`kill -l ${SIGNAL}`
            echo "*** JBossAS process (${JBOSS_PID}) received ${SIGNAL_NAME} signal. ***" >&2
         fi
      done
      if [ "${WAIT_STATUS}" -lt 127 ]; then
         JBOSS_STATUS=$WAIT_STATUS
      else
         JBOSS_STATUS=0
      fi
 
Browse Archives »
  • administrivia (6)
  • books (1)
  • Computers (2)
  • css (3)
  • eating crow (1)
  • games (1)
  • glassfish (1)
  • gotchas (18)
  • howto (2)
  • idiocy (3)
  • javascript (4)
  • jboss (6)
  • jruby (7)
  • Just Enough Programming (7)
  • life hacking (2)
  • mini sagas (1)
  • miscellany (1)
  • monitoring (1)
  • mysql (1)
  • philosophy (4)
  • php (1)
  • programming (17)
  • rails (7)
  • rants (2)
  • refactoring (1)
  • ruby (14)
  • tips (9)
  • tools (2)
  • torquebox (1)
  • Uncategorized (9)
  • UNIX (1)
  • utilities (3)
  • web (5)
  • web design (3)
 

Latest

  • JBoss Client Jars for Messaging
  • rsh hates nohup
  • Torquebox and Cygwin: Take I
  • Rails & JRuby in a Jar
  • Fractal Terrain Generation
  • Quick thought on programming and distractions
  • Using jnp as a JBoss heartbeat
  • z-index and events
  • JBoss port confusion
  • SSL Joys

Flickr

layout_newm3headerTerrain Testa

Blogroll

  • Development Blog
  • Documentation
  • Plugins
  • Suggest Ideas
  • Support Forum
  • Themes
  • WordPress Planet

Search

Browse by Category

  • administrivia (6)
  • books (1)
  • Computers (2)
  • css (3)
  • eating crow (1)
  • games (1)
  • glassfish (1)
  • gotchas (18)
  • howto (2)
  • idiocy (3)
  • javascript (4)
  • jboss (6)
  • jruby (7)
  • Just Enough Programming (7)
  • life hacking (2)
  • mini sagas (1)
  • miscellany (1)
  • monitoring (1)
  • mysql (1)
  • philosophy (4)
  • php (1)
  • programming (17)
  • rails (7)
  • rants (2)
  • refactoring (1)
  • ruby (14)
  • tips (9)
  • tools (2)
  • torquebox (1)
  • Uncategorized (9)
  • UNIX (1)
  • utilities (3)
  • web (5)
  • web design (3)

Browse by Tag

  • 1.2.6
  • 2.1
  • administrivia
  • autotest
  • books
  • controller
  • css
  • feed-normalizer
  • feeds
  • gotchas
  • idiocy
  • irb
  • Java
  • javascript
  • jboss
  • jruby
  • just enough programming
  • mini sagas
  • open-uri
  • philosophy
  • php
  • pragmatism
  • programming
  • quotations
  • rails
  • rants
  • reading
  • restful_authentication
  • rspec
  • rss
  • ruby
  • rubygems
  • scriptaculous
  • setup
  • simplicity
  • sprites
  • statemachine
  • tips
  • treetop
  • utilities
  • web
  • web design
  • websense
  • yaml
  • zentest

Browse by Month

  • November 2010 (1)
  • August 2010 (1)
  • June 2010 (1)
  • March 2010 (1)
  • September 2009 (1)
  • August 2009 (2)
  • July 2009 (2)
  • May 2009 (1)
  • April 2009 (1)
  • February 2009 (4)
  • January 2009 (2)
  • December 2008 (2)
  • November 2008 (5)
  • October 2008 (3)
  • September 2008 (12)
  • August 2008 (28)
 
 
  • Blog
  • About
  • Chibi
  • Ruby Blender
  • Archives
  • Log in
 


Theme Design by Jay Kwong | Powered by WordPress and K2

 

Home Top Archives Entries FeedComments Feed