Trying to run demo DecisionHelloWSCustomer.

74 views
Skip to first unread message

Tone Loc

unread,
Feb 21, 2016, 2:54:41 PM2/21/16
to OpenRules
Hi,

I'm trying to follow the user guide for web services. However I'm having trouble trying to produce the .war file. I have got the following when running the run.bat command (compile.bat doesn't throw any errors but also doesn't produce any war file):-

     [java] java.lang.IllegalArgumentException: object is not an instance of declaring class
     [java] Invalid Code Fragment:
     [java] =========================================
     [java] if (method != null)
     [java]    decision.execute(method,decision);
     [java]             ^^^^^^^^^^^^^^^^^^^^^^^^
     [java] =========================================
     [java]     at file:/C:/openrules.decisions/openrules.config/DecisionTemplates.xls?sheet=DecisionTemplate&cell=G4&start=33&end=56&openl=
     [java] java.lang.IllegalArgumentException: object is not an instance of declaring class
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

Looking at the user guide it mentions at the bottom of page 4:-


- Creates and executes a decision that is based on the customer’s attributes such as gender, marital status, and age is supposed to generate a response that contains a greeting like “Good Afternoon, Mrs. Robinson!” The rules used by this decision are located in Excel files starting with “file:rules/main/Decision.xls”. (I changed the font colour)

It's not clear to me where this line should go?  In the build properties there is something similar (highlighted in red):-

main.java.class=hello.Main
main.xls.file=file:${project.dir}/rules/main/Decision.xls
war.name=DecisionHelloWSCustomer.war

# deployment properties
appserver.home=C:/Software/apache-tomcat-9.0.0.M3
deploy.path=${appserver.home}/webapps
tomcat.manager.username=tomcat
tomcat.manager.password=tomcat
axis.lib=C:/Software/axis-1_4/lib

Should this line be added to this file (or isn't it already?)

(also as a side note is the war.name parameter correctly declared or does it need a path as the line above it has?)

Also from the user guide, I haven't got this far but it mentions that after running build.bat to run deploy.bat, however this isn't DecisionHelloJava folder which I copied over, so where should I get deploy.bat from?

Finally, the documentation makes reference to service-config.wsdd, however I only found a server-config.wsdd in the samples directory of the axis 1.4 folder, is this the one that the documentation means or can somebody point out where I can get this file.

Many thanks in advance,

Anthony


OpenRules Support

unread,
Feb 21, 2016, 3:21:22 PM2/21/16
to OpenRules

Anthony,


The document http://openrules.com/pdf/OpenRulesUserManual.WebService.pdf describes how to convert the basic rules project DecisionHelloJava from the workspace "openrules.decisions" to a web services. The resulting project DecisionHelloWSCustomer can be found in the workspace "openrules.web". So, you do not need to run compile.bat from DecisionHelloJava, but rather run build.bat and deploy.bat from DecisionHelloWSCustomer as described at the page 7. build.bat will create it will create “DecisionHelloWSCustomer.war” and deploy.bat will copy it to your Tomcat's webapps folder. Then you should be able to see the generated WSDL interface by double-clicking on "run.html". Then you may test this web service by using a Java client DecisionHelloWSCustomerClient.


The file server-config.wsdd can be found at DecisionHelloWSCustomer/war/WEB-INF/.


Let us know if something does not work as described in the manual.


Support

Tone Loc

unread,
Feb 24, 2016, 5:40:03 PM2/24/16
to OpenRules
Hi thanks for that,

I was looking at the same document originally but I've now downloaded the openrules.web file and I feel that I've got a lot further.

I'm now stuck on the part about trying to test the web service.

When executing generate.axis.client.bat   I got the following output:-


C:\openrules.web\DecisionHelloWSCustomerClient>call ant -f "C:\openrules.web\DecisionHelloWSCustomerClient\\build.xml" "generate.axis.client"
Buildfile: C:\openrules.web\DecisionHelloWSCustomerClient\build.xml

generate.axis.client:
[axis-wsdl2java] - Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
[axis-wsdl2java] Generating C:\openrules.web\DecisionHelloWSCustomerClient\gen\examples\openrules\com\Customer.java
[axis-wsdl2java] Generating C:\openrules.web\DecisionHelloWSCustomerClient\gen\examples\openrules\com\Response.java
[axis-wsdl2java] Generating C:\openrules.web\DecisionHelloWSCustomerClient\gen\examples\openrules\com\DecisionHelloWSCustomerService.java
[axis-wsdl2java] Generating C:\openrules.web\DecisionHelloWSCustomerClient\gen\examples\openrules\com\DecisionHelloWSCustomerServiceLocator.java
[axis-wsdl2java] Generating C:\openrules.web\DecisionHelloWSCustomerClient\gen\examples\openrules\com\DecisionHelloWSCustomer.java
[axis-wsdl2java] Generating C:\openrules.web\DecisionHelloWSCustomerClient\gen\examples\openrules\com\DecisionHelloWSCustomerSoapBindingStub.java

BUILD SUCCESSFUL
Total time: 0 seconds
Press any key to continue . . .


Interestingly I had got the issue where I needed to add an additional '.' to the path for the excel file and managed to solve it following the instructions in the guide.  However I carried on and executed the DecisionHelloWSCustomerClient using run.bat I got the following:-

C:\openrules.web\DecisionHelloWSCustomerClient>call ant -f "C:\openrules.web\DecisionHelloWSCustomerClient\\build.xml" "run.axis.client"
Buildfile: C:\openrules.web\DecisionHelloWSCustomerClient\build.xml

run.axis.client:
     [java] - Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
     [java] Exception in thread "main" AxisFault
     [java]  faultSubcode:
     [java]  faultString: org.openl.binding.OpenLRuntimeException: argument type mismatch
     [java]  faultActor:
     [java]  faultNode:
     [java]  faultDetail:
     [java]
     [java] org.openl.binding.OpenLRuntimeException: argument type mismatch
     [java]     at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
     [java]     at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
     [java]     at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
     [java]     at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)
     [java]     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
     [java]     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2973)
     [java]     at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
     [java]     at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117)
     [java]     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
     [java]     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
     [java]     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
     [java]     at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
     [java]     at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
     [java]     at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
     [java]     at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:333)
     [java]     at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
     [java]     at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
     [java]     at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
     [java]     at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
     [java]     at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
     [java]     at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
     [java]     at org.apache.axis.client.Call.invoke(Call.java:2767)
     [java]     at org.apache.axis.client.Call.invoke(Call.java:2443)
     [java]     at org.apache.axis.client.Call.invoke(Call.java:2366)
     [java]     at org.apache.axis.client.Call.invoke(Call.java:1812)
     [java]     at examples.openrules.com.DecisionHelloWSCustomerSoapBindingStub.hello(DecisionHelloWSCustomerSoapBindingStub.java:164)
     [java]     at examples.openrules.com.DecisionHelloWSCustomerClient.testHello(DecisionHelloWSCustomerClient.java:38)
     [java]     at examples.openrules.com.DecisionHelloWSCustomerClient.main(DecisionHelloWSCustomerClient.java:12)
     [java] Java Result: 1

BUILD SUCCESSFUL
Total time: 3 seconds
Press any key to continue . . .

Any pointers as to why this is falling over?

Many TIA,

Anthony

OpenRules Support

unread,
Feb 24, 2016, 5:56:44 PM2/24/16
to open...@googlegroups.com

Anthony,

 

Please make sure that when you run generate.axis.client.bat your Tomcat is up and running.

 

OpenRules Support

sup...@openrules.com

--
You received this message because you are subscribed to the Google Groups "OpenRules" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openrules+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Anthony Horner

unread,
Feb 24, 2016, 6:03:32 PM2/24/16
to open...@googlegroups.com
Thanks for getting back,

I can confirm that the server was running at the time.  I've just re-booted, waited and executed 'generate' and still the same message.

I can see through the tomcat app manager that DecisionWSCustomer has been deployed, it's just this last part with the test harness that seems to be failing.

Thanks,

Anthony

--
You received this message because you are subscribed to a topic in the Google Groups "OpenRules" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openrules/JGZNeXvAXpA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openrules+...@googlegroups.com.

OpenRules Support

unread,
Feb 24, 2016, 6:11:28 PM2/24/16
to open...@googlegroups.com

Actually the message

[axis-wsdl2java] - Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.

Is not an error, just a warning that you may ignore. As you can see from the following log all classes were successfully generated. So, now you may simply double-click on your “run.bat” to execute your client. Let us know how it works.

 

OpenRules Support

Anthony Horner

unread,
Feb 24, 2016, 6:16:08 PM2/24/16
to open...@googlegroups.com
Hi,

No-joy, still the same message as before:-

     [java]     at examples.openrules.com.DecisionHelloWSCustomerSoapBindingStub.hello(Unknown Source)
     [java]     at examples.openrules.com.DecisionHelloWSCustomerClient.testHello(Unknown Source)
     [java]     at examples.openrules.com.DecisionHelloWSCustomerClient.main(Unknown Source)
     [java] Java Result: 1

BUILD SUCCESSFUL
Total time: 1 second
Press any key to continue . . .


Any ideas?

Thanks,

Anthony






OpenRules Support

unread,
Feb 24, 2016, 7:30:26 PM2/24/16
to open...@googlegroups.com

Hi Anthony,

 

Strange because our client works fine, here is the proper protocol:

 

C:\eclipse>call ant -f "C:\_SourceRepo\openrules.web\DecisionHelloWSCustomerClient\\build.xml" "run.axis.client"

Buildfile: C:\_SourceRepo\openrules.web\DecisionHelloWSCustomerClient\build.xml

 

run.axis.client:

     [java] - Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.

     [java] greeting: Good Afternoon salutation: Mr.

     [java] Good Afternoon, Mr. Robinson!

 

Have you made any changes in the provided web services or its client? If yes, which ones? You may zip and email us both of your projects to analyze. Don’t worry, we will help.

 

OpenRules Support

sup...@openrules.com

OpenRules Support

unread,
Feb 25, 2016, 7:05:24 PM2/25/16
to OpenRules, sup...@openrules.com
Anthony,

We received your projects and tested them with the latest Tomcat 9.0.0.M3, the same you are using. If you start your Tomcat using its bin/startup.bat you really need to adjust a pass to the main xls-file as you did:

String mainExcelFile = "file:../webapps/DecisionHelloWSCustomer/rules/main/DecisionHelloWSCustomer.xls";  // use ../ instead of ./

Everything looked good but running the client we received the same error as you. The actual reason for the error was the fact that we simply did not clean up Tomcat properly. Please do the following:
- Stop Tomcat
- Remove DecisionHelloWSCustomer.war and the folder DecisionHelloWSCustomer from webapps
- Deploy again running DecisionHelloWSCustomer/deploy.bat
- Start Tomcat
- Run DecisionHelloWSCustomerClient/generate.axis.client.bat
- Run DecisionHelloWSCustomerClient/run.bat

The client runs fine for us and hopefully will run for you as well. Let us know.

Support
...

Tone Loc

unread,
Feb 26, 2016, 2:27:06 AM2/26/16
to OpenRules, sup...@openrules.com
Hi,

Thanks for the instructions, I had no problem following them, they were very clear but unfortunately it still gave the same result.  Looking at the output when I ran "run.bat" for the client I got the following:-

C:\openrules.web\DecisionHelloWSCustomerClient>call ant -f "C:\openrules.web\DecisionHelloWSCustomerClient\\build.xml" "run.axis.client"
Buildfile: C:\openrules.web\DecisionHelloWSCustomerClient\build.xml

run.axis.client:
     [java] - Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
     [java] Exception in thread "main" AxisFault
     [java]  faultSubcode:
     [java]  faultString: org.openl.binding.OpenLRuntimeException: argument type mismatch
     [java]  faultActor:
     [java]  faultNode:
     [java]  faultDetail:
Just a quick thought, in the first line C:\openrules.web\DecisionHelloWSCustomerClient>call ant -f "C:\openrules.web\DecisionHelloWSCustomerClient\\build.xml" "run.axis.client" there are two "\" in the build.xml path with nothing in between, would this be an issue?

I will try this again when I get back from work, there must be something really obvious that I'm missing (grrr!)

Thanks again,

Anthony








Tone Loc

unread,
Feb 29, 2016, 3:58:27 PM2/29/16
to OpenRules, sup...@openrules.com
Hi,

I've double-checked and the message I get back is the same as previously.

The HelloWS example works just fine, it just seems an issue with the client in the HelloWSCustomerClient.

Is there anything else I can try?

Kind regards,

Anthony
...

Jacob Feldman

unread,
Feb 29, 2016, 5:09:04 PM2/29/16
to OpenRules, sup...@openrules.com
Anthony,

We received the same message before when we modified a path to the main xls-file from "file:./rules/..." to 'file:../rules/...". You need two dots when you start your Tomcat using bin/startup.bat. After making this change you really need to stop your Tomcat, delete both war-file DecisionHelloWSCustomer,war and the directory DecisionHelloWSCustomer from webapps, Then delete DecisionHelloWSCustomer.war inside your project DecisionHelloWSCustomer, run deploy.bat, and start Tomcat again. After that, you need to go to your client-project DecisionHelloWSCustomerClient, run generate.axis.client.bat, then compile.bat, Then run.bat should work fine as it does in our environment. Also make sure that you use Java version 6 or higher.

Support

Tone Loc

unread,
Mar 2, 2016, 4:17:47 PM3/2/16
to OpenRules, sup...@openrules.com
Hi Jacob,

Thanks for taking the time to post, Your advice repeats the steps that were posted previously.

The outcome is still the same, same error message etc.

I'm half feeling that this must be something particular to my machine (some hidden register setting or something).  You have come across this before and have a proven workaround but it doesn't work on my laptop, which is unfortunate.

Thanks again and kind regards,

Anthony
...
Reply all
Reply to author
Forward
0 new messages