Search
Calendar
November 2017
S M T W T F S
« Sep    
 1234
567891011
12131415161718
19202122232425
2627282930  
Your widget title
Archives

Posts Tagged ‘long tweet’

PostHeaderIcon (long tweet) This page calls for XML namespace declared with prefix body but no taglibrary exists for that namespace.

Case

On creating a new JSF 2 page, I get the following warning when the page is displayed:

Warning: This page calls for XML namespace declared with prefix body but no taglibrary exists for that namespace.

Fix

In the XHTML page, replace the HTML 4 headers:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>...</html>

with XHTML headers:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html">
...</html>

PostHeaderIcon (long tweet) Add RichFaces to a Maven / JSF 2 project

Case

You have a JSF 2 project that you need upgrade with jBoss RichFaces and Ajax4JSF, (I assume the process is similar for other libraries, such as Primefaces, ICEfaces, etc.).

Quick Fix

In XHTML

In XHTML pages, add the namespaces related to Richfaces:

      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich"

In Maven

In Maven’s pom.xml, I suggest to add a property, such as:

    <properties>
        <richfaces.version>4.1.0.Final</richfaces.version>
    </properties>

Add the following dependency blocks:

<dependency>
    <groupId>org.richfaces.ui</groupId>
    <artifactId>richfaces-components-ui</artifactId>
    <version>${richfaces.version}</version>
</dependency>
<dependency>
    <groupId>org.richfaces.core</groupId>
    <artifactId>richfaces-core-impl</artifactId>
    <version>${richfaces.version}</version>
</dependency>

PostHeaderIcon (long tweet) “Hello world” with JSF 2.0, Tomcat 7 and IntelliJ IDEA 12 EAP “Leda”

(disclaimer: this “long tweet” has absolutely no interest, except playing with Tomcat 7 and “Leda”)

Friday is technical scouting… Today it will be a “Hello World!”.

  • Get the code and project available on this page: http://www.mkyong.com/jsf2/jsf-2-0-hello-world-example/
  • Get and install Tomcat 7 (very nice new home page)
  • Get and install IntelliJ IDEA 12 EAP “Leda”
  • Launch IDEA
  • Create a new project on existing sources, select the pom.xml of the project above.
  • Build with Maven
  • In IDEA:
    • Run Configuration
    • Tomcat Server
    • Startup Page: http://localhost:8080/
    • Deployment
    • Add
    • Artifact…
    • select the WAR
    • OK
  • This launches Tomcat 7. You can connect http://localhost:8080/

Actually, I’m sure you can deploy with Tomcat-Maven plugin, ie without actual Tomcat install.

PostHeaderIcon (long tweet) Increase choice with mvn archetype:generate

By default, mvn archetype:generate offers ~50 template projects. How to offer more templates?

Actually, Maven bases itself on a archetype-catalog.xml file, in Maven’s local repository. Updating this file is possible, by mvn archetype:crawl (and/or archetype:update-local-catalog ?).
Anyway, Maven can base on a remote repository, using archetypeCatalog, such as:

mvn archetype:generate -DarchetypeCatalog=http://download.java.net/maven/2

You can hint at the remote repository available in settings.xml file, for instance.

PostHeaderIcon (long tweet) JOnAS / GenIC / Method … of interface … should NOT throw RemoteException

Case

On generating Locals and Remotes of EJBs (let’s say JonathanBean) to be deployed on JOnAS, the GenIC raises:

GenIC.fatalError : GenIC fatal error: Cannot read the Deployment Descriptors from /foo/goo/jonathan-server.jar: Method foo of interface lalou.jonathan.JonathanLocal should NOT throw RemoteException

Within the EJB2, the method foo is declared to be Local and to throw RemoteException

Quickfix

The error is explicit.

A Local EJB cannot throw RemoteException.
Especially, the considered method can be declared with the right XDocLet tag, ie:

* @ejb.interface-method view-type="remote"

but can with neither:

* @ejb.interface-method view-type="both"

nor:

* @ejb.interface-method view-type="local"

As a quickfix, I suggest to surround with a try/catch block a throw a RuntimeException if needed.