1 Reply Latest reply on Apr 18, 2008 3:53 PM by bob_ninja

    MalformedURLException for cache config in a web app

    bob_ninja

      I have a simple web app that tries to initialize and use a cache instance. I am running the latest AS BETA 4, using the ALL config that includes cache lib.

      I copied one of the sample config files:
      all/lib/jbosscache.jar/META-INF/replSync-service.xml
      ... into my app to avoid any issues. My code is simple:

      // read configuration
      final XmlConfigurationParser parser = new XmlConfigurationParser();
      final Configuration config =
      parser.parseStream(CacheContext.class.getResourceAsStream(conf_path));
      // init cache
      CacheFactory<String,Object> factory =
      new DefaultCacheFactory<String,Object>();
      cache = factory.createCache(config, true);

      I have my own context class co-located with the config file. The server is generating this:

      15:28:45,107 ERROR [XmlHelper] Configurator general error
      java.net.MalformedURLException
      at java.net.URL.(URL.java:601)
      at java.net.URL.(URL.java:464)
      at java.net.URL.(URL.java:413)
      at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
      at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
      at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
      at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
      at org.jboss.cache.xml.XmlHelper.getDocumentRoot(XmlHelper.java:374)
      at org.jboss.cache.factories.XmlConfigurationParser.parseStream(XmlConfigurationParser.java:
      100)
      at test.avaya.jbc.cache.CacheContext.init(CacheContext.java:60)
      at test.avaya.jbc.cache.CacheContext.(CacheContext.java:47)
      at test.avaya.jbc.cache.CacheContext.getInstance(CacheContext.java:33)
      at test.avaya.jbc.VerifyFidelity.run(VerifyFidelity.java:72)
      15:28:45,107 ERROR [STDERR] Exception in thread "Thread-28"
      15:28:45,107 ERROR [STDERR] java.lang.NullPointerException
      15:28:45,107 ERROR [STDERR] at org.jboss.cache.factories.XmlConfigurationParser.getMBeanElement(
      XmlConfigurationParser.java:208)
      15:28:45,107 ERROR [STDERR] at org.jboss.cache.factories.XmlConfigurationParser.parseStream(XmlC
      onfigurationParser.java:101)
      15:28:45,107 ERROR [STDERR] at test.avaya.jbc.cache.CacheContext.init(CacheContext.java:60)
      15:28:45,107 ERROR [STDERR] at test.avaya.jbc.cache.CacheContext.(CacheContext.java:47)
      15:28:45,107 ERROR [STDERR] at test.avaya.jbc.cache.CacheContext.getInstance(CacheContext.java:3
      3)
      15:28:45,107 ERROR [STDERR] at test.avaya.jbc.VerifyFidelity.run(VerifyFidelity.java:72)


      Looks like it does locate the file fine and starts reading it, but then fails due to a URL. "getDocumentRoot" seems to imply an early failure at the start of the file. "determineDocVersion" might imply processing the 1st tag,
      <?xml version="1.0" encoding="UTF-8"?>

      Not sure. I don't really see any URLs there. In any case I only changed the cluster name, so this is the stock config file that same with AS. I would assume that it should parse fine.

      Tried searching old posts, but found not clue. If there is another existing resource that explains this sort of issue, I would appreciate a tip.
      Or just in general any tip, as what area I should focus on.

      thanks