2

I'm trying to build custom URL as prettyfaces tells that it do, but after setup it, it gives me this error:

Referenced file contains errors (http://ocpsoft.org/xml/ns/prettyfaces/ocpsoft-pretty-faces-3.3.3.xsd). For more information, right click on the message in the Problems View and select "Show Details..."

This is how my web.xml setup:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>BRAINSET</display-name>
  <context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Development</param-value>
  </context-param>
  <context-param>
    <param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
    <param-value>true</param-value>
  </context-param>
  <welcome-file-list>
    <welcome-file>index.xhtml</welcome-file>
  </welcome-file-list>
  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
  </servlet-mapping>
  <filter>
      <filter-name>Pretty Filter</filter-name>
      <filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>
      <async-supported>true</async-supported>
   </filter>

   <filter-mapping> 
      <filter-name>Pretty Filter</filter-name> 
      <url-pattern>/*</url-pattern> 
      <dispatcher>FORWARD</dispatcher> 
      <dispatcher>REQUEST</dispatcher> 
      <dispatcher>ERROR</dispatcher>
      <dispatcher>ASYNC</dispatcher>
   </filter-mapping>
</web-app>

And my pretty-config.xml :

<pretty-config xmlns="http://ocpsoft.org/prettyfaces/3.3.3" 
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
               xsi:schemaLocation="http://ocpsoft.org/prettyfaces/3.3.3
               http://ocpsoft.org/xml/ns/prettyfaces/ocpsoft-pretty-faces-3.3.3.xsd">

    <url-mapping id="home">
        <pattern value="/home" />
        <view-id value="/index.xhtml" />
    </url-mapping>

With this error I can't even deploy my app in Glassfish:

Could not publish to the server.
java.lang.NullPointerException

Any idea how to fix this ? Or should I look for another tool similar to prettyfaces ?

update

enter image description here

Valter Silva
  • 16,446
  • 52
  • 137
  • 218

2 Answers2

4

I don't think that this error is caused by PrettyFaces. The XML schema works fine in my Eclipse setup and I don't get any of these errors. And I'm pretty sure that the XSD file is valid.

You should have a look at the Eclipse log file (WORKSPACE/.metadata/.log) to have a look if there is any exception thrown.

BTW: You could also try to remove the schemaLocation element from your pretty-config.xml and check if this helps. PrettyFaces doesn't use the XSD schema when parsing the file. Something like this:

<pretty-config xmlns="http://ocpsoft.org/prettyfaces/3.3.3">
  ...
</pretty-config>
chkal
  • 5,598
  • 21
  • 26
  • Thank you very much! You were right! One strange thing tough, at prettyfaces[1] website it says to use with `XSD`, that's why I was using it. Well it seems that it doesn't at the end. Thank you once again friend. [1]http://ocpsoft.org/prettyfaces/ – Valter Silva May 15 '13 at 09:52
  • 1
    The schema is used just so that you get auto-complete when editing the XML in the IDE. It is valid as far as I know, but this sounds like a Glassfish bug to me. – Lincoln May 15 '13 at 15:15
  • @Lincoln see my answer below, I figured out what's wrong with the XSD – Jonathan S. Fisher Mar 12 '21 at 17:01
  • Hey @JonathanS.Fisher - Thanks! I update the XSD, let me know if that's better? – Lincoln Mar 14 '21 at 18:48
1

Finally figured this out.... so the reason this XSD isn't valid is because the document has this:

<?xml version="1.0" encoding="UTF-8" ?>

instead of:

<?xml version="1.0" encoding="UTF-8"?>

If anyone knows how to get ahold of Lincoln to fix this, that'd be great!

Jonathan S. Fisher
  • 8,189
  • 6
  • 46
  • 84