IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Frameworks Web Java Discussion :

Erreur "Target Unreachable, identifier 'helloWorld' resolved to null"


Sujet :

Frameworks Web Java

  1. #1
    Rédacteur
    Avatar de thierryler
    Homme Profil pro
    Inscrit en
    Octobre 2007
    Messages
    4 078
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Octobre 2007
    Messages : 4 078
    Points : 12 815
    Points
    12 815
    Par défaut Erreur "Target Unreachable, identifier 'helloWorld' resolved to null"
    Bonjour,

    J'ai une erreur toute conne dans mon appli (sous tomcat 6) mais je suis tellement dans les nuages que je ne trouve pas seul. Quelqu'un peut-il m'aider ?

    En gros, je travaille sur un POC de Seam 3. Je build mon projet avec Maven 3.

    Mon projet est composé de 2 modules : seampoc-web et seampoc-domain.

    Le pom de seampoc-web :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
     
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    	<modelVersion>4.0.0</modelVersion>
    	<parent>
    		<groupId>com.icauda</groupId>
    		<artifactId>seampoc</artifactId>
    		<version>0.1</version>
    		<relativePath>../pom.xml</relativePath>
    	</parent>
    	<groupId>com.icauda</groupId>
    	<artifactId>seampoc-web</artifactId>
    	<packaging>war</packaging>
    	<name>WEB SEAM POC</name>
    	<description>Web Seam POC</description>
    	<url>http://www.icauda.com</url>
     
     
    	<dependencies>
     
    		<dependency>
    			<groupId>com.icauda</groupId>
    			<artifactId>seampoc-domain</artifactId>
    			<version>${poc.version}</version>
    		</dependency>
     
    		...
    Dans le module seampoc-domain, j'ai la classe HelloWorld (ouais je bug pas fort) :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
     
    package com.icauda.seampoc.domain;
     
    @Model
    public class HelloWorld {
    	private final String text = "Hello, World!";
     
    	private String letters;
     
    	private String numbers;
     
    	private String email;
     
    	public HelloWorld() {
    	}
    	...
    J'appelle HelloWorld depuis un xhtml qui est un simple copié collé de celui généré par l'archetype.

    Mais j'obtiens l'erreur suivante :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
     
    1 août 2011 09:34:40 com.sun.faces.lifecycle.ProcessValidationsPhase execute
    ATTENTION: /index.xhtml @20,76 value="#{helloWorld.letters}": Target Unreachable, identifier 'helloWorld' resolved to null
    javax.el.PropertyNotFoundException: /index.xhtml @20,76 value="#{helloWorld.letters}": Target Unreachable, identifier 'helloWorld' resolved to null
    	at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:97)
    	at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:91)
    	at javax.faces.component.UIInput.getConvertedValue(UIInput.java:1023)
    	at javax.faces.component.UIInput.validate(UIInput.java:953)
    	at javax.faces.component.UIInput.executeValidate(UIInput.java:1204)
    	at javax.faces.component.UIInput.processValidators(UIInput.java:693)
    	at javax.faces.component.UIForm.processValidators(UIForm.java:240)
    	at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1081)
    	at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1081)
    	at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1159)
    	at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:72)
    	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
    	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
    	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
    	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    	at java.lang.Thread.run(Thread.java:662)
    Par contre, quand je met HelloWorld dans le module seampoc-web (dans le package com.icauda.seampoc.domain), là ça marche...

    J'ai dû oublier un truc vraiment tout con. Donc si quelqu'un a une idée...

    Évidement c'est seampoc-web qui contient le web.xml :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
     
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    	version="3.0">
     
     
    	<context-param>
    		<param-name>javax.faces.PROJECT_STAGE</param-name>
    		<param-value>Development</param-value>
    	</context-param>
     
    	<context-param>
    		<param-name>org.apache.myfaces.annotation.SCAN_PACKAGES</param-name>
    		<param-value>com.icauda.seampoc.web</param-value>
    	</context-param>
     
     
    	<display-name>WEB SEAM POC</display-name>
     
     
    	<!-- Activate the JSF 2.0 servlet -->
    	<servlet>
    		<servlet-name>Faces Servlet</servlet-name>
    		<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    		<load-on-startup>1</load-on-startup>
    	</servlet>
     
    	<!-- Tell the context which URLs to process with JSF -->
    	<servlet-mapping>
    		<servlet-name>Faces Servlet</servlet-name>
    		<url-pattern>*.jsf</url-pattern>
    	</servlet-mapping>
     
    	<!-- This section is optional. We are allowing index.jsf to handle the root 
    		URL (i.e., /). -->
    	<welcome-file-list>
    		<!-- Add additional files here, if desired, for example: <welcome-file>index.html</welcome-file> -->
    		<welcome-file>index.jsf</welcome-file>
    	</welcome-file-list>
     
    	<!-- Weld Jetty/Tomcat specific configuration parameters -->
    	<!-- *** The <listener> and <resource-env-ref> elements can be deleted when 
    		running in a Java EE 6 container *** -->
    	<listener>
    		<listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
    	</listener>
     
    	<!-- JAX-RS 1.1 configuration through Jersey -->
    	<servlet>
    		<servlet-name>Jersey Web Application</servlet-name>
    		<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
    		<init-param>
    			<param-name>com.sun.jersey.config.property.packages</param-name>
    			<param-value>com.icauda.seampoc.web</param-value>
    		</init-param>
    		<load-on-startup>1</load-on-startup>
    	</servlet>
     
    	<servlet-mapping>
    		<servlet-name>Jersey Web Application</servlet-name>
    		<url-pattern>/rest/*</url-pattern>
    	</servlet-mapping>
    	<!-- End Jersey JAX-RS configuration -->
     
    	<resource-env-ref>
    		<description>Object factory for the CDI Bean Manager</description>
    		<resource-env-ref-name>BeanManager</resource-env-ref-name>
    		<resource-env-ref-type>javax.enterprise.inject.spi.BeanManager</resource-env-ref-type>
    	</resource-env-ref>
     
     
    	<servlet>
    		<servlet-name>OneServlet</servlet-name>
    		<servlet-class>com.icauda.seampoc.web.OneServlet</servlet-class>
    		<load-on-startup>1</load-on-startup>
    	</servlet>
    	<servlet-mapping>
    		<servlet-name>OneServlet</servlet-name>
    		<url-pattern>/OneServlet</url-pattern>
    	</servlet-mapping>
     
     
     
    	<!-- Use Seam Catch for these -->
    	<!-- <error-page> <exception-type>org.jboss.seam.security.NotLoggedInException</exception-type> 
    		<location>/home.xhtml</location> </error-page> <error-page> <exception-type>org.jboss.seam.security.AuthorizationException</exception-type> 
    		<location>/denied.xhtml</location> </error-page> <error-page> <error-code>500</error-code> 
    		<location>/error.xhtml</location> </error-page> -->
     
    </web-app>
    Th.
    Thierry Leriche-Dessirier
    Consultant Java JEE Web Agile freelance
    Rédacteur pour Developpez
    Professeur de Génie Logiciel à l'ESIEA

    Site : http://www.icauda.com / Linked'in : http://www.linkedin.com/in/thierryler / Twitter : @ThierryLeriche

  2. #2
    Membre expert
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2007
    Messages
    2 938
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Juin 2007
    Messages : 2 938
    Points : 3 938
    Points
    3 938
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Target Unreachable, identifier 'helloWorld' resolved to null
    Dans ton faces config tu n'as pas déclaré le managedBean de nom helloworld
    Vous avez peut être hâte de réussir et il n'y a rien de mal à cela...
    mais la patience est aussi une vertu; l'échec vous l'enseignera certainement..."

  3. #3
    Rédacteur
    Avatar de thierryler
    Homme Profil pro
    Inscrit en
    Octobre 2007
    Messages
    4 078
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Octobre 2007
    Messages : 4 078
    Points : 12 815
    Points
    12 815
    Par défaut
    Comment ça se fait que ça marche quand le béant est dans le même module mais que ça ne marche pas quand il est dans un autre module ? Si je dois faire les annotation ET le config c'est chiant
    Thierry Leriche-Dessirier
    Consultant Java JEE Web Agile freelance
    Rédacteur pour Developpez
    Professeur de Génie Logiciel à l'ESIEA

    Site : http://www.icauda.com / Linked'in : http://www.linkedin.com/in/thierryler / Twitter : @ThierryLeriche

  4. #4
    Membre averti
    Homme Profil pro
    Inscrit en
    Avril 2011
    Messages
    214
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Avril 2011
    Messages : 214
    Points : 338
    Points
    338
    Par défaut
    Citation Envoyé par thierryler Voir le message
    Comment ça se fait que ça marche quand le béant est dans le même module mais que ça ne marche pas quand il est dans un autre module ? Si je dois faire les annotation ET le config c'est chiant
    Je ne connais pas trop (~du tout) Seam et MyFaces mais j'ai déjà rencontré un problème similaire avec Spring qui fait aussi du scan de package pour détecter des annotations.

    Et je pense qu'il doit scanner uniquement ton War et pas le Jar de ton module seampoc-domain

  5. #5
    Membre averti
    Homme Profil pro
    Inscrit en
    Avril 2011
    Messages
    214
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Avril 2011
    Messages : 214
    Points : 338
    Points
    338
    Par défaut
    En cherchant (parce que ça m'intrigue ) un peu je suis tombé sur ça:
    Usually, Seam components are installed when the deployment scanner discovers a class with a @Name annotation sitting in an archive with a seam.properties file or a META-INF/components.xml file.
    (source)

    Donc il faut bien que la classe soit scannée et cela se fait au niveau de l'archive (ce qui pourrait expliquer que ça marche dans le war mais pas le jar).

    C'est a priori pas la bonne version mais le comportement du "deployment scanner" n'a pas forcément changé depuis donc peut être une piste à creuser

  6. #6
    Rédacteur
    Avatar de thierryler
    Homme Profil pro
    Inscrit en
    Octobre 2007
    Messages
    4 078
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Octobre 2007
    Messages : 4 078
    Points : 12 815
    Points
    12 815
    Par défaut
    Bonjour,

    Je rentre de vacances et je découvre mon ordi formaté (arf) mais j'ai encore le sujet en tête. Je ne sais pas par où commencer en fait.
    Thierry Leriche-Dessirier
    Consultant Java JEE Web Agile freelance
    Rédacteur pour Developpez
    Professeur de Génie Logiciel à l'ESIEA

    Site : http://www.icauda.com / Linked'in : http://www.linkedin.com/in/thierryler / Twitter : @ThierryLeriche

Discussions similaires

  1. Réponses: 3
    Dernier message: 26/01/2015, 09h00
  2. Réponses: 0
    Dernier message: 21/11/2014, 17h00
  3. Réponses: 4
    Dernier message: 29/08/2012, 14h20
  4. Réponses: 7
    Dernier message: 25/05/2011, 19h07
  5. Réponses: 1
    Dernier message: 29/09/2010, 16h15

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo