We have an issue on our production system and some of our test systems. We have an intermittent Grails Exception which occurs in a view.
No signature of method: static org.apache.commons.lang.StringUtils.isNotBlank() is applicable for argument types: (null) values: [null] Possible solutions: isNotBlank(java.lang.String), isBlank(java.lang.String)
The error seems to suggest that Grails can't seem to figure out that it should use StringUtils.isNotBlank(String) should be used when null is passed to it.
We noticed that:
on production, the issue appeared and took more than 12 hours before it seemed to magically disappear. A search of logs seems to suggest that no reboot took place.
a developer saw no issue on a test system in the morning. After a few hours, he was able to reproduce it. To resolve, we rebooted Tomcat.
I'm not sure what the Grails version is or how to check it. If you comment below on how to find that, I'd be happy to edit the question with the Grails version.
What causes this and is there a way we can reliably reproduce it?
Is there a reliable way to work around it?
I can reproduce this in the console by running:
org.apache.commons.lang.StringUtils.isNotBlank((Object)null) => Your Error
Passing just null allows the compiler to coerce the null to a String:
org.apache.commons.lang.StringUtils.isNotBlank(null) => false
It's possible whatever you are passing in is strictly typed to be something other than a String but is null. The Groovy compiler is pretty smart of coercing types, but I have seen it blow up on some easy cases. This is especially true if using #CompileStatic and/or using native Java objects.
A reliable workaround is that we restart the application.
Horrible answer, I know. I feel dirty every time.
I recently experienced this as well. Turns out, we had a piece of code that was passing in a Long to StringUtils.isNotEmpty(). Every subsequent call made to this method having a String value of null, errored with the same MissingMethodException.
You can replicate this pretty easily by executing...
String string = null
Long longVal = new Long("1103384")
try{
StringUtils.isNotEmpty(longVal)
}catch(Exception e){
e.printStackTrace()
}
try{
if(!StringUtils.isNotEmpty(string)){
println("............EMPTY. Good.")
}
}catch(Exception e){
e.printStackTrace()
}
In the snipped above BOTH calls with error out.
Related
After upgrading to Vaadin 23.0.x (from former 22.0.2) I now keep getting the following error when opening a certain dialog:
2022-08-01 18:56:25,977 ERROR [http-nio-8085-exec-5] net.mmo.utils.kism.ui.views.nodes.NodeView: java.lang.IllegalStateException: All bindings created with forField must be completed before calling readBean
at com.vaadin.flow.data.binder.Binder.checkBindingsCompleted(Binder.java:3070)
at com.vaadin.flow.data.binder.Binder.readBean(Binder.java:2110)
at net.mmo.utils.kism.ui.views.nodes.NodeForm.readBean(NodeForm.java:487)
at net.mmo.utils.kism.ui.views.nodes.NodeForm.setNode(NodeForm.java:211)
This dialog has worked perfectly fine since I wrote it (using version 18.0.x about 2 years ago) and up to v22.0.2. I can't make sense of that error message and I don't understand what the issue could be here. I verified that issue going back and forth and the difference is really only the Vaadin version upgrade. Before it, the dialog works just fine and after it I get the above Exception when opening it.
I also can't quite believe what I think the message is stating here: if it would indeed check that I define or complete any bindings AFTER calling Binder.readBean() - how could it know that already in that very moment, i.e. when the code calls readBean() - as indicated by the stacktrace?
If there would indeed be any bindings being defined afterwards, IMHO it could only find that out AFTER said readBean()-call, i.e. when any additional bindings were actually defined, couldn't it?
So, could someone please try to "translate" or explain that issue or the background behind it to me?
The error basically states the problem: in the process of binding a field to a property (or getter/setter in general), the finishing step of actually binding was not undertaken. So the process was started with .forField() but never finished by .bind().
Since the error message as of now only states the fact, but not the culprit, a developer would be in need of a debugger to inspect the private state of the Binder, where the map incompleteBindings holds the current state of the Binder. The content of this map may help to find the culprit, e.g. by only holding one entry and by inspecting the flow of the program so far, that would conclude, what binding attempt failed. Or e.g. via the included field types.
Other than plain "bugs" by the developer, there are some potential reasons, why this suddenly happens by like an update or what places to look for:
multiple (re-)binding was recently added (e.g. to first bind "automatically" and then hand-tune the result); this holds potential, that older versions of the code just kept the initial binding and ignored the dangling second process.
the binding process uses a builder pattern; builder must build up on the result of the previous steps. This means, that in imperative code, there is the chance, that this chained call miss reassigning the build step. E.g.
var b = binder.forField(field)
if (predicate)
b.asRequired() // XXX: should be `b = b.asRequired()`
b.bind(...)
(this may or may not be a source for this kind of problem, but it's good to point out here, since the binder builder implementation actually switche(s|d) the builder (in the past)
I've suddenly started getting a MissingMethodException in my Grails 2.2.5 app, without any change in code and the error is seemingly spurious, so I'm suspecting corruption somewhere. I'm getting this error:
No signature of method: arthurs.Sale.findByCustomerAndComplete() is applicable for argument types: (arthurs.Customer, java.lang.Boolean) values: [arthurs.Customer : 59, false]
Possible solutions: findByCustomerAndComplete([Ljava.lang.Object;). Stacktrace follows:
Message: No signature of method: arthurs.Sale.findByCustomerAndComplete() is applicable for argument types: (arthurs.Customer, java.lang.Boolean) values: [arthurs.Customer : 59, false]
Possible solutions: findByCustomerAndComplete([Ljava.lang.Object;)
This worked fine until yesterday. The Sale class does in fact have 'customer' (Customer class) and 'complete' (Boolean) properties, and I've checked that what I'm passing are valid parameters. In any case, the error message does specify the argument types and these are correct.
So why might my dynamic 'findBy...' method suddenly stop working? In the past I've often found doing a 'grails clean' often sorts such things out but it doesn't seem to have helped with this one.
Is there something else I should clear out, to give myself a blank slate?
Well, don't know what had happened there but deleting the project folder from '.grails/2.2.5/projects' did the trick.
LATER: No, the problem has returned. Very puzzled by this now.
LATER STILL: Well, I've now determined what it is that triggers the problem, although I am completely baffled as to why it does so. If I add a 'created' property of type Date to my Sale class, the problem recurs and remains until I remove the property, remove the column from the MySQL table, and delete the project folder. If, however, I mark this property as nullable in constraints, it works OK. ???
I'm trying to connect my Windows XP program (Lazarus) to my Ubuntu postgres server.
When the Lazarus program runs, it seems to compile fine but I get this error:
Project ... raised exception class 'RunError(211)'.
Then it terminates execution (and I don't see any output), and opens up a file customform.inc. In that file, it shows a procedure procedure TCustomForm.DoCreate; where it highlights a line: if Assigned(FOnCreate) then FOnCreate(Self);
I believe this is one of the system's files.
I never get to see any output.
What could this be? Thanks!
MORE INFO:
I've narrowed down the error to this line:
dbQuery_Menu.SQL.Text:='Select * From "tblMenus"';
dbQuery_Menu.Open;
the exception is triggered when the OPEN statement gets executed.
BTW, dbQuery_Menu is defined as a TSQLQuery component.
Clueless! :(
Run error 211 appears when you try to call an abstract method. Check this link from more information on FreePascal/Lazarus runtime errors.
Since you say all is done by code and you have no visual components, the problem probably lies in your code trying to use an ancestor component which has not overriden the Open method. You should be able to solve this by using the correct descendant component.
Another possibility, although I would strongly recommend to avoid this one, is to override the Open method yourself. It should be avoided because if you are using an ancestor component then you probably would have to override more abstract methods.
HTH
After nearly 5 days I found the answer. Many thanks to all thos e ho have contributed with their ideas ESPECIALLY RRUZ, RBA and Guillem Vicens. there are other related posts all connected to getting the FIRST Lazarus program working with PostgreSQL.
Summary.
The biggest mistake I made here was that I used the TSQLConnection component. Don't do this. Instead use the TPQConnection.
Everything is done through code. We're not using any draggable components from the top tab.
Don't rely on the Lazarus docs (wiki) at least for working with PG DBs.. It is outdated. Some of the examples can be pretty misleading.
Make sure that fields have some default values. For example, if a Boolean field has no true or false (t/f) set, this may lead to errors.
And that's it! I hope many postgres+Lazarus newbies will find this useful.
From here - http://www.network-theory.co.uk/docs/postgresql9/vol2/SQLSTATEvsSQLCODE.html - -211 (ECPG_CONVERT_BOOL) This means the host variable is of type bool and the datum in the database is neither 't' nor 'f'. (SQLSTATE 42804)
Every once in awhile, in ways that seem unpredictable to me, the code line
if not CDS.Locate('Name',aName,[]) then ...
resolves true (i.e., cannot find the string aName in the field 'Name') even though I know there is a record. I can close and reopen the application, load the exact same file, run the exact same command--repeat all my actions, in other words--and have everything work as expected the next time through. And the time after that. I can even just reopen the same file, and the code will run as expected ... I don't know what the issue is and, frankly, with something intermittent like this I don't even know where to look!
Any thoughts about where to start? ...
In delphi XE7 there is a serious problem TClientDataSet.Locate and it does not work with some fields look at QualityCentral [127703]
I just splited a project in a few libraries.
And I have the strange error in the title.
I can't explain myself why it is the case.
Also, this error used to show up only in FSI.exe
I thought it was because of pb with loading dll in fsi but there is more to this.
It might be a stupid error (probably is..) but if anyone encoutered this sybillin error message before and knows what happens, I'd be glad to hear it.
UPDATE
I thought it was namespace issues, but it is not.
This issue is very odd. Please ignore it if you did not experienced it. I am still trying to pinpoint the exact origin.
Without more information it's hard to know for sure. One way this could happen is if you end up redefining a type in FSI without redefining some things that depend on it. Then those things expect the old version of the type, but you end up creating instances of the new version, which are not compatible. For instance, given this code:
type MyType<'a>() = class end
let myFun (_:MyType<int>) = 0
let result = myFun (MyType())
If I send the first two lines to FSI, then the first line again by itself, and then the third line, I get something similar to your error message. The solution is to re-evaluate all dependent definitions.