JSF2.1.x does not work if there is space in the path. Error: Illegal character in opaque part at index 22

StackOverflow https://stackoverflow.com/questions/13688981

  •  04-12-2021
  •  | 
  •  

Question

My app has recently upgraded from JSF 1.2 to JSF 2.1.3. I am using Mojarra.

My app is installed as an EAR through the WAS7 admin console in RAD8.

The index 22 is refererring the space in "Program Files".

When the server starts here is the error that matters that I get:

Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 22: wsjar:file:/C:/Program Files/IBM/SDP/runtimes/base_v7/profiles/IndSalesUtilsAppSrv02/installedApps/R8CMY8NW7LNode03Cell/IndUserServices.ear/IndUserServicesWeb.war/WEB-INF/lib/ind-jsf-v1.6.0.jar!/META-INF/faces-config.xml
    at java.net.URI$Parser.fail(URI.java:2809)
    at java.net.URI$Parser.checkChars(URI.java:2982)
    at java.net.URI$Parser.parse(URI.java:3019)
    at java.net.URI.<init>(URI.java:578)
    at com.sun.faces.config.configprovider.MetaInfFacesConfigResourceProvider.loadURLs(MetaInfFacesConfigResourceProvider.java:160)
    ... 30 more

Here is the full stack trace:

[12/3/12 11:26:02:659 CST] 00000009 webapp        E com.ibm.ws.webcontainer.webapp.WebApp notifyServletContextCreated SRVE0283E: Exception caught while initializing context: {0}
                                 java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: java.util.concurrent.ExecutionException: javax.faces.FacesException: java.io.IOException: java.net.URISyntaxException: Illegal character in opaque part at index 22: wsjar:file:/C:/Program Files/IBM/SDP/runtimes/base_v7/profiles/IndSalesUtilsAppSrv02/installedApps/R8CMY8NW7LNode03Cell/IndUserServices.ear/IndUserServicesWeb.war/WEB-INF/lib/ind-jsf-v1.6.0.jar!/META-INF/faces-config.xml
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:290)
    at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1708)
    at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinish(WebApp.java:381)
    at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:299)
    at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:100)
    at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:166)
    at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:732)
    at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:617)
    at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:376)
    at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:668)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1127)
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1319)
    at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:610)
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:944)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:740)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2051)
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:385)
    at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:328)
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$300(CompositionUnitMgrImpl.java:113)
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:895)
    at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:349)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1613)
Caused by: com.sun.faces.config.ConfigurationException: java.util.concurrent.ExecutionException: javax.faces.FacesException: java.io.IOException: java.net.URISyntaxException: Illegal character in opaque part at index 22: wsjar:file:/C:/Program Files/IBM/SDP/runtimes/base_v7/profiles/IndSalesUtilsAppSrv02/installedApps/R8CMY8NW7LNode03Cell/IndUserServices.ear/IndUserServicesWeb.war/WEB-INF/lib/ind-jsf-v1.6.0.jar!/META-INF/faces-config.xml
    at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:663)
    at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:323)
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:223)
    ... 22 more
Caused by: java.util.concurrent.ExecutionException: javax.faces.FacesException: java.io.IOException: java.net.URISyntaxException: Illegal character in opaque part at index 22: wsjar:file:/C:/Program Files/IBM/SDP/runtimes/base_v7/profiles/IndSalesUtilsAppSrv02/installedApps/R8CMY8NW7LNode03Cell/IndUserServices.ear/IndUserServicesWeb.war/WEB-INF/lib/ind-jsf-v1.6.0.jar!/META-INF/faces-config.xml
    at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
    at java.util.concurrent.FutureTask.get(FutureTask.java:83)
    at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:649)
    ... 24 more
Caused by: javax.faces.FacesException: java.io.IOException: java.net.URISyntaxException: Illegal character in opaque part at index 22: wsjar:file:/C:/Program Files/IBM/SDP/runtimes/base_v7/profiles/IndSalesUtilsAppSrv02/installedApps/R8CMY8NW7LNode03Cell/IndUserServices.ear/IndUserServicesWeb.war/WEB-INF/lib/ind-jsf-v1.6.0.jar!/META-INF/faces-config.xml
    at com.sun.faces.config.configprovider.MetaInfFacesConfigResourceProvider.getResources(MetaInfFacesConfigResourceProvider.java:135)
    at com.sun.faces.config.ConfigManager$URITask.call(ConfigManager.java:1179)
    at com.sun.faces.config.ConfigManager$URITask.call(ConfigManager.java:1148)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:639)
    ... 24 more
Caused by: java.io.IOException: java.net.URISyntaxException: Illegal character in opaque part at index 22: wsjar:file:/C:/Program Files/IBM/SDP/runtimes/base_v7/profiles/IndSalesUtilsAppSrv02/installedApps/R8CMY8NW7LNode03Cell/IndUserServices.ear/IndUserServicesWeb.war/WEB-INF/lib/ind-jsf-v1.6.0.jar!/META-INF/faces-config.xml
    at com.sun.faces.config.configprovider.MetaInfFacesConfigResourceProvider.loadURLs(MetaInfFacesConfigResourceProvider.java:177)
    at com.sun.faces.config.configprovider.MetaInfFacesConfigResourceProvider.getResources(MetaInfFacesConfigResourceProvider.java:108)
    ... 29 more
Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 22: wsjar:file:/C:/Program Files/IBM/SDP/runtimes/base_v7/profiles/IndSalesUtilsAppSrv02/installedApps/R8CMY8NW7LNode03Cell/IndUserServices.ear/IndUserServicesWeb.war/WEB-INF/lib/ind-jsf-v1.6.0.jar!/META-INF/faces-config.xml
    at java.net.URI$Parser.fail(URI.java:2809)
    at java.net.URI$Parser.checkChars(URI.java:2982)
    at java.net.URI$Parser.parse(URI.java:3019)
    at java.net.URI.<init>(URI.java:578)
    at com.sun.faces.config.configprovider.MetaInfFacesConfigResourceProvider.loadURLs(MetaInfFacesConfigResourceProvider.java:160)
    ... 30 more

Things I have tried that have not worked:

  1. Updated to JSF 2.1.14 (looking at source of MetaInfFacesConfigResourceProvider I see it has not changed from 2.1.3 to 2.1.14, so that makes sense that it doesn't work.)
  2. Get Source Code Import the app as a project (works if path to project does not have space, does not work if there is a space in the path to project)
  3. Change the "Runtime Environment" on the Server from "C:\Program Files\IBM\SDP\runtimes\base_v7" to "C:\Progra~1\IBM\SDP\runtimes\base_v7" (doesn't seem to do anything)

I am pretty sure it is related to this issue, that never appears to get resolved

It would not surprise me if this is an IBM problem. But I need to get this work somehow without IBM fix.

Reinstalling RAD8 in a new location that does not include a space is not an option at this time.

Was it helpful?

Solution

This appears to have been fixed in 2.1.16 and 2.2 trunk.

http://java.net/jira/browse/JAVASERVERFACES-2628

OTHER TIPS

try this one:

File f = new File("C:/Program Files/I...[rest of filepath]");
URI u = f.toURI();

to get your URI. Spaces are valid in filenames, but invalid in URI's, this will escape it properly.

This problem is always present on IBM WAS 7/8 when I deploy a war application (inside an ear) and the war application contain spaces in the name.

My solution is to remove every space in the "war" filename.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top