specialist33
2004-10-10 15:02:48 UTC
I'm getting an incomprehensible "is not a valid ref" error. I've spent
some hours trying to solve it, but I'm not being helped by the fact that
I cannot seem to find a way of getting velocity to tell me what WOULD be
a valid reference or WHY this is not a valid ref.
These would seem to be obvious components of that error message, yet are
absent and despite having re-read the developer and user guides several
times I can't see a way at getting at that info (surely there is some way?)
(Basically, I expected there to be something that would do the same as
javap, except from Velocity's perspective, so that you could see what it
thought it could see)
Anyway, the problem is this.
1. I have an interface, iAccount
2. Which has several methods, including: public String getLogin();
3. I have a class that implements that, BaseAccount
4. I insert a valid BaseAccount instance in the velocity context
(context.put( "account", instance );)
5. I have a template with:
<html>
<body>
<h1>Testing cookies.</h1>
Checking to see if a cookie was sent that was interpreted as an account
<p>
Value of account in template context is:
$account.class
$account
${account.class.name}
<p>
Value of "account.getLogin()" in template context is $account.getLogin()
<p>
Value of "account.getLogin" in template context is $account.getLogin
<p>
Value of "account.Login" in template context is $account.Login
</body>
</html>
i.e. there are 6 uses of the account ref.
6. When I run the template, the first 3 refs all report that $account is
a BaseAccount instance (the second does this because it has a default
toString(), which as you know outputs the classname by default)
7. BUT the other three references are passed through unchanged, and
trigger log messages about "is not a valid reference".
8. BaseAccount is a "public class" and iAccount is a "public interface".
9. javap output on BaseAccount reveals:
Compiled from "BaseAccount.java"
public class [snip package].BaseAccount extends java.lang.Object
implements [snip package].iAccount{
protected java.lang.String login;
protected java.lang.String password;
public [snip package].BaseAccount();
public java.lang.String getLogin();
[snip other methods]
}
AFAICS I've done everything correctly. OBviously, I haven't. But I can't
for the life of me work out what I've done wrong. Sob.
Any suggestions?
PS: this is velocity 1.4 running on java 1.4.2_05 on linux
some hours trying to solve it, but I'm not being helped by the fact that
I cannot seem to find a way of getting velocity to tell me what WOULD be
a valid reference or WHY this is not a valid ref.
These would seem to be obvious components of that error message, yet are
absent and despite having re-read the developer and user guides several
times I can't see a way at getting at that info (surely there is some way?)
(Basically, I expected there to be something that would do the same as
javap, except from Velocity's perspective, so that you could see what it
thought it could see)
Anyway, the problem is this.
1. I have an interface, iAccount
2. Which has several methods, including: public String getLogin();
3. I have a class that implements that, BaseAccount
4. I insert a valid BaseAccount instance in the velocity context
(context.put( "account", instance );)
5. I have a template with:
<html>
<body>
<h1>Testing cookies.</h1>
Checking to see if a cookie was sent that was interpreted as an account
<p>
Value of account in template context is:
$account.class
$account
${account.class.name}
<p>
Value of "account.getLogin()" in template context is $account.getLogin()
<p>
Value of "account.getLogin" in template context is $account.getLogin
<p>
Value of "account.Login" in template context is $account.Login
</body>
</html>
i.e. there are 6 uses of the account ref.
6. When I run the template, the first 3 refs all report that $account is
a BaseAccount instance (the second does this because it has a default
toString(), which as you know outputs the classname by default)
7. BUT the other three references are passed through unchanged, and
trigger log messages about "is not a valid reference".
8. BaseAccount is a "public class" and iAccount is a "public interface".
9. javap output on BaseAccount reveals:
Compiled from "BaseAccount.java"
public class [snip package].BaseAccount extends java.lang.Object
implements [snip package].iAccount{
protected java.lang.String login;
protected java.lang.String password;
public [snip package].BaseAccount();
public java.lang.String getLogin();
[snip other methods]
}
AFAICS I've done everything correctly. OBviously, I haven't. But I can't
for the life of me work out what I've done wrong. Sob.
Any suggestions?
PS: this is velocity 1.4 running on java 1.4.2_05 on linux