2 Replies Latest reply on Jul 21, 2003 12:43 PM by hoos

    Using JAVA Comm api with Jboss

    hoos

      Hello,
      I have a simple standalone application that uses JAVA Comm 2.0 to communicate with a serial port device.

      When I tried to port the application to an web app deployed in an EAR file calling:

      CommPortIdentifier.getPortIdentifiers()

      returns null rather than a list of ports.

      I guess the problem lies in the way the comm api has to be setup with Jboss (and possibly other J2ee containers). I have tried placing the comm.jar file in my webapps WEB-INF/lib dir and javax.comm.properties in multiple places within the war file, but no luck.

      Also I have placed those files under jboss/server/default/lib and changed the run.bat file adding the comm.jar file, again in different combinations with no luck.

      As I do not get any Class Not Found errors I assume the problem lies with the properties file.

      I am considering keeping the port connection code outside jboss and registering an adaptor with jboss possibly via JNDI, is there a better alternative?

      Any suggestions are welcome.


      Windows XP
      Jdk 1.4.1
      Jboss 3.2.1

        • 1. Re: Using JAVA Comm api with Jboss
          frito

          IMHO, best practice to do something like this is writing a MBean. You can deploy your MBean with all its resources (.jar files, classes, property files, ...). Let your EJBs talk to this MBean proxy instead of doing the comm things directly.
          Since I am not familiar with JAVA Comm, I don't know if it is using JNI. If so, be sure the needed .dll is in the jboss/bin directory or visible through your PATH.

          Greetings,
          Frito

          • 2. Re: Using JAVA Comm api with Jboss
            hoos

            Thanks Frito,

            I managed to set up a JMX Agent for my application and get it working outside of Jboss, and it looks straight forward enough now to get a servlet or ejb to access it, thanks for the tip.

            The JAVA comm api for windows is definately the flakiest api I have worked with, it seems large directory filenames (greater than 8 chracters) or hierarchies (more than 2 directories deep) are enough to cause a failure.

            Cheers Hoos.