JBoss 4.0.5: javax.naming.NamingException: Could not dereference object

If you experience such an error it is very well based on having the JBoss server and/or the clients started using JDK 6.0. Some more explanations can be found in JBoss Forum topics here and here.

Sometimes I run in this problem as my production systems still use JBoss 4.0.5 GA. Beginning with JBoss 4.2.0GA this error should not appear anymore. Sometime in future I will update my servers. Until then, I will stick with JDK 1.5.0.

Snow Leopard: MyEclipse, Subeclipse and Java 6

Having moved from Mac OS X 10.5 (Leopard) to Mac OS X 10.6 (Snow Leopard), the Subversion integration into MyEclipse IDE 7.5 using Subeclipse did not work any more. More precisely, when opening the repository item in the SVN Repositories view, I got the dialog

Screen shot1

and an error message in the console saying

Screen shot 2

After trying to remove and reinstall the Subeclipse plugin without any improvement, I found a solution solving my problem after installing and using the JDK Version 1.5. For a detailed description look here: Snow Leopard and MyEclipse Fix Resolution and here http://wiki.oneswarm.org/index.php/OS_X_10.6_Snow_Leopard.

After installing the JDK 1.5, just move the J2SE 5.0 32-bit in front of the Java SE 6 32-bit within the Java Preferences utility. The 64-bit JDKs are not taken into account (yet) and can be left even on top of the 32-bit JDKs.

If you use the encryption API of Java, make sure you download and install the Unlimited Strength Jurisdiction Policy Files in the appropriate directory:

/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0-leopard/Home/lib/security

Otherwise you might get errors like

java.security.InvalidKeyException: Illegal key size or default parameters

Good luck.

Optional ant tasks in separate build.xml file invoked with Maven AntRun plugin

In a legacy development project, ant build.xml files are used for compilation and packaging. To integrate new features more easily, I decided to use Maven and the AntRun plugin. The original targets can simply be invoked as it is explained in the examples.

However, if you want to use taks not included in the default jar, e.g. the optional ant tasks, you have to correctly add the dependencies to the AntRun plugin. Unfortunately, I moved the dependencies to the global section of my pom.xml. This mistake took me a quite some time to fix, as I simply oversaw it. 🙁

Just make sure, it looks like this:

<plugin>
  <artifactId>maven-antrun-plugin</artifactId>
  <dependencies>
    <dependency>
      <groupId>org.apache.ant</groupId>
      <artifactId>ant-nodeps</artifactId>
      <version>1.7.0</version>
    </dependency>
  </dependencies>
  <executions>
    <execution>
    ...
    </execution>
  </executions>
</plugin>

Lotus Notes 8.5 can not delete attachments anymore

I recently upgraded my Lotus Notes client on my Mac to version 8.5. In the previous releases, it was possible to select an attachment, right click and say “Save and Delete …”. Now, this option is grayed out when the mail has it’s origin outside of the organisation. The workaround I found is the following:

  1. Put the message into edit mode
  2. Save the attachment as usual
  3. Hit the delete button on the keyboard while the attachment is still highlighted.

There you go…

Writing udev rules to create symbolic link for Huawei E220 USB GSM/UMTS Modem

On an Ubuntu 8.04 server, I connected a Huawei USB modem to send SMS using SMSLib. Normally, the modem interface can be found under /dev/ttyUSB0. For some reason, the system decided to mount the modem interface using /dev/ttyUSB1. To avoid to always reconfigure SMSLib, if such a change occurs, I decided to use udev rules to create a specific symlink for the modem interface.

1. Check with lsusb if the device is connected:

prompt> lsusb
Bus 005 Device 005: ID 12d1:1003 Huawei Technologies Co., Ltd. E220 HSDPA Modem
....

2. Somewhere in /var/log/messages you should find an information, to which devices the different ports of the modem have been mapped to. In my case, it is:

Jul  9 08:50:07 server kernel: [4378805.151459] usb 5-5.1: airprime converter now attached to ttyUSB1
Jul  9 08:50:07 server kernel: [4378805.151488] usb 5-5.1: airprime converter now attached to ttyUSB2
Jul  9 08:50:07 server kernel: [4378805.151513] usb 5-5.1: airprime converter now attached to ttyUSB3

3. After checking with minicom that ttyUSB1 is the correct port, I used

udevinfo -a -p $(udevinfo -q path -n /dev/ttyUSB1) > ttyUSB1.info
udevinfo -a -p $(udevinfo -q path -n /dev/ttyUSB3) > ttyUSB3.info

to retrieve information about the different device information stored in the udev database.  Simply running diff on the information shows you some hints, how to differentiate the devices and only create a symbolic link for one of those ports. In my case, the diff showed following results:

8,9c8,9
<   looking at device '/devices/pci0000:00/0000:00:1d.7/usb5/5-5/5-5.1/5-5.1:1.0/ttyUSB1/tty/ttyUSB1':
<     KERNEL=="ttyUSB1"
---
>   looking at device '/devices/pci0000:00/0000:00:1d.7/usb5/5-5/5-5.1/5-5.1:1.0/ttyUSB3/tty/ttyUSB3':
>     KERNEL=="ttyUSB3"
12c12
<     ATTR{dev}=="188:1"
---
>     ATTR{dev}=="188:3"

4. Using the information ATTR{dev}==”188:1″ and ATTRS{product}==”HUAWEI Mobile” in a parent device, I came up with the following udev rule that I put into /etc/udev/rules.d/98-modem.rules:

KERNEL=="ttyUSB*", ATTR{dev}=="188:1", ATTRS{product}=="HUAWEI Mobile", SYMLINK+="ttyS20"

According to the great tutorial Writing udev rules by Daniel Drake, it is not possible to mix attributes from different parent devices. This is why I used the ATTR{dev}==”188:1″ and not ATTRS{port_number}==”0″ as I already used ATTRS{product}==”HUAWEI Mobile” in a different parent device. (You could also ATTRS{idVendor}==”12d1″ and ATTRS{idProduct}==”1003″ to specify the modem instead of the product attribute.)

5. Simply let udev know about your newly created rule and check, if the system created the correct link:

promtp> sudo udevtrigger
prompt> ll /dev/ttyS20
lrwxrwxrwx 1 root root 7 2009-07-10 08:12 /dev/ttyS20 -> ttyUSB1

Now you can use the device /dev/ttyS20 in your SMSLib configuration. To be used in SMSLib, the symbolic link should be named to something resembling a standard serial port, like /dev/ttyS*. If you do not so, it is possible that SMSLib (or the used RXTX lib) does not correctly recognise the serial port. It my first try, I named the symbolic link /dev/huawei_modem. Minicom was fine with that, but SMSLib did not like it.