Discussions

EJB programming & troubleshooting: EJB reading custom version information from .EAR?

  1. When we build our .ear file, containing very many other jar files, we add a 'version' file to the META-INF directory. This is a plain text file containing some process-specific version info (build ID, date, time etc). This file can be interrogated by a command-line deployment script which peeks inside the jar.

    We would like to expand the debug window on our PowerBuilder client so that it can display the version information from the server. We would like the GUI facing session EJB to be able to read that bean's enclosing .ear file's META-INF/version file - but this doesn't seem to be allowed!

    Anyone got any ideas how I could accomplish this?

    (The important thing is that the timestamp is the date of the .ear generation, ruling out several approaches.)
  2. Well ... you can load the version file itself in your Java code using the getResourceAsStream() method of the System or Class classes. That only loads the file into memory on the server, though.

    To get the information to your client, your could (a) expend version information to all your application exceptions or (b) create a VersionQuery session bean, so that the client can query the server for version information.