0 Replies Latest reply on Oct 23, 2005 8:42 PM by Mike Yawn

    Spaces in URLs not properly encoded?  (EJB 3.0 Embedded Alph

    Mike Yawn Newbie

      I'm doing the following sequence of calls lifted directly from the tutorials

      EJB3StandaloneBootstrap.boot(null);
      EJB3StandaloneDeployer deployer = new EJB3StandaloneDeployer();
      URL deployDir = getDeployDirURL();
      deployer.getDeployDirs().add(deployDir);
      deployer.setJndiProperties(getInitialContextProperties());
      deployer.create();

      where getDeployDirURL() includes the following:
      URL res = Thread.currentThread().getContextClassLoader().getResource(
      "resources/persistence.xml");
      System.out.println(res);
      if (res == null)
      System.out.println("persistence.xml not found");
      return EJB3StandaloneDeployer.getDeployDirFromResource(res,
      "resources/persistence.xml");


      When I display 'res' after getting it from the getResource() call, it is:
      file:/C:/Documents%20and%20Settings/myawn/j2ee/com.kenai.examine/bin/resources/persistence.xml

      Note the %20 codes inserted where spaces used to be -

      But when I call deploy.create(), it fails, and displays the following message
      17:37:02,116 WARN [XsdBinder] NOT HANDLED WILDCARD IN GLOBAL MODEL GROUP
      java.net.URISyntaxException: Illegal character in path at index 18: file:/C:/Documents and Settings/myawn/j2ee/com.kenai.examine/file:/C:/Documents%20and%20Settings/myawn/j2ee/com.kenai.examine
      at java.net.URI$Parser.fail(Unknown Source)
      at java.net.URI$Parser.checkChars(Unknown Source)
      at java.net.URI$Parser.parseHierarchical(Unknown Source)
      at java.net.URI$Parser.parse(Unknown Source)
      at java.net.URI.(Unknown Source)
      at java.net.URL.toURI(Unknown Source)
      at org.jboss.ejb3.embedded.EJB3StandaloneDeployer.create(EJB3StandaloneDeployer.java:335)
      at com.kenai.examine.wsdl.EJB30Main.main(EJB30Main.java:34)

      The URI is in there twice; the first time, the spaces have not been encoded and this (I think) is causing the deployment to fail.

      I'm not sure if the warning prior to that (about the model group) is related to this in any way.

      Questions
      - Do I need to be concerned about the warning?
      - Is it expected that the URL would appear twice as shown in the error message?
      - Is there something I can do, either to the 'res' returned by the classloader or in the deployer call, to cause the URL encoding to be done right?

      Thanks,
      Mike