Back to the discussiones of jaxb.properties and bgm.ser. Once jaxb find a path to jaxb.property, jaxb invokes classloader.getResourceAsStream to load jaxb.property into memory.
There are two problems with this strategy. First the searchContextPath method searches only subdirectory of current working directory, which means JAXBContext can only be created from the class with local copies of "package".jaxb.properties and "package".bgm.ser and nowhere else. If jaxb package or the compiled package is put as global as library, JAXBContext won't initialize for it has no path to those two files.
For instance, if PackA is the conpiled package, then jaxb.properties and bgm.ser must be stored in .\PackA. The method JAXBContext.newInstance("PackA") works in the current directory, if this method is called from other classes, or the package is compressed as in archive file, it won't work.
Another problem is jaxb use semicolon ":" as delimiter to seperate package paths for multiple packages, as in JAXBContent initialization. In fact classload can load not only local files, but remote files too. In the later case the argument of getResourceAsStream method is an url. If resolved correctly, JAXBContext can actually load jaxb.properties and bgm.ser from anywhere, either "file://location" or "protocol:port//location". Then the two files need not to be in classpath. Unfortunitely, searchContextPath method will take the url as two paths seperated by ":". This prevents loading from url.
My suggestion is to rewrite searchContextPath and loadJAXBProperties methods. Can we load the two files from web sources? We might need to change the package seperator from ":" to "," or other uncommon character. It is said the problem will be removed in the final release of JAXB 1.0. Can some one shad a light on how to deal with the problem? "Put the required files in classpath" sometimes is simply not an option, if the classes run in a web container.