Loading properties in JAR directory

I am trying to load properties files that are in the directory structure of the JAR file. The first properties object loads, but subsequent properties objects will not load. The code is as follows:
public Properties loadProperties(String file_name)
InputStream data = null;
Properties props = null;
try
data = getClass().getResourceAsStream(file_name);
//if(data==null) exit("ERROR: "+file_name);
props = new Properties();
props.load(data);
data.close();
data = null;
catch(Exception e)
handleException(e, file_name);
if(DEBUG)
printline("Property Loaded Successfully: " + file_name);
printline(props.toString());
return props;
the file names have the following setup
/directory/subdir1/subdir2/subdir3/file_name
The code works fine when not JAR'd - any suggestions?

If your program is in an executeable jar file then add the following in the manifest
class-path: junk.jar
junk.jar has
pjb/props/myconfig.properties file
To access the properties in junk from your executable jar file in your class, do the following
Locale eng = Locale.ENGLISH;
String myvalue  = java.util.ResourceBundle.getBundle("pjb.props.myconfig",eng).getString("greeting");That should work
Or if you not using an executable jar file just set your CLASSPATH to the directory where that junk.jar is.
java -cp c:\myjavalib\stash\                 <-----Assmuing junk.jar is in thereJava dynamically reads jar files.

Similar Messages

  • Can ResourceBundle load .properties from files and .jar?

    Hi Guys,
    I'm trying to I18N an application with ResourceBundle.
    Suppose my class look like this:
    package pack;
    import java.util.ResourceBundle;
    public class MyClass {
        public static void main(String[] args) {
            ResourceBundle rb = ResourceBundle.getBundle("Language");
    }This would load the localized string from Language.properties
    And when I pack the class file and Language.properties into a jar. It works fine
    But what I tried to do is to make the ResourceBundle try to load from external file first
    before it load from the jar file so that if I have a new language file I can just drop in the
    NewLang.properties.
    Inside .jar file look like this
    /Language.properties
    /pack/MyClass.class
    /meta-inf/Manifest.mf
    I tried look into some forum and they suggest to include Class-Path in Manifest.mf file
    to include current path like this
    Class-Path: .
    But still, it didn't work. If I include .properties in .jar it will not look outside but if I didn't include
    any .properties it found a properties file.
    How can I achieve this ?

    Dave,
    I reckon you're on the right track... just have to figure out "what's the path to properties file"... I suspect you've got a context problem... not sure... I'm pretty new at this stuff myself.
    So, what's your development environment? O/S, IDE, app/web-server, etc.
    Cheers. Keith.

  • NullPointerException while accessing .Properties from JAR

    Hi,
    I have created a JAR file which contains the .class as well as .properties in my application. Similarly when generating the JAR i have included the respective JAR's as well as the Main class of the app. in the Manifest.MF file.
    Below is the code i am using to load the properties from the LoggerConstants.
    if (properties == null) {
                   try {
                        properties = new Properties();
                        properties.load(Thread.currentThread().getContextClassLoader()
                                  .getResourceAsStream (LoggerConstants.LOGGER_PROPERTIES_PATH));
                        PropertyConfigurator.configure(properties);
                   } catch (IOException ioe) {
                        throw new LoggerException("unable to load file="
                                  + LOGGER_PROPERTIES_PATH, ioe);
    When i access the JAR in other app. by putting that in the build path, i am getting the following exception:-
    Exception in thread "main" java.lang.NullPointerException
         at java.util.Properties$LineReader.readLine(Properties.java:418)
    It seems that it is not able to pick the .properties which is there in the JAR file? But it is able identify the .class file?
    I tried by copying the same in the ANT Class path in eclipse, but still the problem persists. What i need to make sure that the .properties will be identified by the other app (App. 2)? Please shed some light into this.
    Thanks,
    Rithu

    Thanks Guys, the logger.properties will be under the classpath in the eclipse which will be under " src/com/example/logger.properties" directory. To brief , i am going to give this logger app. by compressing it in the JAR and will send to another machine , they need to use this JAR in their application and make use of the LogLevels i have created. The same will be done for other app. as well. So a Single Logger comp. which is build independently will be used by other standalone app. which needs to log the information.
    1) So, when i give the "LoggerComponent" JAR to other application. they should not modify any code (or create any classes) to use the .class or the .properties of the JAR?
    2) .class may not be a problem, but with .properties which may be a problem, hence are you saying that we need to load the logger.properties again in the referenced app. explictly, like wise do it for other app. which is going to use it? Because from my side i will give the Logger Comp. JAR to the other machines, just they need to use it as it is, without any modification in their code.
    3) Moreover when i create a JAR whether i need to package log4j.jar as well as other dependent JAR for the logger app.? So that the other reference app. dont have their own log4j.jar in their system to make use of it? Whether that makes sense or we should package a JAR with other JAR's(dependent JAR of the app.)?
    4) Ok. say if i am going to access the properties in my JAR in the reference app., like:-
    String sConfigFile = "src/com/example/logger.properties";
    InputStream in = LoggerTest.class.getClassLoader().getResourceAsStream(sConfigFile);
    if (in == null) {
         //File not found! (Manage the problem)
    Properties props = new java.util.Properties();
    props.load(in);
    LogManager logManager = new LogManager(); // Main class in the LoggerApplication JAR used in the reference app.
    logManager.logMessage("Test log msg");
    I will load properties and invoke the main class in JAR like above? Please clarify these queries. Thanks for the support
    Thanks,
    rithu

  • Loading an entire JAR via a classloader

    Hi how would I load an entire JAR file via a classloader. Currently I'm able to load one file at a time (in this case org.w3c.dom.Node) as shown below:
    import java.net.*;
    public class MyJarLoader {
       public static void main(String [] args) throws Exception {
         URL[] urlsToLoadFrom = new URL[]{new URL("file:subdir3/xml-apis.jar")};
         URLClassLoader loader1 = new URLClassLoader(urlsToLoadFrom);
         Class cls1 = Class.forName("org.w3c.dom.Node", true, loader1);
         System.out.println("Loaded '"+cls1.getName()+"'");
         org.w3c.dom.Node Node = (org.w3c.dom.Node) cls1.newInstance();
    Thanks

    Figured this one out as below. Note this is the simplistic solution since it requires that the jar files be present in the classpath. If not, you will have to write your own loadClass method to read the data from the zip (& then can't use the method 'Class.forName()').
    Regards
    //Load Apache JAR files
    URL[] urlArrToLoadFrom = new URL[]{new URL("file:xalan-j_2_5_0/xml-apis.jar"),
                new URL("file:xalan-j_2_5_0/xercesImpl.jar"), new URL("file:xalan-j_2_5_0/xalan.jar")};
    //Create a URLClassLoader to access jar files
    URLClassLoader urlLoaderGeneric = new URLClassLoader(urlArrToLoadFrom);
    //Foreach jar file, open, load class files & close
    for(int i=0; i<urlArrToLoadFrom.length; i++) {
    //Debug
       System.out.println(urlArrToLoadFrom.toString());
       //Open zip file
       ZipFile zf = new ZipFile(urlArrToLoadFrom[i].getFile());
       for (Enumeration enum = zf.entries(); enum.hasMoreElements();) {
         //Get entry
         ZipEntry ze = (ZipEntry) enum.nextElement();
         //Only load if it's not a directory and it's a class file
         int iIndexClass = -1;
         if (!ze.isDirectory() && ((iIndexClass = ze.getName().indexOf(".class")) != -1)) {
             //Remove .class & replace / with .
             String strApacheClassName = (ze.getName().substring(0,iIndexClass)).replace('/','.');
             //Load class file
             Class classApache = Class.forName(strApacheClassName, true, urlLoaderGeneric);
             System.out.println("Loaded '"+classApache.getName()+"'");
       //Close zip
       zf.close();

  • Problem loading image from jar file referenced by jar file

    First, I searched this one and no, I didn't find an answer. Loading images from jar files has been pretty much done to death but my problem is different. Please read on.
    I have my application, a straight up executable running from Eclipse. It uses a jar file, call it JarA. JarA launches a GUI that is located in another jar file. Call it JarB. To recap:
    My application calls JarA -> JarA loads classes from JarB -> JarB looks for images to place in a GUI it wants to show on the screen
    When JarB goes to load an image the following happens:
    java.lang.NullPointerException
         at sun.misc.URLClassPath$3.run(URLClassPath.java:316)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.misc.URLClassPath.getLoader(URLClassPath.java:313)
         at sun.misc.URLClassPath.getLoader(URLClassPath.java:290)
         at sun.misc.URLClassPath.findResource(URLClassPath.java:141)
         at java.net.URLClassLoader$2.run(URLClassLoader.java:362)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findResource(URLClassLoader.java:359)
         at java.lang.ClassLoader.getResource(ClassLoader.java:977)
         at org.cubrc.gmshell.gui.MainWin.preInit(MainWin.java:152)
         at org.cubrc.gmshell.gui.MainWin.<init>(MainWin.java:135)
    The code from JarB that loads the image looks like this:
              URL[] oSearch = {Main.class.getResource("images/")};
              URLClassLoader oLoader = new URLClassLoader(oSearch);
              imgIcon = new ImageIcon(oLoader.getResource("icon.gif"));
              imgMatchRunning = new ImageIcon(oLoader.getResource("gears.gif"));
              imgMatchStill = new ImageIcon(oLoader.getResource("gears-still.gif"));
              imgMagnify = new ImageIcon(oLoader.getResource("magnify.gif"));This looks right to me and JarB certainly has an images directory with those files. But I'm in hell right now because I don't know where to place the images to make this work or if you can even attempt to load images with a dependency chain like this.
    Any help very appreciated!

    Have you tried to move your image-files out of the jar file and place them in the sam folder as the jar-file? I think that would help.
    When you try to load the image-file you get the NullPointerException because the program tries to read a file it can't find. Remember that a jar file IS a file and not a directory.
    If you want to read somthing inside the jar-file you need to encode it first.
    Have you tried to read the jar-file with winRar. It makes it easy to add and remove files in your jar-file.

  • Problem Loading some symlinked jars

    Hi,
    We have a very strange problem with loading jars (which are symlinks).
    We are loading about 20 jars inside a certain directory and all are ok, except 1 sometimes (x.jar)
    Lets say the files are inside /opt/shared/lib and ls /opt/shared/lib shows:
    a.jar -> /opt/a/a.jar
    b.jar -> /opt/b/b.jar
    c.jar -> /opt/c/c.jar
    d.jar -> /opt/d/d.jar
    x.jar -> /opt/x/x.jar
    For some reason loading x always gives the exception:
    Caused by: java.security.AccessControlException: access denied (java.io.FilePermission /opt/x/x.jar read)
    When we look at /opt/x/x.jar, the permissions are fine. Now comes the strange part.
    After some tries we ended up with (d.jar was obsolete):
    a.jar -> /opt/a/a.jar
    b.jar -> /opt/b/b.jar
    c.jar -> /opt/c/c.jar
    x.jar -> /opt/x/x.jar
    and everything works as expected.
    Then we:
    1. remove the symlink x.jar
    2. add a new (dummy) file to this directory
    3. make the symlink again
    4. remove the dummy file
    Now the problem occurs again and we get the above io.FilePermission exception.
    Now if we:
    1. remove the symlink
    2. make the symlink again
    The exception is gone, it seems as if the symlinks takes the physical place of the dummy file on the filesystem.
    Redoing the above sequences gives again the FilePermission exception and finally OK again.

    bami wrote:
    I'm not sure what you mean with cat ïng to /dev/null.I meant to try this in the shell, when you have the problem:
    cat /opt/shared/lib/x.jar > /dev/nulland see if it succeeds (i.e. prints nothing).
    If that works, then there's a Java problem, if it doesn't work, then Java is not the problematic element in the equation.
    The OS is Solaris (sparc) with kernel Generic_137111-08. The Filesystem is UFS.Unfortunatley I have no experience with Solaris whatsoever, so I can't comment on that.

  • Finder (Snow Leopard 10.6.8) taking long time to load contents of any directory. Please help?

    In my macbook pro 5,2 snow leopard (10.6.8), Finder taking long time to load contents of any directory. Please help?
    I have already tried to spotlight re-indexing but it did not help. I am hardly able to work on it, almost for each directory I browse its keeps on spinning for 1min.

    Download iTunes from Apple's web site and install it.  Don't use Software Update.

  • Loading Xlet via .jar

    Hi everybody,
    i've got an Xlet containing about 100 classes and some resources. Since the startup-time is beyond the pale when files are loaded separetely by the object carousel, I want to load them with some .jar-files.
    Therefore I wrote a custom ClassLoader that overrides the loadClass(String,boolean)-method as required in JDK1.1.8, reads the .jar as dsmccObject and defines/resolves the class. And everything's working so far.
    part of sample code for loading from repository:
    <code>
    DSMCCObject dsmccZipFile = new DSMCCObject("test1.jar");
    dsmccZipFile.asynchronousLoad(this);
    FileInputStream fi = new FileInputStream(dsmccZipFile);
    ZipInputStream zis = new ZipInputStream(fi);
    ZipEntry entry = null;
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    while((entry = zis.getNextEntry()) != null){
         String entryName = entry.getName();
         if(entryName.equals(className+".class")){
              buffer = new byte[1024];
              int len=0;
              while((len=zis.read(buffer)) != -1){
                   baos.write(buffer, 0, len);
              zis.closeEntry();
              zis.close();
              byte[]classBytes = baos.toByteArray();
              baos.close();
              return classBytes;
    </code>
    Cause I'm a newbie to classLoaders, I have the following problem:
    The classes from the jar files are not known at build-time, so that I'm not able to do typecasting and calling the classes' methods.
    The only way I handled the problem was the ReflectionAPI.
    <code>
    Class c = mcl.loadClass("test", true);
    Object o = c.newInstance();
    Method method = c.getMethod("aMethod", new Class[0]);
    method.invoke(o, new Object[0]);
    </code>
    It works, but i don't like this solution, since it will result in complex code and the reflection's performance is not so high in comparison to direct method calls.
    Another solution would probably be a common known interface, which calls methods, but that's worse i think and i had to implement the interface in all classes.
    => my questions:
    1) Is there a common solution for jar-loading in MHP (i'm surely not the only one with a bad startup-time if loading files seperately)?
    2) If not: is there a better solution than mine (using the reflection api) (the source will be the same: initial ClassLoader.class and .jar's send from same source over the oc)?
    3) Should I extend org.dvb.lang.DVBClassLoader (I simply extended java.lang.ClassLoader) and which parentClassLoader should I use as second parameter? I tested it once with the Xlet's ClassLoader (getClass().getClassLoader()) but the problem is of course still the same.
    4) Is there a reason that there is no jar support in the mhpAPI / environments (resp. those i know)? I simply used ZipInputStream instead of JarInputStream. Are jar classes available for download anywhere?
    THX
    regards,
    Ben

    Thanks to desperado for pointing out that you couldn't load classes from JAR files. I thought that was the case, but couldn't find where in the spec said it, so I assumed I was wrong. Ho hum.
    To answer your questions:
    - caching can be done on either the module level of the file level. MHP is pretty flexible about this, and doesn't define how much cache will be present (having no cache at all is acceptable, but most boxes have some)
    - module arrangement will not always help, but it does make things easier. What you can do in DSM-CC that you can't do in HTTP is change the repetition rate of modules, so that commonly-used modules are transmitted more often (and thus have less latency) than less commonly used modules. Of course, this does affect the time needed to transmit the entire carousel.
    - jars work pretty well in an internet app, but they're much less use in a DTV environment because you're transmitting your apps in a carousel. See below for why this is the case.
    - you are right that you have to load files separately and not from JAR files. Loading from JAR files is not interoperable.
    Loading classes from a JAR file would be slower because you have to wait for the entire file to load before you get any classes out of it. Depending on the size of your file, this can have a number of problems:
    1) you need to load the entire JAR file. This means that you have to load all of the files, not just the ones you need, which takes longer. You're still only transmitting your object carousel at the same speed.
    2) using modules that group together your files in a logical way may make better use of the DSM-CC cache in the receiver. If the receiver caches modules, then grouping files that are used together in the same module means that you will have less latency when loading files froma cached module. This gives you some of the benefits if using a JAR file in a more flexible way.
    3) DSM-CC can compress the data in your files before transmitting it, so using a JAR file won't actually help you much in terms of reducing space.
    The only tutorials that I know of that discuss DSM-CC are mine and the ETSI documentation. If you find any more, please let me know.
    Steve.

  • Batch loading with sdordf.jar.

    Hi Guys
    I have just tried a batch load with sdordf.jar.
    In my first attempt there was a mistake in the n3 file.
    After correcting the file and re running I now get the error.
    Connecting to jdbc:oracle:thin:...........
    Append mode
    Copy existing data out
    Just load triples into one column
    Temporary table already exists!
    java.sql.SQLException: ORA-00955: name is already used by an existing object
    ORA-06512: at "MDSYS.SDO_RDF_INTERNAL", line 3326
    ORA-06512: at "MDSYS.SDO_RDF_INTERNAL", line 3362
    ORA-06512: at "MDSYS.RDF_APIS", line 786
    ORA-06512: at line 1
    Can anyone tell me what the name of this temporary table is, so that I can get rid of it.
    Cheers
    Phil

    Hi Mellie
    After having a little break I have installed the jena patch during which I had to drop the network and model created before.
    I tried running a batch load as before but I still get the error message saying the temporary table already exists.
    I tried the clean up routine as suggested but get the error.
    SQL> exec sdo_rdf.cleanup_batch_load('researchdata')
    BEGIN sdo_rdf.cleanup_batch_load('researchdata'); END;
    ERROR at line 1:
    ORA-13199: Batch load cleanup failed. ORA-00942: table or view does not exist
    ORA-06512: at "MDSYS.MD", line 1723
    ORA-06512: at "MDSYS.MDERR", line 17
    ORA-06512: at "MDSYS.SDO_RDF", line 1016
    ORA-06512: at "MDSYS.SDO_RDF", line 1022
    ORA-06512: at line 1
    I run it as mdsys as you said.
    Any other suggestions?
    Cheers
    Phil

  • WSAD : loading properties file from EBJ project

    Hi,
    I am trying to load properties file contains database parameters into my EJB project. I am using WSAD as IDE tool
    can you please help me with following.
    1. where to place the .properties file physically ?
    2.how to load the file to my EJB/DAO classes
    3.can i use the same location to place log4j.properties file as well ?
    I have tried doing in different ways but none is working.
    thank you
    Narendra

    got it working , for information pl go to the following page and section "Using log4j in an EJB Application"
    i have followd same steps for loading my properties file .
    http://sys-con.com/story/?storyid=43413&DE=1

  • How to load an applet jar file?

    Hello everyone,
    I have an applet that uses my own jar file and approximately 6 third party jar files. I set up jar indexing (jar -i) which will download the jar files when they are needed. All seems to work well, but now I want to manually load the jar files which I cannot get working.
    When the applet starts, about 1/2 of the jar files are downloaded (because they are needed at startup). I then want to load the additional jar files in the background, after the gui is initialized. I have tried this using the below thread which is executed from within the applet's start method:
    // Try to load additional jar files in background by loading a class from each jar file.
    Thread loadClass = new Thread() {
      public void run() {
        System.out.println("Loading classes...");
        try {
          // Tried loading classes this way, doesn't work.
          getClass().getClassLoader().loadClass("pkg1.Class1");
          getClass().getClassLoader().loadClass("pkg2.Class2");
          getClass().getClassLoader().loadClass("pkg3.Class4");
          getClass().getClassLoader().loadClass("pkg4.Class4");
          /* Loading classes this way doesn't work either.
          Class.forName("pkg1.Class1");
          Class.forName("pkg2.Class2");
          Class.forName("pkg3.Class3");
          Class.forName("pkg4.Class4");
        catch(ClassNotFoundException e) {
          // First attempt to load a class (pkg1.Class1) throws exception.
          System.out.println("Can't find class: " + e.getMessage());
    loadClass.start();As you can see from above I am trying to load a class from each of the jar files so that the jar files would load into memory/cache. Unfortunately, it cannot find the classes. These are the errors from the java console:
    Loading classes...
    Loading: pkg1.Class1
    Connecting http://my.server.com/my_dir/pkg1/Class1.class with no proxy
    Connecting http://my.server.com/my_dir/pkg1/Class1.class with cookie "JSESSIONID=some_big_long_char_list"
    Can't find class: pkg1.Class1
    So it appears the jar file is not being downloaded. When I take away the dynamic jar loading (removing the "jar -i" & adding them all to the applet archive list) the thread executes correctly. So I know the class names, etc, are correct. How does one load an applet jar file?
    Any help/suggestions are appreciated.

    The above error I posted was because I forgot to index the jar files. That is why it couldn't find the jar file. I thought I was getting farther along with my problem, but I apparently just forgot to index the jars. I am now getting the problem that I got yesterday...
    The applet freezes/hangs when it hits the thread. The GUI never opens (even though I'm running this thread right after the gui shows). The java console quits responding and the applet just stays the grey screen. I also tried the invoke later that you suggested.
    public void start() {
      // ...initialize gui...
      // Applet freezes and remains grey, also the java console freezes.
      javax.swing.SwingUtilities.invokeLater(new Runnable() {
        public void run() {
          System.out.println("Loading classes...");
          try {
            // When I comment out the below forName calls, the thread will still run evidenced through the done print statement.
            Class.forName("pkg1.Class1");
         Class.forName("pkg2.Class2");
         Class.forName("pkg3.Class3");
         Class.forName("pkg4.Class4");
            System.out.println("...Done loading classes");
          catch(Exception e)     {
            System.out.println("Can't find class: " + e.getMessage());
    }

  • Loading library from jar file

    Hi all,
    My question is can we load library from jar file using System.load() method.
    ex:
    myJar.jar
    |
    |----com.test.common.Util
    which conatins a method to load library from jar file itself, before that i used to load from File
    |---libraries/MozillaParser/......
    Iam able load from Local system,
    File parserLibraryFile = new File("libraries/MozillaParser" + EnviromentController.getSharedLibraryExtension());
    File mozillaDistBinDirectory = new File("libraries/mozilla.dist.bin."+EnviromentController.getOperatingSystemName());
    MozillaParser.init(parserLibraryFile.getAbsolutePath() , mozillaDistBinDirectory.getAbsolutePath());
    but i am unable to load from jar file
    URL url = ClassLoader.getSystemClassLoader().getResource("libraries/MozillaParser" + EnviromentController.getSharedLibraryExtension());
    URL url1 = ClassLoader.getSystemClassLoader().getResource("libraries/mozilla.dist.bin."+EnviromentController.getOperatingSystemName());
    MozillaParser.init(url.toString(), url1.toString());
    Thanks in advance.

    That's a really confusing post.
    The easiest way to make sure you can use the classes in a jar file is to copy the jar file to the "/jre/lib/ext" subfolder of your JDK. These classes will be visible to all applications.

  • Can I use property loader in a main sequence to load properties in subsequence?

    Hi, I have been trying to use the property loader to load test limits and local variabels into subsequences from the main sequence.
    I can export all the properties for my main sequence and all the subsequences contained within by selecing <all sequences> in the export function.
    When I try to load the exported file back in using the property loader I get differant errors depending on the format I exported/imported it with.
    For text or csv files iget error -17100
    "The file format is incorrect near the section 'StationGlobals'.  Make sure that you are using start and end markers correctly."
    For an xl format I get error -18 
    "Property loader step failed to import or export properties.
    310 property value(s) were found.
    43 property value(s) were imported from 920 row(s) of data"
    There is no where near 920 rows of data or 320 properties in the exported file.
    If i use the property loader to load properties in just main it works fine, is there extra formating I need to do to the file before importing it or is it not possible to load properties into a subsequence from a property loader in main?
    Solved!
    Go to Solution.

    Hi,
    I have tried several sequences and building the propertyloader file using the export tool,
    Moving the End_Mainsequence to the bottem did not help.
    I can load values into a single sequence with no problem it is only when I try to load properties into a sub sequence from the main sequence that I have issues.
    Attached is a more simple example of what I am trying to acheive. 
    Kind regards,
    Hugo
    Attachments:
    Sequence File 2.seq ‏9 KB
    Test.csv ‏2 KB

  • Exception while loading properties from an xml file

    Hi all,
    I've got a problem while loading properties from an XML file:
    java.lang.ClassCastException: org.apache.xerces.dom.DeferredCommentImpl cannot be cast to org.w3c.dom.Element
    ERROR - Cannot load properties from the specified file <./conf/login.prop> java.lang.ClassCastException: org.apache.xerces.dom.DeferredCommentImpl cannot be cast to org.w3c.dom.Element
         at java.util.XMLUtils.importProperties(XMLUtils.java:97)
         at java.util.XMLUtils.load(XMLUtils.java:69)
         at java.util.Properties.loadFromXML(Properties.java:852)
         at g2.utility.HRPMProperties.<init>(HRPMProperties.java:78)
         at g2.utility.HRPMProperties.getInstance(HRPMProperties.java:94)
         at g2.gui.workers.ApplicationSwingWorker.<init>(ApplicationSwingWorker.java:36)
         at g2.main.Main.main(Main.java:37)but this code worked before, and I've got the xerces and xercesImpl packages in the classpath, anyone can give me an hint on how to fix the problem?

    Here there's the code that instantiates the HRPMProperties object loading the property file:
    public class HRPMProperties extends Properties {
         * A reference to myself.
        protected static HRPMProperties mySelf = null;
         * The property file to which load the configuration.
        protected static String propertyFile = "./conf/login.prop";
          * A set of static strings used as keys in the properties file.
         public final static String DATABASE_URL = "database_url";
         public final static String DATABASE_USERNAME = "database_username";
         public final static String DATABASE_PASSWORD = "database_password";
         public final static String REAL_USERNAME = "real_username";
         public final static String REAL_PASSWORD = "real_password";
         public final static String PHANTOM_LOGIN = "login_thru_phantom_user";
         public final static String AUTOCONNECT = "autoconnect";
         public final static String TRANSLATION_FILE = "translation_file";
         * Builds up an empty properties map.
        protected HRPMProperties(){
         super();
         this.reload();
         * Builds up the property map from the specified input file. <B> The file must be in XML format</B>.
         * In case of exception and/or problems reading from the specified file, an empty property map is returned.
         * @param fileName the path and the name of the file with the XML representation of the properties.
        protected HRPMProperties(String fileName){
         super();
         try{
             this.loadFromXML(new FileInputStream(fileName));        
         }catch(Exception e){
             Logger.error("Cannot load properties from the specified file <"+fileName+"> " + e);
             e.printStackTrace();
         * Provides an instance of the property class loaded from the default configuration file.
         * @return the property instance
        public static final HRPMProperties getInstance(){
         if( HRPMProperties.mySelf != null )
             return HRPMProperties.mySelf;
         else{
             HRPMProperties.mySelf = new HRPMProperties(HRPMProperties.propertyFile);
             return HRPMProperties.mySelf;
    }The constructor is the one triggering the exception, so there's a problem loading the XML property file.

  • Bug in OWB 10gR2: Several Loading Properties after sync

    Hi,
    we recognize a possible bug in owb, can anybody please approves this behaviour?
    Every column of a table in an owb mapping has fourr loading properties:
    - Load Column When Updating Row (YES/NO, default YES)
    - Match Column When Updating Row (YES/NO, default NO)
    - Load Column When Inserting Row (YES/NO, default YES)
    - Match Column When Deleting Row (YES/NO, default NO)
    These properties are stored as a record in the repository and references the column. If you change one of the values, this record will be updated in the repos. But if you do a "synchronize" for the table, you get a second record - for each sync one more! Updates changes only the latest record!
    If you copy a mapping (using "Cut"/"Copy" and "Paste") or do an import/export the owb uses not the latest record, he choose one of them by chance. So you cannot easily reproduce this error and the mappings probably don't do what they should.
    What are your experiences - do you recognize this too?
    Regards,
    Detlef
    Edited by: dapel on Oct 20, 2008 12:10 PM

    Update:
    The sync process essentially creates orphaned records within the repository which unfortunately get exported/imported into the next repository, making it random which child detail record gets imported last. This phenomenum is what makes the "Yes/No" attributes somewhat unpredictable. OWB 10.2.0.4 includes a bugfix for this.
    There is a cleanup script from oracle for existing repositories I have attached this script with the caveat that you should make a complete repository backup before proceeding. This script also allow you to run it in "test-only" mode to see how many bad records will be removed.
    Script:
    http://rapidshare.com/files/156472039/FIX_OWB_REPO.sql.html
    Regards,
    Detlef

Maybe you are looking for