You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Avijit Bose <bo...@gmail.com> on 2022/05/25 10:47:31 UTC

Calling java class from groovy error

Hello,

My java class file...
-------------------
public class DataUtils {

 public static final String module = DataUtils.class.getName();

 public static String getCompanyName(String format) {

Debug.logInfo("=======format=========", format);

     return format;
 }
------------------

I am calling this java class from this...
---------------------------
<entity-options entity-name="AkmMasterEnquiry" key-field-name="customerId"
description="${groovy:com.akm.exim.events.DataUtils.getcompanyName(customerId);}">
--------------------------

Error in short ....
--------------------------
2022-05-25 15:57:52,536 |jsse-nio-8443-exec-1 |FlexibleStringExpander
      |W| Error evaluating scriptlet
[${groovy:com.akm.exim.events.DataUtils.getcompanyName(customerId);}];
error was: groovy.lang.MissingMethodException: No signature of method:
static com.akm.exim.events.DataUtils.getcompanyName() is applicable
for argument types: (java.lang.String) values: [10046]
Possible solutions: getCompanyName(java.lang.String)
groovy.lang.MissingMethodException: No signature of method: static
com.akm.exim.events.DataUtils.getcompanyName() is applicable for
argument types: (java.lang.String) values: [10046]
Possible solutions: getCompanyName(java.lang.String)
        at groovy.lang.MetaClassImpl.invokeStaticMissingMethod(MetaClassImpl.java:1501)
~[groovy-all-2.4.13.jar:2.4.13]
        at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1487)
~[groovy-all-2.4.13.jar:2.4.13]
        at org.codehaus.groovy.runtime.callsite.StaticMetaClassSite.call(StaticMetaClassSite.java:53)
~[groovy-all-2.4.13.jar:2.4.13]
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
~[groovy-all-2.4.13.jar:2.4.13]
        at script16534660370052082802180.run(script16534660370052082802180.groovy:1)
~[?:?]
--------------------------

Pls let me know why this error is occuring?

NOTE: There is an example in ofbiz in displaying the date field. I
have followed that.

regards
Avijit

Re: Calling java class from groovy error

Posted by Avijit Bose <bo...@gmail.com>.
Sir,
FYI to all...

------------------------------------
description="${groovy:com.akm.exim.events.DataUtils.getcompanyName(customerId);}"
-------------------------------------


Pls note that the letter 'c' in 'getcompanyName' was in lowercase as shown
above in the description field. But the same letter 'c' in my java method
name was in uppercase 'getCompanyName(String format)' as shown below. I
changed the lowercase to uppercase in the description field and it resolved.


---------------------------------
public static String getCompanyName(String format) {

Debug.logInfo("=======format=========", format);

     return format;
 }
--------------------------------

regards
Avijit

On Wed, May 25, 2022 at 7:21 PM Daniel Watford <da...@foomoo.co.uk> wrote:

> Hi Avijit,
>
> Please could you follow up with an explanation of what the cause of the
> problem was and how you solved it.
>
> Doing so will add to the ofbiz knowledge pool and will help others who
> might have similar issues in the future.
>
> Thanks,
>
> Dan.
>
> On Wed, 25 May 2022 at 14:30, Avijit Bose <bo...@gmail.com> wrote:
>
> > Dear Sir
> >
> > I got this.
> > thank you
> >
> > On Wed, May 25, 2022 at 4:17 PM Avijit Bose <bo...@gmail.com>
> wrote:
> > >
> > > Hello,
> > >
> > > My java class file...
> > > -------------------
> > > public class DataUtils {
> > >
> > >  public static final String module = DataUtils.class.getName();
> > >
> > >  public static String getCompanyName(String format) {
> > >
> > > Debug.logInfo("=======format=========", format);
> > >
> > >      return format;
> > >  }
> > > ------------------
> > >
> > > I am calling this java class from this...
> > > ---------------------------
> > > <entity-options entity-name="AkmMasterEnquiry"
> > key-field-name="customerId"
> > >
> >
> description="${groovy:com.akm.exim.events.DataUtils.getcompanyName(customerId);}">
> > > --------------------------
> > >
> > > Error in short ....
> > > --------------------------
> > > 2022-05-25 15:57:52,536 |jsse-nio-8443-exec-1 |FlexibleStringExpander
> > >       |W| Error evaluating scriptlet
> > > [${groovy:com.akm.exim.events.DataUtils.getcompanyName(customerId);}];
> > > error was: groovy.lang.MissingMethodException: No signature of method:
> > > static com.akm.exim.events.DataUtils.getcompanyName() is applicable
> > > for argument types: (java.lang.String) values: [10046]
> > > Possible solutions: getCompanyName(java.lang.String)
> > > groovy.lang.MissingMethodException: No signature of method: static
> > > com.akm.exim.events.DataUtils.getcompanyName() is applicable for
> > > argument types: (java.lang.String) values: [10046]
> > > Possible solutions: getCompanyName(java.lang.String)
> > >         at
> >
> groovy.lang.MetaClassImpl.invokeStaticMissingMethod(MetaClassImpl.java:1501)
> > > ~[groovy-all-2.4.13.jar:2.4.13]
> > >         at
> > groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1487)
> > > ~[groovy-all-2.4.13.jar:2.4.13]
> > >         at
> >
> org.codehaus.groovy.runtime.callsite.StaticMetaClassSite.call(StaticMetaClassSite.java:53)
> > > ~[groovy-all-2.4.13.jar:2.4.13]
> > >         at
> >
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
> > > ~[groovy-all-2.4.13.jar:2.4.13]
> > >         at
> > script16534660370052082802180.run(script16534660370052082802180.groovy:1)
> > > ~[?:?]
> > > --------------------------
> > >
> > > Pls let me know why this error is occuring?
> > >
> > > NOTE: There is an example in ofbiz in displaying the date field. I
> > > have followed that.
> > >
> > > regards
> > > Avijit
> >
>
>
> --
> Daniel Watford
>

Re: Calling java class from groovy error

Posted by Daniel Watford <da...@foomoo.co.uk>.
Hi Avijit,

Please could you follow up with an explanation of what the cause of the
problem was and how you solved it.

Doing so will add to the ofbiz knowledge pool and will help others who
might have similar issues in the future.

Thanks,

Dan.

On Wed, 25 May 2022 at 14:30, Avijit Bose <bo...@gmail.com> wrote:

> Dear Sir
>
> I got this.
> thank you
>
> On Wed, May 25, 2022 at 4:17 PM Avijit Bose <bo...@gmail.com> wrote:
> >
> > Hello,
> >
> > My java class file...
> > -------------------
> > public class DataUtils {
> >
> >  public static final String module = DataUtils.class.getName();
> >
> >  public static String getCompanyName(String format) {
> >
> > Debug.logInfo("=======format=========", format);
> >
> >      return format;
> >  }
> > ------------------
> >
> > I am calling this java class from this...
> > ---------------------------
> > <entity-options entity-name="AkmMasterEnquiry"
> key-field-name="customerId"
> >
> description="${groovy:com.akm.exim.events.DataUtils.getcompanyName(customerId);}">
> > --------------------------
> >
> > Error in short ....
> > --------------------------
> > 2022-05-25 15:57:52,536 |jsse-nio-8443-exec-1 |FlexibleStringExpander
> >       |W| Error evaluating scriptlet
> > [${groovy:com.akm.exim.events.DataUtils.getcompanyName(customerId);}];
> > error was: groovy.lang.MissingMethodException: No signature of method:
> > static com.akm.exim.events.DataUtils.getcompanyName() is applicable
> > for argument types: (java.lang.String) values: [10046]
> > Possible solutions: getCompanyName(java.lang.String)
> > groovy.lang.MissingMethodException: No signature of method: static
> > com.akm.exim.events.DataUtils.getcompanyName() is applicable for
> > argument types: (java.lang.String) values: [10046]
> > Possible solutions: getCompanyName(java.lang.String)
> >         at
> groovy.lang.MetaClassImpl.invokeStaticMissingMethod(MetaClassImpl.java:1501)
> > ~[groovy-all-2.4.13.jar:2.4.13]
> >         at
> groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1487)
> > ~[groovy-all-2.4.13.jar:2.4.13]
> >         at
> org.codehaus.groovy.runtime.callsite.StaticMetaClassSite.call(StaticMetaClassSite.java:53)
> > ~[groovy-all-2.4.13.jar:2.4.13]
> >         at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
> > ~[groovy-all-2.4.13.jar:2.4.13]
> >         at
> script16534660370052082802180.run(script16534660370052082802180.groovy:1)
> > ~[?:?]
> > --------------------------
> >
> > Pls let me know why this error is occuring?
> >
> > NOTE: There is an example in ofbiz in displaying the date field. I
> > have followed that.
> >
> > regards
> > Avijit
>


-- 
Daniel Watford

Re: Calling java class from groovy error

Posted by Avijit Bose <bo...@gmail.com>.
Dear Sir

I got this.
thank you

On Wed, May 25, 2022 at 4:17 PM Avijit Bose <bo...@gmail.com> wrote:
>
> Hello,
>
> My java class file...
> -------------------
> public class DataUtils {
>
>  public static final String module = DataUtils.class.getName();
>
>  public static String getCompanyName(String format) {
>
> Debug.logInfo("=======format=========", format);
>
>      return format;
>  }
> ------------------
>
> I am calling this java class from this...
> ---------------------------
> <entity-options entity-name="AkmMasterEnquiry" key-field-name="customerId"
> description="${groovy:com.akm.exim.events.DataUtils.getcompanyName(customerId);}">
> --------------------------
>
> Error in short ....
> --------------------------
> 2022-05-25 15:57:52,536 |jsse-nio-8443-exec-1 |FlexibleStringExpander
>       |W| Error evaluating scriptlet
> [${groovy:com.akm.exim.events.DataUtils.getcompanyName(customerId);}];
> error was: groovy.lang.MissingMethodException: No signature of method:
> static com.akm.exim.events.DataUtils.getcompanyName() is applicable
> for argument types: (java.lang.String) values: [10046]
> Possible solutions: getCompanyName(java.lang.String)
> groovy.lang.MissingMethodException: No signature of method: static
> com.akm.exim.events.DataUtils.getcompanyName() is applicable for
> argument types: (java.lang.String) values: [10046]
> Possible solutions: getCompanyName(java.lang.String)
>         at groovy.lang.MetaClassImpl.invokeStaticMissingMethod(MetaClassImpl.java:1501)
> ~[groovy-all-2.4.13.jar:2.4.13]
>         at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1487)
> ~[groovy-all-2.4.13.jar:2.4.13]
>         at org.codehaus.groovy.runtime.callsite.StaticMetaClassSite.call(StaticMetaClassSite.java:53)
> ~[groovy-all-2.4.13.jar:2.4.13]
>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
> ~[groovy-all-2.4.13.jar:2.4.13]
>         at script16534660370052082802180.run(script16534660370052082802180.groovy:1)
> ~[?:?]
> --------------------------
>
> Pls let me know why this error is occuring?
>
> NOTE: There is an example in ofbiz in displaying the date field. I
> have followed that.
>
> regards
> Avijit