I already tried to add the setters, without success. But Itried to access
Home and I got an error regarding my Logger :



My Home.java
public class Home {
...

  @Inject
  private Logger logger;

  String refreshList() {
    try {
      logger.debug("Processiong refreshList...");
      users = applicationService.getUserList().getUserList();
      logger.debug("User lists set to page.");
    }
    catch (PapoException pe) {
      logger.error("Failed to get the user list. Nothing set in the page!");
      return FAILURE;
    }
    return SUCCESS;
  }
}

And now I have this error :
org.apache.tapestry.internal.services.TransformationException: Error
obtaining injected value for field papo.pages.Home.logger: No service
implements the interface org.apache.log4j.Logger.

I thought Tapestry know everything about logging and in the documentation it
says   @Inject private Logger logger; was enought.

Usually I used log4j  like that :
private static Logger logger = Logger.getLogger(MyClass.class.getName());
but Howard told me in a old and previous mailing to not use the logging like
that... So, how to use the logger in T5?


2007/11/4, Nick Westgate <[EMAIL PROTECTED]>:
>
> Try adding setters to your fields.
>
> Cheers,
> Nick.
>
>
> Josh Canfield wrote:
> >>   @InjectPage
> >>   private Home home;
> >>
> >
> > The error message seems a little strange, but the code above is
> injecting a
> > page called Home. Does that page load correctly if accessed directly?
> >
> > Josh
> >
> > On 11/3/07, Michael Bernagou <[EMAIL PROTECTED]> wrote:
> >> Everything worked perfectly, but since I upgraded to T5.0.6, it fails
> for
> >> an
> >> understandable reason!
> >>
> >> I replaced my html by tml and placed them in the right place. I upgrade
> >> log4j to get the latest and add the new logging api (to avoid runtime
> >> error).
> >> The thing is really strange...
> >>
> >> My Start.tml
> >>
> >> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> >>    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> >> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
> >> <head>
> >> <title>Paper and Pen Online - Identification</title>
> >> </head>
> >> <body>
> >> <p style="color:red;"><b>${message}</b></p>
> >> <t:form tracker="login">
> >>   <t:errors/>
> >>   <t:parameter name="password">
> >>     <t:label for="password"/>
> >>     <t:passwordfield t:id="password" t:validate="required" value="
> >> login.password"/>
> >>   </t:parameter>
> >> </t:form>
> >> <p>Si vous n'avez pas encore de compte, <t:pagelink
> >> page="Register">crees-en
> >> un!!</t:pagelink></p>
> >> </body>
> >> </html>
> >>
> >>
> >> My Start.java
> >>
> >> public class Start {
> >>   private static final String SUCCESS = "Home";
> >>   private static final String FAILURE = "Start";
> >>
> >>   @ApplicationState
> >>   private Login login;
> >>   public Login getLogin() { return login; }
> >>
> >>   @Persist
> >>   private String message;
> >>   public String getMessage() { return message; }
> >>
> >>   @ApplicationState
> >>   private User user;
> >>
> >>   @InjectPage
> >>   private Home home;
> >>
> >>   @Inject
> >>   private UserService userService;
> >>
> >>   @Inject
> >>   private ApplicationService applicationService;
> >>
> >>   String onSuccess() {
> >>     message = null;
> >>
> >>     try {
> >>       user = userService.getAuthenticatedUser(login.getLogin(),
> >> login.getPassword());
> >>       if (user != null) {
> >>         home.setUser(user);
> >>         UserLite userLite = new UserLite(user.getLogin());
> >>         applicationService.makeOnline(userLite);
> >>         home.setUsers(applicationService.getUserList().getUserList());
> >>       }
> >>       else {
> >>         message = "Login ou Password inconnue. L'identification a
> >> échoué.";
> >>         return FAILURE;
> >>       }
> >>     }
> >>     catch (PapoException pe) {
> >>       message = "La procedure d'identification a rencontré un probleme
> >> !!";
> >>       return FAILURE;
> >>     }
> >>     return SUCCESS;
> >>   }
> >> }
> >>
> >> And the error :
> >>
> >> Could not convert 'message' into a component parameter binding:
> >> java.lang.NoClassDefFoundError: papo/pages/Home
> >> location context:Start_fr.tml, line 8, column 363<html xmlns:t="
> >> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd
> ">4<head>5<title>Paper
> >> and Pen Online - Identification</title>6</head>7<body>8<p
> >> style="color:red;"><b>${message}</b></p>9<t:form
> >> tracker="login">10<t:errors/>
> >> 11 <t:parameter name="password">12 <t:label
> >> for="password"/>13<t:passwordfield t:id="password"
> >> t:validate="required" value="
> >> login.password"/>So, the tml is found, read, interpreted but for a
> reason
> >> I
> >> don't understand it refer to my class Home which is in the same package
> >> than
> >> my class Start.
> >> I have a Register page (tml + java) and it give me exactly the same
> error!
> >>
> >> No error at runtime, no compilation error (Inject are the new Inject,
> for
> >> example).
> >>
> >> Thanks
> >>
> >> --
> >> Michael Bernagou
> >> Java Developper
> >>
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Michael Bernagou
Java Developper

Reply via email to