Archive for category Things I Learned Today

Getting JBossWS working with JDK 6

See https://jira.jboss.org/jira/browse/JBWS-1439 for more details, but essentially, there are some classpath issues with an out of the box JBoss 4.2.x and jdk6 when trying to use JBossWS (Implementation of JAX-WS stack in JBoss Application Server.)

If you run into these problems, there is a simple fix. Copy the conflicting jars into the endorsed directory:

cp -t $JBOSS_HOME/lib/endorsed $JBOSS_HOME/server/all/lib/jboss-jaxrpc.jar \
  $JBOSS_HOME/server/all/lib/jboss-saaj.jar

Fixing the wsdl soap address brokenness

Another problem you might run into is that the default wsdl generated will end up using whatever hostname JBoss thinks it is. This is not necessarily the hostname that is accessible remotely.

To get around this, modify:

$JBOSS_HOME/server/$instanceName/deploy/jbossws.sar/jbossws.beans/META-INF/jboss-beans.xml

By commenting out the webServiceHost property in WSServerConfig

Tags: , , , ,

Tracing uncaught exceptions in xcode

One of the annoyances I had with doing iPhone development in Xcode, besides for the fact that it is not eclipse, or that editing multiple source files means having windows strewn about (as opposed to a nice tabbed interface), was that whenever I introduced a bug that caused an Uncaught Exception (i.e. TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION) to be thrown, I’d be lost trying to trace its origin.  Java stacktraces have line numbers and all, which in Eclipse, takes me directly to the offending location.  Easy.

This guy figured out how to get similar behavior in Xcode.

In the event that the referenced blog entry ever goes away… You need to add an objc_exception_throw breakpoint to your global breakpoints.

Why this isn’t configured as such out of the box, I don’t know.

Tags: , , ,

Re-configuring JBoss RewriteValve without restarting

At my company, I often make use of the wonderful Rewrite Valve that comes with JBoss Web.  This is very similar to mod_rewrite that you’d use with Apache Httpd, but instead applicable to your JBoss/Tomcat install.  I find it very handy for rewriting short urls outside of your app’s context root.

For instance, how else would I have http://host/a123 really be processed by http://host/MyApp/Processor.action?id=123?  I won’t get into the specifics of configuring tomcat valves or, in particular, this one, but I will briefly touch on something I previously thought was not possible:  Making changes to a running configuration without incurring the downtime of performing a jboss restart.

Assuming that your rewrite valve is configured in your jboss.web engine’s default hostname (i.e. the valve is configured in /Server/Engine/Host/ in $JBOSS_HOME/server/$INSTANCE/deploy/jboss-web.deployer/server.xml) you’d do the following.  I’m using JBoss 4.2.3GA btw.

$JBOSS_HOME/bin/twiddle.sh -s localhost:$JMX_PORT \
  set 'jboss.web:host=$ENGINE_HOST,name=RewriteValve,type=Valve' configuration \
  "$(cat $JBOSS_HOME/server/$INSTANCE/conf/jboss.web/$ENGINE_HOST/rewrite.properties)"

My variables:

JMX_PORT=1099
INSTANCE=default
ENGINE_HOST=localhost

You should then see the configuration print to STDOUT, and the changes will be active.

It would be great if you could do this from the JMX console.  Unfortunately, browsers hose the newlines in your rewrite rules (pretty important) and there’s a bug in the getter implementation of the RewriteValve that might mess things up.

Tags: