[rules-users] Newbie question / NoSuchMethodError error

Edson Tirelli tirelli at post.com
Tue May 27 17:02:22 EDT 2008


   Carl,

   Yes, BRMS requires Java 5. Only the engine itself (core/compiler/etc)
works in java 1.4.

   []s
   Edson

2008/5/27 Cabou, Carl <Carl.Cabou at prima-solutions.com>:

>  Edson,
>
>
>
> When I use JDK 1.4 using Drools 4.0.7 on JBoss AS 4.0.5 I get the following
> exception :
>
>
>
> java.lang.UnsupportedClassVersionError:
> org/drools/brms/server/files/AssetFileServlet (Unsupported major.minor
> version 49.0)
>
>         at java.lang.ClassLoader.defineClass0(Native Method)
>
>         at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
>
>         at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
>
>         at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
>
>         at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
>
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
>
>         at java.security.AccessController.doPrivileged(Native Method)
>
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
>
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
>
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
>
>         at
> org.jboss.ws.integration.jboss.DeployerInterceptorJSE.isWebserviceDeployment(DeployerInterceptorJSE.java:124)
>
>         at
> org.jboss.ws.integration.jboss.DeployerInterceptor.create(DeployerInterceptor.java:76)
>
>         at
> org.jboss.ws.integration.jboss.DeployerInterceptorJSE.create(DeployerInterceptorJSE.java:74)
>
>         at
> org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.create(SubDeployerInterceptorSupport.java:180)
>
>         at
> org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:91)
>
>         at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
>
>         at
> org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
>
>         at
> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
>
>         at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
>
>         at $Proxy39.create(Unknown Source)
>
>         at org.jboss.deployment.MainDeployer.create(MainDeployer.java:969)
>
>         at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:818)
>
>         at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
>
>         at sun.reflect.GeneratedMethodAccessor56.invoke(Unknown Source)
>
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
>         at java.lang.reflect.Method.invoke(Method.java:324)
>
>         at
> org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
>
>         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
>
>         at
> org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
>
>         at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
>
>         at
> org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
>
>         at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
>
>         at
> org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
>
>         at
> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
>
>         at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
>
>         at $Proxy8.deploy(Unknown Source)
>
>         at
> org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
>
>         at
> org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
>
>         at
> org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
>
>         at
> org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
>
>         at
> org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
>
>         at
> org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
>
>         at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
>
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
>         at java.lang.reflect.Method.invoke(Method.java:324)
>
>         at
> org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
>
>         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
>
>         at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
>
>         at
> org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
>
>         at
> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
>
>         at
> org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
>
>         at $Proxy0.start(Unknown Source)
>
>         at
> org.jboss.system.ServiceController.start(ServiceController.java:417)
>
>         at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
>
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
>         at java.lang.reflect.Method.invoke(Method.java:324)
>
>         at
> org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
>
>         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
>
>         at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
>
>         at
> org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
>
>         at
> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
>
>         at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
>
>         at $Proxy4.start(Unknown Source)
>
>         at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
>
>         at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
>
>         at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
>
>         at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
>
>         at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
>
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
>         at java.lang.reflect.Method.invoke(Method.java:324)
>
>         at
> org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
>
>         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
>
>         at
> org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
>
>         at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
>
>         at
> org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
>
>         at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
>
>         at
> org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
>
>         at
> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
>
>         at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
>
>         at $Proxy5.deploy(Unknown Source)
>
>         at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
>
>         at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
>
>         at org.jboss.Main.boot(Main.java:200)
>
>         at org.jboss.Main$1.run(Main.java:490)
>
>         at java.lang.Thread.run(Thread.java:534)
>
>
>
>
>
> I don't get this exception when using jdk5.0.
>
>
>
> Beside this in the drools documentation  (section 9.2.1.1. « Supported and
> recommended platforms ») it is written « The BRMS is capable of running in
> any application server that supports Java SE5 ».
>
>
>
> I am unable to reproduced the exception bellow I had before, I guess it was
> my client code which was not generated in the proper JDK version (5.0 and I
> need client code to be 1.4).
>
>
>
> So I guess I need to use jdk1.4 client code using Drools BRMS url running
> on jdk5.0.
>
>
>
> Regards,
>
> Carl.
>
>
>
>
>
>
>  ------------------------------
>
> *De :* rules-users-bounces at lists.jboss.org [mailto:
> rules-users-bounces at lists.jboss.org] *De la part de* Edson Tirelli
> *Envoyé :* jeudi 8 mai 2008 13:56
> *À :* Rules Users List
> *Objet :* Re: [rules-users] Newbie question / NoSuchMethodError error
>
>
>
>
>    Carl,
>
>    Drools 4.0.x is indeed JDK 1.4+ compatible.
>
>    Can you please share your complete stack trace?
>    The snippet you showed:
>
> Caused by: java.lang.NoSuchMethodError: java.lang.Integer.valueOf(I
>
> )Ljava/lang/Integer;
>    at AL_Calculation.Rule_ setSelecte_10_0.consequence(Unknown Source)
>
>    Says that the problem is happening the consequence of a rule called
> something like:
>
> "setSelecte_10_0"
>
>
>    Where _ is any non-valid character for classnames.
>
>    That is not the rule you showed before.
>
>    []s
>    Edson
>
>  2008/5/8 Cabou, Carl <Carl.Cabou at prima-solutions.com>:
>
> So Does anybody know how I can make Drools 4 API works in JAVA1.4 ??
>
> Carl
>
> -----Message d'origine-----
> De : rules-users-bounces at lists.jboss.org [mailto:
> rules-users-bounces at lists.jboss.org] De la part de Cabou, Carl
> Envoyé : jeudi 8 mai 2008 10:41
>
> À : Rules Users List
> Objet : RE: [rules-users] Newbie question / NoSuchMethodError error
>
> Thomas,
>
> I can not move the headings since I do receive "0 - 50" as a String and
> then I have to return an Integer.
>
> I've made a little program beside this to test my rule, I've launched it
> using java5, it worked fine, but it does crash using java1.4.
> I just found out the Integer.valueOf(int) is a new feature of java5.
>
> So I guess I must try to run my web application using java5.
>
> Carl.
>
> -----Message d'origine-----
> De : rules-users-bounces at lists.jboss.org [mailto:
> rules-users-bounces at lists.jboss.org] De la part de Hehl, Thomas
> Envoyé : jeudi 8 mai 2008 10:20
> À : 'Rules Users List'
> Objet : RE: [rules-users] Newbie question / NoSuchMethodError error
>
> No, really, java uses the valueOf methods internally to try to convert the
> object specified (a String) into an Integer so it can do the comparison.
> You
> can't do selected == "0 - 50" because "0 - 50" is a String and you cant
> compare it to an Integer.
>
> So what are you trying to do? If you want selected to be in the range
> between 0 and 50 inclusive, then you need to change the heading in your
> decision table. Here's an example:
>
> daysBeforeSummons >= $1, daysBeforeSummons <= $2
>
> and then you specify the data in your column as 0,50.
>
> Good luck!
>
> -----Original Message-----
> From: rules-users-bounces at lists.jboss.org
> [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Cabou, Carl
> Sent: Thursday, May 08, 2008 10:12 AM
> To: Rules Users List
> Subject: RE: [rules-users] Newbie question / NoSuchMethodError error
>
> Thank you for answering Thomas.
>
> Here is the code below, nothing fancy:
>
>
> public void setSelected (Integer calculatedSetSelected)
> {
>                this. calculatedSetSelected = calculatedSetSelected;
> }
>
> In fact, the problem IS that it is taking an Integer and some Drools
> Internal method want to convert it using Integer.valueOf, but there is no
> Integer.valueOf taking Integer.
>
> There is something weird, in the stack trace, I get :
>
> Caused by: java.lang.NoSuchMethodError:
> java.lang.Integer.valueOf(I)Ljava/lang/Integer;
>    at AL_Calculation.Rule_ setSelecte_10_0.consequence(Unknown Source)
>
> There is a missing "d" before "_10" ...
>
> Carl
>
>
> -----Message d'origine-----
> De : rules-users-bounces at lists.jboss.org
> [mailto:rules-users-bounces at lists.jboss.org] De la part de Hehl, Thomas
> Envoyé : jeudi 8 mai 2008 09:35
> À : 'Rules Users List'
> Objet : RE: [rules-users] Newbie question / NoSuchMethodError error
>
> Yep. Post the code for setSelected(). I'm guessing it takes an Integer or
> int and you're passing it a String.
>
> -----Original Message-----
> From: rules-users-bounces at lists.jboss.org
> [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Cabou, Carl
> Sent: Thursday, May 08, 2008 9:23 AM
> To: rules-users at lists.jboss.org
> Subject: [rules-users] Newbie question / NoSuchMethodError error
>
> Greetings,
>
> I'm new to Drools and I've written a decision table based rule using excel.
> The rule validates ok and I've deployed my package fine.
>
> I've written a piece of code to test my rules, I want to set the
> calculatedRate to 125 when I get selected field equal to "0 - 50" :
>
> ...
> StatelessSession statelessSession = rb.newStatelessSession(); Data data=new
> Data(); data.setSelected("0 - 50"); statelessSession.execute(data); // set
> private Integer field ...
>
> When I run the code I get a exeption :
>
> java.lang.NoSuchMethodError:
> java.lang.Integer.valueOf(I)Ljava/lang/Integer;
>
> I don't understand why Drools tries to convert to Integer something which
> is
> already Integer !!!!
>
> -----------
> Here is the rules code.
>
>
> rule "setCalculateRate_11"
>
>        salience 65525
>        when
>                Data(selected == "0 - 50")
>        then
>                object.setCalculatedRate(125);
> end
>
>
> --------------
> The CalculatedRate field is a java.lang.Integer object.
>
> Does anybody has an idea ??
>
> Regards,
> Carl.
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
> --
> Edson Tirelli
> JBoss Drools Core Development
> Office: +55 11 3529-6000
> Mobile: +55 11 9287-5646
> JBoss, a division of Red Hat @ www.jboss.com
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
Edson Tirelli
JBoss Drools Core Development
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080527/6a87469d/attachment.html 


More information about the rules-users mailing list