I've got a JSF1.2 application which deploys fine on Tomcat6 and Tomcat7.
So far so good.
One of the pages contains the following property on a h:inputText:
disabled="#{quoteFinance.quoteSaved or quoteRequest.quoteDisabled or setting.protected}"
This validates and works fine on aforementioned Tomcat servers.
However, websphere8 believes this is a problem and throws the following error:
disabled="#{quoteFinance.quoteSaved or quoteRequest.quoteDisabled or setting.protected}" [protected] is not a valid Java identifier
at com.sun.facelets.tag.TagAttribute.getValueExpression(TagAttribute.java:259)
at com.sun.facelets.tag.jsf.ComponentRule$ValueExpressionMetadata.applyMetadata(ComponentRule.java:69)
at com.sun.facelets.tag.MetadataImpl.applyMetadata(MetadataImpl.java:36)
at com.sun.facelets.tag.MetaTagHandler.setAttributes(MetaTagHandler.java:76)
Cause:
javax.el.ELException: [protected] is not a valid Java identifier
at org.apache.el.parser.AstDotSuffix.setImage(AstDotSuffix.java:45)
at org.apache.el.parser.ELParser.DotSuffix(ELParser.java:1067)
at org.apache.el.parser.ELParser.ValueSuffix(ELParser.java:1033)
at org.apache.el.parser.ELParser.Value(ELParser.java:978)
at org.apache.el.parser.ELParser.Unary(ELParser.java:948)
at org.apache.el.parser.ELParser.Multiplication(ELParser.java:712)
at org.apache.el.parser.ELParser.Math(ELParser.java:632)
at org.apache.el.parser.ELParser.Compare(ELParser.java:444)
at org.apache.el.parser.ELParser.Equality(ELParser.java:338)
at org.apache.el.parser.ELParser.And(ELParser.java:282)
I had a similar issue with #{msg.continue} which is perfectly fine, but because continue is a reserved word, WAS8 throws me an error.
Why does websphere not accept this while the code is working perfectly?
How can I resolve this problem?
Many thanks!
This behaviour is as per EL specification. You need to rename the property name to something which isn't a Java literal, or you need to use the brace notation so that it can be referenced as String.
#{setting['protected']}
and
#{msg['continue']}
This should have failed in Tomcat 7 as well, perhaps you were using a rather old version of Tomcat 7. This was been "fixed" somewhere between 7.0.0 and 7.0.10. It's currently already at 7.0.28.
From the Expression Language 2.2 spec:
An identifier is constrained to be a Java identifier - e.g., no -, no /, etc.
protected can't be used as an identifier in Java as it is reserved.
This restriction applied in EL 2.1 too, so it was likely a bug in your old platform's EL parser that this ever worked.
"protected" is a java reserved word too! just like "continue"
Related
% java11 -Xlog:gc*:file=c:\max.txt -version
[0.002s][error][logging] Invalid decorator '\max.txt'.
Invalid -Xlog option '-Xlog:gc*:file=c:\max.txt', see error log for
details.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Apparently with Java 9 (and later) unified logging a colon is used as a separator between fields in the -Xlog arguments. So, how do I specify a Windows pathname that has a colon in it? Is there an escape of some kind? If I specify the filename as is, I get the error I included above. Thank you.
One of the ways suggested for solving that on the mailing list is using shell escapes like:
java -Xlog:gc*:file=\"C:\max.txt\" -version
Note that according to Dave Holmes' posting, only double quotes are supported. Depending on the shell, the escaping is necessary so that the Java command sees the quotes.
ANTLR4 4.7.1 generates a line in the parse.cs file that says
throw new RuntimeException("UNEXPECTED_CHAR=" + (_localctx._UNEXPECTED_CHAR!=null?_localctx._UNEXPECTED_CHAR.Text:null));
The exception doesnt exist. Its easy to fix by hand editing the generated code, but thats kind of annoying to have to do each iteration of grammer edit.
Using the built in c# support like this
java -jar c:\tools\antlr-4.7.1-complete.jar -Dlanguage=CSharp -visitor SQLite.g4
That line is not coming from ANTLR, it's coming from the grammar file you're using.
Assuming that you're using SQLite.g4 from the grammars-v4 repository, the culprit is the error rule on lines 37-42:
error
: UNEXPECTED_CHAR
{
throw new RuntimeException("UNEXPECTED_CHAR=" + $UNEXPECTED_CHAR.text);
}
;
So you can fix the problem by editing the grammar to either contain C# code instead of Java code or not contain any embedded code at all (it should be fine to just remove the error rule (and the one instance where it's used) altogether).
From all the weirdness in our current Xpages project this one currently hits the ceiling:
we have created a few java beans in our current project. Inside Domino Designer they all are stored below Code >> Java, so that it is clear that they are automatically part of the project's classpath. All our beans belong to a package structure de.edcom.* (that's what we have been using forever without any problems). The objects are mostly called from SSJS using the full package names (the aren't registered as managed beans for various reasons) as in
var o = de.edcom.myObject.someMethod();
In none of my previous Xpages projects this caused any problems, it just worked. In the current project, however the XSP runtime all of a sudden started to interpret the package name as a String object giving us this runtime error:
Unknown member 'edcom' in Java class 'java.lang.String'
the ssjs code line in question is looking like this:
return de.edcom.TOC.buildTOC();
We absolutely don't have any clue as to what could be causing this, why only in this project, and why it sometimes IS working, but mostly isn't.
There's one difference between this projects and others before, and that is locallization: users can switch between "english" and "german" locale, and of course we are using codes like
context.setLocaleString("de")
and of course we are having several javascript code fragments looking for local settings as in
if(context.getLocalString()==="de"){...
This morning we in fact have renamed / refactored all java beans to different package names (com.edcom.*), and since then the error hasn't appeared (fingers crossed!).
But then again I think this is just too stupid, there can't really be a connection, or can it?
EDIT:
I tried using importPackage(), in conjunction with an xe:objectData datasource (as recommended by Adrian and Paul in their answers), but I'm still receiving that "unknown member 'edcom' in Java class 'java.lang,String'" message, now only at a different position in the code at my line saying importPackage(de.edcom).
I'll be switching back to the "com.edcom" package and keep looking for a better solution; unfortunately searching for the string "de" inside the entire code yields close to 12.000 matches; now way to find the real reason for this in that haystack
EDIT #2:
looks like we finally found the dreaded "de" variable: it was well hidden in a computed customControl property; I don't have a clue why all the File Searches that I performed over the last few days couldn't find this one.
Anyways it is very good to know that we have to be even more careful when naming our ssjs variables; I never would have thought that a ssjs variable name could ever interfere with TLD parts in Java packages; we probably will make it an internal policy that our variables have to must be named "vDe", "vCom", "vIt" etc. instead of just short lowercase letters...
Probably you used a variable de (which is a String) in an other SSJS script that run before that one faces the problem.
I've seen similar issues that a variable that is not explicitly declared in an script block can inherit values from another script block.
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:this.beforeRenderResponse><![CDATA[#{javascript:
var ex1 = "Hello World";
var ex2 = "Bye bye"}]]>
</xp:this.beforeRenderResponse>
<xp:this.afterRenderResponse><![CDATA[#{javascript:
print("value ex1: " + ex1);
print("value ex2: " + ex2);}]]>
</xp:this.afterRenderResponse>
</xp:view>
results in:
[1CA8:000C-4354] 10.06.2016 14:33:01 HTTP JVM: value ex1: Hello World
[1CA8:000C-4354] 10.06.2016 14:33:01 HTTP JVM: value ex2: Bye bye
So you should use the importPackage() function to import the references to your java classes or much better, use managed beans or dataContexts.
SSJS requires variables which will be put in a scope. Anything with a dot in it will first go to those variables. It sounds like localization stores the translations in a variable named "de", that would explain your problem.
Maybe importPackage(de.edcom) and then using return TOC.buildTOC(); would resolve the problem. I would consider that better practice, but either way in SSJS you're risking variable name collisions.
Personally, I prefer to back every XPage with a controller Java class (I use Jesse Gallagher's frostillicus framework, and so it's always accessible with the variable pageController), so my SSJS just calls pageController.myMethod(), which then avoids all name collisions and allows Java imports to ensure I map to the right Java class. There are more basic ways of doing it, e.g. with an xe:dataObject at the top of every XPage.
When I run
C:\Windows\System32\inetsrv\appcmd.exe start site /site.name:"Some_site_name"
on Windows Server 2008 R2, it fails with message
ERROR ( hresult:800710d8, message:Command execution failed.
The object identifier does not represent a valid object.
)
... although the site exists.
I forgot to check if there is a binding present! Site without bindings cannot be started and the utility thinks that "The object identifier does not represent a valid object." is a good way to remind me of this.
When I encountered this error it was because I had a typo in Advanced Settings>Enabled Protocols.
Instead of specifying "http,NET.TCP" I had "http.NET.TCP" (note the comma/period difference) and that caused this error too.
It took me ages to spot it, so I'd thought I'd publish the solution just in case there's another, equally shortsighted, developer out there, scratching their head.
The Symfony documentation for twig mentions using form_start but when I try this in Silex I get this error
Twig_Error_Syntax: The function "form_start" does not exist
Is it possible to use this in Silex?
Other form function like form_row() and form_widget() work.
Edit: I am using symfony/form dev-master (945f91ee8729a8f16e5d5c87c4920694e6b10475)
and symfony/twig-bridge 2.2.x-dev (6ddcb37ae4b7275c14baf365c7513b9ffdd6e31c)
You're using a version of twig-bridge where it is not yet present.
form_start and form_end have been introduced by commit d0b896, and github tells us that 2.3.0 is the first release including it.
Also note that while you're using 2.2, you're browsing the docs for 2.3.