1 2 Previous Next 20 Replies Latest reply on Apr 6, 2013 7:48 PM by munimanjunath

    'Invalid usage of undeployed classloader' in mvel

    olegga

      I use JBossESB 4.5. When using the Smooks action along with Drools MessageFilter sometimes I got the following exception:

      org.milyn.SmooksException: Failed to filter source.
       at org.milyn.delivery.sax.SmooksSAXFilter.doFilter(SmooksSAXFilter.java:68)
       at org.milyn.Smooks._filter(Smooks.java:341)
       at org.milyn.Smooks.filter(Smooks.java:319)
       at org.milyn.container.plugin.PayloadProcessor.process(PayloadProcessor.java:112)
       at com.aplana.jbossesb.smooks.SmooksAction.process(SmooksAction.java:213)
       at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.processPipeline(ActionProcessingPipeline.java:633)
       at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.processPipeline(ActionProcessingPipeline.java:585)
       at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.process(ActionProcessingPipeline.java:419)
       at org.jboss.soa.esb.listeners.message.MessageAwareListener$TransactionalRunner.run(MessageAwareListener.java:548)
       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: org.milyn.SmooksException: Error executing SQL Statement '
      
       select sumtel_wrapper.f_set_port_rstate(
       ${request["portId"]},
       ${request["reserve"] ? 1 : 0},
       ${request["agreementNumber"]},
       ${request["accountNumber"]}
       ) as result from dual
      
       '.
       at org.milyn.routing.db.SQLExecutor.executeSQL(SQLExecutor.java:180)
       at org.milyn.routing.db.SQLExecutor.visitAfter(SQLExecutor.java:111)
       at org.milyn.delivery.sax.SAXHandler.visitAfter(SAXHandler.java:356)
       at org.milyn.delivery.sax.SAXHandler.endElement(SAXHandler.java:188)
       at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
       at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
       at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
       at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
       at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
       at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
       at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
       at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
       at org.milyn.delivery.sax.SAXParser.parse(SAXParser.java:49)
       at org.milyn.delivery.sax.SmooksSAXFilter.doFilter(SmooksSAXFilter.java:65)
       ... 11 more
      Caused by: java.sql.SQLException: Error evaluting expression 'request["portId"]' on map org.milyn.javabean.repository.BeanRepository$RepositoryBeanMapAdapter@105664f
       at org.milyn.routing.db.StatementExec.setStatementParamaters(StatementExec.java:189)
       at org.milyn.routing.db.StatementExec.executeJoinedQuery(StatementExec.java:151)
       at org.milyn.routing.db.SQLExecutor.executeSQL(SQLExecutor.java:158)
       ... 24 more
      Caused by: org.milyn.expression.ExpressionEvaluationException: Error evaluating MVEL expression 'request["portId"]' against object type 'org.milyn.javabean.repository.BeanRepository$RepositoryBeanMapAdapter'. Common issues include:
       1. Referencing a variable that is not bound into the context. In this case use VARS.isdef("someVar") to check if the variable is bound in the context.
       2. Invalid expression reference to a List/Array based variable token. Example List/Array referencing expression token: 'order.orderItems[0].productId'.
       at org.milyn.expression.MVELExpressionEvaluator.getValue(MVELExpressionEvaluator.java:84)
       at org.milyn.routing.db.StatementExec.setStatementParamaters(StatementExec.java:187)
       ... 26 more
      Caused by: java.lang.IllegalStateException: Invalid usage of undeployed classloader
       at org.jboss.mx.loading.RepositoryClassLoader.findClass(RepositoryClassLoader.java:625)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
       at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:467)
       at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:408)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
       at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
       at ASMAccessorImpl_206977441239007118240.getValue(Unknown Source)
       at org.mvel.ast.VariableDeepPropertyNode.getReducedValueAccelerated(VariableDeepPropertyNode.java:22)
       at org.mvel.ast.PropertyASTNode.getReducedValueAccelerated(PropertyASTNode.java:21)
       at org.mvel.ExecutableAccessor.getValue(ExecutableAccessor.java:50)
       at org.mvel.MVEL.executeExpression(MVEL.java:251)
       at org.milyn.expression.MVELExpressionEvaluator.getValue(MVELExpressionEvaluator.java:70)
       ... 27 more

      The same exception occurred before in plain Smooks actions but dissappeared after I replaced mvel-1.3.3 from jbossesb.sar to mvel-1.3.12 from Smooks distribution. Now it's thrown only after several invocations of Smooks and MessageFilter and disappears after JBoss restart

        • 1. Re: 'Invalid usage of undeployed classloader' in mvel
          tfennelly

          Sorry... are you saying that this problem dissappeared after upgrading MVEL to v1.3.12, or are you just saying it happens "less frequently"?

          I assume it only happens after one or more undeploys??

          Anyway... sounds like something is holding onto and using a classloader after the deployment associated with the classloader has been undeployed.

          • 2. Re: 'Invalid usage of undeployed classloader' in mvel
            olegga

            After replacing mvel it occurs only when a service contains both a Smooks action with db executor and a Drools MessageFilter

            • 3. Re: 'Invalid usage of undeployed classloader' in mvel
              tfennelly

              and what's the pattern.... immeditately after a restart... after a redeploy of the .esb... ???

              • 4. Re: 'Invalid usage of undeployed classloader' in mvel
                kconner

                It is definitely the classloader of an old deployment, being cached somewhere.

                When the artifact is undeployed, the classloader associated with the deployment is detached from the class loader repository. If a subsequent attempt is made to resolve a class using that classloader then you will see this error.

                We need an example of the issue in order to reproduce and identify the cause.

                Kev

                • 5. Re: 'Invalid usage of undeployed classloader' in mvel
                  olegga

                   

                  and what's the pattern.... immeditately after a restart... after a redeploy of the .esb... ???


                  It seems it happens only after a redeploy. Besides, Smooks works fine the first time and throws the exception only at the second invocation

                  • 6. Re: 'Invalid usage of undeployed classloader' in mvel
                    tfennelly

                    As Kev says... an example of this would help greatly in tracking down the issue. If you could create a quickstart like bundle and email it to me, I can have a look at it.

                    • 7. Re: 'Invalid usage of undeployed classloader' in mvel

                      I am having similar issue. I am having simple MVEL expresssion in my smooks config. When I do my testing for Smooks transformation using only smooks libraries it works fine. But when I promote my project to JBossESB4.5 it doesn't work. It looks like MVEL libraries used in jbossesb.sar is old (mvel-1.3.3-java1.5.jar). While eveluating MVEL expression it uses this library instead using the one from smooks or jbrules.esb(mvel2-2.0.4.jar).

                       

                      I tried removing the old mvel from jbossesb.sar and replaced with the one in jbrules.esb and it worked. I don't see any failures.

                       

                      Is there any other way to fix this? Is there a way to make JBoss use the mvel libraries in Smooks or jbrules.esb instead?

                      • 8. Re: 'Invalid usage of undeployed classloader' in mvel
                        kconner

                        This should have been sorted in 4.6, see https://jira.jboss.org/jira/browse/JBESB-2750

                         

                        Kev

                        • 9. Re: 'Invalid usage of undeployed classloader' in mvel

                          I tried applying the solution mentioned in the JIRA and it looks like both mvl libraries can't co-exist in jbossesb.sar.

                           

                          My MVL expression only works if I keep the latest version in the jbossesb.sar. If I keep both of them then it still looks at the old version of mvl.

                           

                          Any suggestion?

                          • 10. Re: 'Invalid usage of undeployed classloader' in mvel
                            kconner

                            mvel and mvel2 have different package names, so will not clash.  It may be that smooks is looking for both and choosing the first one, I'm not sure about that.

                             

                            In any case we eventually moved everything over to mvel2 as part of the 4.7 release, so the real fix is for you to update to the latest version.

                             

                            The ESB 4.8 release is being uploaded as we speak, so you will be able to download that later on this evening.

                             

                            Kev

                            • 11. Re: 'Invalid usage of undeployed classloader' in mvel
                              munimanjunath

                              Hi,

                               

                              I am using jboss-esb-4.8  version.  I got a similar issue

                               

                              Error evaluating MVEL expression 'java.util.regex.Pattern pattern = null;

                              java.util.regex.Matcher matcher = null;

                              .....................

                              ........................

                              ........................

                               

                              ' against object type 'org.milyn.javabean.repository.BeanRepository$RepositoryBeanMapAdapter'. Common issues include:

                                      1. Referencing a variable that is not bound into the context. In this case use the 'isdef' operator to check if the variable is bound in the context.

                                      2. Invalid expression reference to a List/Array based variable token.  Example List/Array referencing expression token: 'order.orderItems[0].productId'.

                               

                               

                              This is happenining in only  one of the Test Environment  the same payload is working fine on development  and local environment hence I could not able to reproduce the error.  Any help is appreciated

                              • 12. 'Invalid usage of undeployed classloader' in mvel
                                tcunning

                                Your error doesn't look that similar to this, but if you'd like someone to look at it please post the complete stack, as well as any pertinent details of differences between your test environment and production environment.

                                • 13. 'Invalid usage of undeployed classloader' in mvel
                                  munimanjunath

                                  Hi Tom,

                                   

                                  Thanks for immediate response.   There is no exception stacktrace printint in the logs  Below is the snippet which runs the smooksvalidation

                                   

                                  ------------------------------

                                   

                                      ValidationResult validationResult = new ValidationResult();

                                              // Filter the input message...

                                              ExecutionContext executionContext = null;

                                              executionContext = smooks.createExecutionContext();

                                              smooks.filterSource(executionContext, new StringSource(messageIn), validationResult);

                                   

                                  --------------------------------------

                                   

                                  The validationResult  is populated with the above data.   I could able to reproduce this error  this happens  when the jboss server is  started and the input request is invoked first time

                                  Error evaluating MVEL expression

                                   

                                  'java.util.regex.Pattern pattern = null;

                                  java.util.regex.Matcher matcher = null;

                                  if(customerAddress.Country == null)

                                  customerAddress.Country="US";

                                  if(customerAddress.Country == "CA") 

                                    { pattern = java.util.regex.Pattern.compile("^[A-Za-z][0-9][A-Za-z][ ][0-9][A-Za-z][0-9]$");

                                      matcher = pattern.matcher(customerAddress.Zip);

                                      if(matcher.find())

                                    return true;

                                      else

                                           return false;

                                     }

                                  else if (customerAddress.Country == "US")

                                  {

                                      pattern =  java.util.regex.Pattern.compile("(^\\d{5}$)|(^\\d{5}-\\d{4}$)|(^\\d{9}$)");

                                      matcher = pattern.matcher(customerAddress.Zip);

                                       if(matcher.find())

                                    return true;

                                      else

                                           return false;

                                  }  else return false;' against object type 'org.milyn.javabean.repository.BeanRepository$RepositoryBeanMapAdapter'. Common issues include:

                                          1. Referencing a variable that is not bound into the context. In this case use the 'isdef' operator to check if the variable is bound in the context.

                                          2. Invalid expression reference to a List/Array based variable token.  Example List/Array referencing expression token: 'order.orderItems[0].productId'.,

                                   

                                  The highlighted one is actual rule in the csv file.   This always happens when I do not provide the country code in the input payload.  Once it got a valid payload with country code  then the subsequent request without country code also executes fine. 

                                  • 14. 'Invalid usage of undeployed classloader' in mvel
                                    munimanjunath

                                    The root cause of the issue is   null check   if(customerAddress.Country == null) . I am using  csv for org.milyn.rules.mvel.MVELProvider evaulation. 

                                     

                                    It looks like there is some issue in null check  in MVEL expression

                                    1 2 Previous Next