Hi all,
we have a strange problem with a BSH and no idea where the error could be. We're retrieving data by using a delegator.findByPrimaryKey() and a GenericValue is returned correctly. The data is put into a map by using values.getString() calls. The script works fine when it's called after a HTTP POST-request, but after being called in a request chain after a service, we receive this strange error: ------------- org.ofbiz.base.util.GeneralException: Error rendering screen [component://srm/widget/CommonScreens.xml#Edit]: org.ofbiz.base.util.GeneralException: Error running BSH script at location [component://srm/webapp/srm/WEB-INF/path/to/Fetch.bsh]: org.ofbiz.base.util.GeneralException: Error running BSH script at [component://srm/webapp/srm/WEB-INF/path/to/Fetch.bsh], line [15]: Sourced file: component://srm/webapp/srm/WEB-INF/path/to/Fetch.bsh : null : at Line: 15 : in file: component://srm/webapp/srm/WEB-INF/path/to/Fetch.bsh : issue .getString ( "srmIssueId" ) ------------- Stack trace: ------------ [java] Target exception: java.lang.NullPointerException: Null Pointer in Method Invocation [java] (Sourced file: component://srm/webapp/srm/WEB-INF/actions/EditIssue/FetchIssue.bsh : null) [java] org.ofbiz.base.util.BshUtil.runBshAtLocation(BshUtil.java:184) [java] org.ofbiz.widget.screen.ModelScreenAction$Script.runAction(ModelScreenAction.java:386) [java] org.ofbiz.widget.screen.ModelScreenAction.runSubActions(ModelScreenAction.java:116) [java] org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:238) [java] org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:135) [java] org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:106) [java] org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:91) [java] org.ofbiz.widget.screen.ScreenWidgetViewHandler.render(ScreenWidgetViewHandler.java:78) [java] org.ofbiz.webapp.control.RequestHandler.renderView(RequestHandler.java:603) [java] org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:388) [java] org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:343) [java] org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:183) [java] org.ofbiz.webapp.control.ControlServlet.doPost(ControlServlet.java:79) [java] javax.servlet.http.HttpServlet.service(HttpServlet.java:615) [java] javax.servlet.http.HttpServlet.service(HttpServlet.java:688) [java] org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) [java] org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) [java] org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:249) [java] org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) [java] org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) [java] org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) [java] org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) [java] org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) [java] org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) [java] org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) [java] org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541) [java] org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) [java] org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) [java] org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) [java] org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) [java] org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) [java] org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) [java] java.lang.Thread.run(Thread.java:595) ------------ Line 15 from Fetch.bsh: ------------- parameters.put("issueId", issue.getString("issueId")); ------------- The problem is calling the method. At first I thought the problem might be that issue is null, but it's really the correct result from the Entity Engine. Could anyone of you give me an advice how to debug this BSH? There must be anything I could try in the core of OFBiz, but I don't know which class to use. Shall I try to debug the BSH interpreter? Has perhaps anyone any experience in doing that? TIA! :) Best regards, Fabian aka "I'm getting crazy with this error" ;). |
Without getting my hands too dirty with your error,
have you tried entering the string that you expect to be returned instead of calling the method? ie parameters.put("issueId", "12345"); where you're expecting issues.getString("issueId") = "12345" --- Fabian Gorsler <[hidden email]> wrote: > Hi all, > > we have a strange problem with a BSH and no idea > where the error could be. > > We're retrieving data by using a > delegator.findByPrimaryKey() and a > GenericValue is returned correctly. The data is put > into a map by using > values.getString() calls. > > The script works fine when it's called after a HTTP > POST-request, but > after being called in a request chain after a > service, we receive this > strange error: > > ------------- > org.ofbiz.base.util.GeneralException: Error > rendering screen > [component://srm/widget/CommonScreens.xml#Edit]: > org.ofbiz.base.util.GeneralException: Error running > BSH script at location > > org.ofbiz.base.util.GeneralException: Error running > BSH script at > [component://srm/webapp/srm/WEB-INF/path/to/Fetch.bsh], > line [15]: Sourced > file: > component://srm/webapp/srm/WEB-INF/path/to/Fetch.bsh > : null : at > Line: 15 : in file: > component://srm/webapp/srm/WEB-INF/path/to/Fetch.bsh > : > issue .getString ( "srmIssueId" ) > ------------- > > Stack trace: > > ------------ > [java] Target exception: > java.lang.NullPointerException: Null Pointer > in Method Invocation > [java] (Sourced file: > > : > null) > [java] > org.ofbiz.base.util.BshUtil.runBshAtLocation(BshUtil.java:184) > [java] > org.ofbiz.widget.screen.ModelScreenAction$Script.runAction(ModelScreenAction.java:386) > [java] > org.ofbiz.widget.screen.ModelScreenAction.runSubActions(ModelScreenAction.java:116) > [java] > org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:238) > [java] > org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:135) > [java] > org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:106) > [java] > org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:91) > [java] > org.ofbiz.widget.screen.ScreenWidgetViewHandler.render(ScreenWidgetViewHandler.java:78) > [java] > org.ofbiz.webapp.control.RequestHandler.renderView(RequestHandler.java:603) > [java] > org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:388) > [java] > org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:343) > [java] > org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:183) > [java] > org.ofbiz.webapp.control.ControlServlet.doPost(ControlServlet.java:79) > [java] > javax.servlet.http.HttpServlet.service(HttpServlet.java:615) > [java] > javax.servlet.http.HttpServlet.service(HttpServlet.java:688) > [java] > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) > [java] > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) > [java] > org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:249) > [java] > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) > [java] > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) > [java] > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) > [java] > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) > [java] > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) > [java] > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) > [java] > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) > [java] > org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541) > [java] > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) > [java] > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) > [java] > org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) > [java] > org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) > [java] > org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) > [java] > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) > [java] java.lang.Thread.run(Thread.java:595) > ------------ > > Line 15 from Fetch.bsh: > > ------------- > parameters.put("issueId", > issue.getString("issueId")); > ------------- > > The problem is calling the method. At first I > thought the problem might be > that issue is null, but it's really the correct > result from the Entity > Engine. > > Could anyone of you give me an advice how to debug > this BSH? There must be > anything I could try in the core of OFBiz, but I > don't know which class to > use. Shall I try to debug the BSH interpreter? Has > perhaps anyone any > experience in doing that? > > TIA! :) > > Best regards, > Fabian aka "I'm getting crazy with this error" ;). > > |
Hi Chris,
> Without getting my hands too dirty with your error, > have you tried entering the string that you expect to > be returned instead of calling the method? > > ie > parameters.put("issueId", "12345"); > > where you're expecting > issues.getString("issueId") = "12345" yes, I've tried this and it worked. The problem is the method invocation. But there is something which let's this problem becoming more strange: When switching the type of request on the success-response of the service (The service works fine, the problem is really just the BSH.) to request-redirect from request, I receive an ArrayIndexOutOfBoundsException... Stack Trace: ------------ 2006-09-01 13:11:16,439 (http-0.0.0.0-8443-Processor1) [ Http11Processor.java:910:ERROR] Error finishing response java.lang.ArrayIndexOutOfBoundsException at java.lang.System.arraycopy(Native Method) at org.apache.coyote.http11.InternalOutputBuffer.write(InternalOutputBuffer.java:689) at org.apache.coyote.http11.InternalOutputBuffer.sendStatus(InternalOutputBuffer.java:428) at org.apache.coyote.http11.Http11Processor.prepareResponse(Http11Processor.java:1604) at org.apache.coyote.http11.Http11Processor.action(Http11Processor.java:962) at org.apache.coyote.Response.action(Response.java:180) at org.apache.coyote.http11.InternalOutputBuffer.endRequest(InternalOutputBuffer.java:388) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:906) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:595) ------------ Well, I'm getting confused, really confused... Best regards, Fabian aka "I'm confused"...;) |
My second not so elegant, but quick answer approach...
Can you put issues into context ie. context.put("issues" issues); then either using freemarker print ${issues} to the screen or using the screen widget <label text="${issues}"/> find out what object type issues is (either map, generic value, etc) --- Fabian Gorsler <[hidden email]> wrote: > Hi Chris, > > > Without getting my hands too dirty with your > error, > > have you tried entering the string that you expect > to > > be returned instead of calling the method? > > > > ie > > parameters.put("issueId", "12345"); > > > > where you're expecting > > issues.getString("issueId") = "12345" > > yes, I've tried this and it worked. The problem is > the method invocation. > > But there is something which let's this problem > becoming more strange: > When switching the type of request on the > success-response of the service > (The service works fine, the problem is really just > the BSH.) to > request-redirect from request, I receive an > ArrayIndexOutOfBoundsException... > > Stack Trace: > > ------------ > 2006-09-01 13:11:16,439 > (http-0.0.0.0-8443-Processor1) [ > Http11Processor.java:910:ERROR] Error finishing > response > > java.lang.ArrayIndexOutOfBoundsException > > at java.lang.System.arraycopy(Native Method) > > at > > > at > org.apache.coyote.http11.InternalOutputBuffer.sendStatus(InternalOutputBuffer.java:428) > > at > org.apache.coyote.http11.Http11Processor.prepareResponse(Http11Processor.java:1604) > > at > org.apache.coyote.http11.Http11Processor.action(Http11Processor.java:962) > > at > org.apache.coyote.Response.action(Response.java:180) > > at > org.apache.coyote.http11.InternalOutputBuffer.endRequest(InternalOutputBuffer.java:388) > > at > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:906) > > at > org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) > > at > org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) > > at > org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) > > at > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) > > at java.lang.Thread.run(Thread.java:595) > ------------ > > Well, I'm getting confused, really confused... > > Best regards, > Fabian aka "I'm confused"...;) > > |
Hi Chris,
with context it is the same problem. The method invocation error stays. We've tried everything (We think so...), but in this d**m request-chain nothing helped... In all situations the script worked fine without the request chain. If the service had output parameters I could guess i'm manipulating the wrong parameters, but there are no things returned to the chain. I think the only way for finding a solution is debugging from the core, but with that I have no idea how to start. I'm totally confused... Best regards, Fabian. |
attempting to place "issues" into the context map
results in the same error?? be aware this is different than what you were doing earlier which was placeing issues.getString("issueId") into the map. If you placed "issues" into the context map, and it returned null, then you issues is null :) and you're trying to getString from a null object. This is different from getting a string from an object and the result of getString being null. ie null.getString() vs issues.issueId=null; issues.description="this is the issue" issues.getString("issueId"); so the questions is...what does issues equal? issues = ...? --- Fabian Gorsler <[hidden email]> wrote: > Hi Chris, > > with context it is the same problem. The method > invocation error stays. > We've tried everything (We think so...), but in this > d**m request-chain > nothing helped... In all situations the script > worked fine without the > request chain. If the service had output parameters > I could guess i'm > manipulating the wrong parameters, but there are no > things returned to the > chain. I think the only way for finding a solution > is debugging from the > core, but with that I have no idea how to start. > > I'm totally confused... > > Best regards, > Fabian. > > |
Hi Chris,
oh, excuse me, I meant putting the values via context.put("valueName", issue.getString("valueName")); didn't work, too. With issue there is no problem. Neither print(issues);, nor context("issues, issue) led to an error. Best regards, Fabian. |
so then printing the valueName, what type of object is
it? --- Fabian Gorsler <[hidden email]> wrote: > Hi Chris, > > oh, excuse me, I meant putting the values via > context.put("valueName", > issue.getString("valueName")); didn't work, too. > With issue there is no > problem. Neither print(issues);, nor > context("issues, issue) led to an > error. > > Best regards, > Fabian. > > |
> so then printing the valueName, what type of object is
> it? Sorry for my late answer. This results in printing a string, which is correct, because this entity holds just strings. Best regards, Fabian. |
${issues} is a String or a GenericValue or a
GenericEntity?? --- Fabian Gorsler <[hidden email]> wrote: > > so then printing the valueName, what type of > object is > > it? > > Sorry for my late answer. > > This results in printing a string, which is correct, > because this entity > holds just strings. > > Best regards, > Fabian. > > > |
Hi Chris,
Chris Howe wrote: > ${issues} is a String or a GenericValue or a > GenericEntity?? OMG, damn, now I see what kind of confusing stuff I wrote... Sorry... Let me start again: In the request chain where the error appears, issue is a GenericEntity (GenericValue seems to have no own toString() method, I guess). I could figure this out by using print in the BSH. All fields are correctly set with their values. I've even tried to cast the GenericEntity to a GenericValue and access the fields, but it's the same method invocation error. The print() of issue shows even after the casting GenericEntity in the toString()-method (that's leading me to my assumption that GenericValue has no own toString()-method). Best regards and have a nice weekend, Fabian. |
parameter.put("issues", issues.get("issueId"));
GenericEntity has method get instead of getString. --- Fabian Gorsler <[hidden email]> wrote: > Hi Chris, > > Chris Howe wrote: > > ${issues} is a String or a GenericValue or a > > GenericEntity?? > > OMG, damn, now I see what kind of confusing stuff I > wrote... Sorry... > > Let me start again: In the request chain where the > error appears, issue > is a GenericEntity (GenericValue seems to have no > own toString() method, > I guess). I could figure this out by using print in > the BSH. All fields > are correctly set with their values. > > I've even tried to cast the GenericEntity to a > GenericValue and access > the fields, but it's the same method invocation > error. The print() of > issue shows even after the casting GenericEntity in > the > toString()-method (that's leading me to my > assumption that GenericValue > has no own toString()-method). > > Best regards and have a nice weekend, > Fabian. > |
Hi Chris,
Chris Howe wrote: > parameter.put("issues", issues.get("issueId")); > > GenericEntity has method get instead of getString. the same result: method invocation error. We've tried that yesterday. I've even tried to store the values retrieved from the GenericValue in variables and to put them via calling the variable into the parameters/context. Nothing, always this method invocation error. But: The strange thing is, that exactly this script *works* when it is not called in the chain. If the page is called with an post request, the values are retrieved correctly. No matter, whether I use get() or getString(), whether I cast or not. The problem just occurs when the page is called from the success message after a service and even then the values are retrieved correctly, just the method can't be invoked. I've tried half a day all possible combinations and a colleague has tried all possibilities he could imagine, but always the same problem. On monday (I have no access to the files from home) I think my only possibility is to attach the source to the bsh.jar and to set some breakpoints with the Eclipse debugger. Do you have any ideas where to set breakpoint outside of this jar? Best regards, Fabian. |
when you printed the value of issues and it gave the
map, was your expected result in the map? --- Fabian Gorsler <[hidden email]> wrote: > Hi Chris, > > Chris Howe wrote: > > parameter.put("issues", issues.get("issueId")); > > > > GenericEntity has method get instead of getString. > > the same result: method invocation error. We've > tried that yesterday. > I've even tried to store the values retrieved from > the GenericValue in > variables and to put them via calling the variable > into the > parameters/context. Nothing, always this method > invocation error. > > But: The strange thing is, that exactly this script > *works* when it is > not called in the chain. If the page is called with > an post request, the > values are retrieved correctly. No matter, whether I > use get() or > getString(), whether I cast or not. > > The problem just occurs when the page is called from > the success message > after a service and even then the values are > retrieved correctly, just > the method can't be invoked. > > I've tried half a day all possible combinations and > a colleague has > tried all possibilities he could imagine, but always > the same problem. > On monday (I have no access to the files from home) > I think my only > possibility is to attach the source to the bsh.jar > and to set some > breakpoints with the Eclipse debugger. Do you have > any ideas where to > set breakpoint outside of this jar? > > Best regards, > Fabian. > |
Chris Howe wrote:
> when you printed the value of issues and it gave the > map, was your expected result in the map? Yes, the expected result was in it. findByPrimaryKey() worked, this is the next fact I forgot to mention in my last mail, which led me to the assumption the toString()-method from GenericValue is inherited from GenericEntity. |
In reply to this post by Fabian Gorsler
Hi all,
I could finally figure out what the error was: The values existed already in the parameters-map. Now I check, whether the parameter is null and if it is the value is taken from the entity and put into parameters. For luck now everything works fine. :-) From my opinion this is a bug, on the one hand because the error message is IMHO not usable and on the other can't I imagine a reason why overwriting an existing parameter fails. Up to now we've had no problems when overwriting parameters or stuff in the context or session. Is this perhaps, because a service is in the request chain? The service itself has no output parameters. Shall I open a ticket in JIRA or is the "read-only" behavior wished? And Chris, sorry I've forgotten to thank you for supporting me. Thanks. :-) Best regards, Fabian |
Free forum by Nabble | Edit this page |