java.lang.NoSuchFieldError returns when trying to create a stateless session to the Rules Execution Server - jrules

I am using Ilog JRules Studio 7.1.1 for the rules development. I am using JUnit test cases to test the developed rules.
When i am trying to create a stateless session to the RES, it's returning with the below error.
IlrStatelessSession session = factory.createStatelessSession();
Anyone is having any idea?
java.lang.NoSuchFieldError: ilog/rules/res/decisionservice/plugin/IlrWsdlGenerationInteractionSpec.FUNCTION_NAME_BACKPORT_GENERATE_WSDL
at ilog.rules.res.decisionservice.plugin.IlrWsdlGeneratorInteractionExtension.getSupportedFunctionNames(IlrWsdlGeneratorInteractionExtension.java:418)
at ilog.rules.res.xu.plugin.impl.IlrPluginManager.createPlugins(IlrPluginManager.java:222)
at ilog.rules.res.xu.plugin.impl.IlrPluginManager.changePlugins(IlrPluginManager.java:173)
at ilog.rules.res.xu.plugin.impl.IlrPluginManager.start(IlrPluginManager.java:135)
at ilog.rules.res.xu.spi.IlrManagedXUConnectionFactory.createConnectionFactory(IlrManagedXUConnectionFactory.java:648)
at ilog.rules.res.xu.spi.IlrManagedXUConnectionFactory.createConnectionFactory(IlrManagedXUConnectionFactory.java:668)
at ilog.rules.res.session.util.IlrJ2SEConnectionFactoryFinder.findConnectionFactory(IlrJ2SEConnectionFactoryFinder.java:23)
at ilog.rules.res.session.IlrJ2SESessionFactory.createClientFactory(IlrJ2SESessionFactory.java:93)
at ilog.rules.res.session.IlrJ2SESessionFactory.getClientFactory(IlrJ2SESessionFactory.java:129)
at ilog.rules.res.session.IlrJ2SESessionFactory.createStatelessSession(IlrJ2SESessionFactory.java:62)
Regards,
Hari

Nothing to do with the session.
JRules is crashing because it is not able to generate the WSDL, meaning there is something wrong with your project at first.
Try to run it locally first.
The thing is a web service is automatically provided if the XOM is based on XSD
There is an error somewhere in your project. If you use XSD (which I guess) then have a look to your rule project.
If you use JAVA XOM then there is an error in your web service server (which I doubt) because I cannot see why JRules would complain for your own code.
Verify your in/output parameters
Make it simple first then complicate the process.If simple then redeploy...
Hope it helps

Related

Missing NamedQueries annotation in WAS Liberty environment

I'm using WAS Liberty 8.5.5.5 under Java 7 (tried under Oracle java 7-8 and IBM java 7 as well).
When I create one NamedQuery, the code compiles, deployes, and runs fine.
However, If I try to use the NamedQueries annotation I get the following excpetion:
java.lang.ArrayStoreException: com.sun.proxy.$Proxy29
at sun.reflect.annotation.AnnotationParser.parseAnnotationArray(AnnotationParser.java:765)
at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:537)
at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355)
at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72)
at java.lang.Class.createAnnotationData(Class.java:3521)
at java.lang.Class.annotationData(Class.java:3510)
at java.lang.Class.getAnnotation(Class.java:3415)
After some investigation, I found the following two bugs:
ArrayStoreException in Jboss: https://issues.jboss.org/browse/JBAS-9392
ArrayStoreException when annotation declaring class missing: http://bugs.java.com/view_bug.do?bug_id=7183985
It seems that the javax.persistence.NamedQueries inteface is missing in the enviroment (stangely the javax.persinstence.NameQuery is present ...)
I use Eclipse Kepler for development, the deployment is also handled by the IDE.
On more thing; other developers using the same code base can successfully deploy and run the application with the afformentioned settings - so I suspect the deployment might be responsible for this issue.
Is there a way to "tell" the WAS to include the missing class runtime?
It took some time, but I found the solution.
We are using Ecliselink as a JPA provider, and load it accordingly:
<classloader commonLibraryRef="EclipseLinkLib" delegation="parentLast"/>
It seems that Eclipselink (version 2.5.2) contains the javax.persistence.NamedQuery interface, but not the javax.persistence.NamedQueries interface - this way WAS does not load the missing interface.
By changing delegation="parentFirst" the app works fine.

Using Soap in Shared Mono Library for WP 7 and Android

I'm currently working on an shared library based on mono, where I want to put as much business logic of my app as possible.
I used this helpful tutorial.
I managed putting the whole logic for rest-requests in this shared library, but now I'm stuck with soap.
I used the wsdl command of mono to generate Client Stubcode from my wsdl (as described here http://www.mono-project.com/Web_Services).
When I put the generated class to my C# library, which is the root project of my shared library, there is a warning that the Reference to System.Web.Services cannot be found.
So I included the System.Web.Services.dll manually.
For the Android Library Project I added a Reference to ...\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Web.Services.dll. It compiles without warnings.
But now it comes to the Windows Phone Library Project.
There is no System.Web.Services.dll for WP 7.5, right? I tried with the Mono-Touch dll but it gives me a lot compilation Errors.
Someone knows how I can get out of this?
I actually had some issues with the generated WSDL myself. Turns out that the classes that were generated through the "Create Web Reference" piece of Visual Studio inside of a Mono for Android project ended up causing some big issues when connected to a WCF Web Service. Not sure where I ran into this information, but this is what I ended up doing.
What you need to do is manually create a Service Reference using the SILVERLIGHT SVCUtil.
On my development system it was located here:
C:\Program Files (x86)\Microsoft SDKs\Silverlight\v3.0\Tools
I called it with the below command line:
slsvcutil.exe http://localhost/<path to WCF service endpoint>/service.svc /directory:"<temp directory to store generated cs file>" /noConfig /namespace:"*,<Full namespace of the generated class>"
That will actually generate a CS file that is saved into the path specified by the /directory tag above. Copy that generated cs file to your project directory and then include it in the project.
The problem that I was having that forced me to look for another option was that I was able to pull the data properly using the WSDL generated through the "Add Web Reference" option in Visual Studio, but as soon as I tried to pass the data back up the wire to the web service, everything blew up. Using the Service Reference generated by the Silverlight Service Util actually generated all the code properly for Async operations and after learning how to properly manage those Async operations everything works like a dream.
Since you are generating this new WSDL using the Silverlight Utility, it should work just fine through Windows Phone 7. I believe that the DLL to reference for all of this is the System.ServiceModel dll.
I wish I could remember where I ran across this information, as I would like to give the original author credit, but unfortunately, I don't recall that.
Hope that helps out!
Chaitanya Marvici

How to share a GWT RPC RemoteServiceServlet among multiple client modules / apps

I have several GWT modules and web apps running in Jetty. They each want to use my LoginService RPC interface, so I put this interface and its servlet implementation in a common module. I serve the servlet (LoginServiceImpl) from my root web context, and web.xml exposes it at the url "/loginService". In a another GWT module, to use this service, I had to set the entry point, like this...
LoginServiceAsync loginService = GWT.create(LoginService.class);
ServiceDefTarget t = (ServiceDefTarget)loginService;
t.setServiceEntryPoint("/loginService");
Now, the module trying to use the loginService is called discussions, and I get this error on the server.
ERROR: The serialization policy file
'/discussions/discussions/7B344C69AD493C1EC707EC98FE148AA0.gwt.rpc' was not found;
did you forget to include it in this deployment?
So the servlet is reporting an error that mentions the client (the discussions module). I'm guessing that the RPC plumbing passed the name of this .rpc file through from the client, and the servlet is now looking for it. (?) As an experiment, I copied, the *.gwt.rpc files from the discussions module into the root web context, so the servlet could find them. This did stop the error. But I still get another error:
com.google.gwt.user.client.rpc.SerializationException: Type
'mystuff.web.shared.User' was not assignable to
'com.google.gwt.user.client.rpc.IsSerializable' and did not have a custom field
serializer. For security purposes, this type will not be serialized.: ...
This class is serializable; it worked before in other modules, so now I'm lost.
What is the right way to use the LoginService from multiple clients modules?
Update:
This error was showing up in hosted devmode, and it went away after a full compile. Maybe this is related to gwt serialization policy hosted mode out of sync . I will update again if I can better reproduce the problem.
See my answer here. The short answer is: you'll need to make mystuff.web.shared.Users source available at compile-time to your discussions module.

How to run GWT RequestFactory Validation Tool on Eclipse project

I've got a Android AppEngine Connected Project I'm trying to build using GWT2.4 RequestFactory and Objectify on my Eclipse IDE.
Apparently I need to run the RequestFactory Validation Tool because I'm using ServiceName and ProxyForName annotations (these are required especially when working on the Android client side). My problem is the Eclipse can't validate it and the solution provided at http://code.google.com/p/google-web-toolkit/wiki/RequestFactoryInterfaceValidation#IDE_configuration is enough to make me rip my eyes out.
Since I'm working on a Windows machine, the shell script provided is not very useful. Trying to run Validation Tool from a cmd propt returns the error message:"This tool must be run with a JDK, not a JRE"
Can someone explain how this Tool is supposed to be run? Is there a way to use it as an External Tool in eclipse?
Normally if you follow carefully the instructions in the link you show, and run the GWT Development Mode from Eclipse, the Validation should be done automatically at the time you access the development URL with your browser.
For the record, I've actually had some problems with it, but launching the application several times maked it work.
Well, I ran into the same problem as well. When I tried annotation processing (under Java Compiler-> Annotation processing )was being disabled. So RequestFactoryDeobfuscatorBuilder was not being generated. Try enabling that and rebuilding your project.
I've just recovered from two days of hunting this bug down in a project that used to run validation properly but stopped.
In my case I had a new-ish generic BaseRequestContext and a specific sub-interface that extended it. My parent interface declared a method that didn't match the Locator's exactly (e.g. getThing(T) vs get(T)) and this wasn't reported as an error but did stop the validation tool from completing.
Apt is also removed in Java 8 : http://openjdk.java.net/jeps/117 . So beware.
Switching back to Java 7 will fix the issue if you are using Java 8.
I understood why the error happens sometimes in a project: the compiler was complaining it cannot find the directory .apt . But when I tried to create it manually it was not possible (under windows). I think the validation tool mutes the exception of not being able to create the directory: try renaming .apt in your validation tool calls (do a text search in your project)

tomcat6 and drool rules reloading

I have run into an issue where when I modify my drools rules(.drl) on the fileSystem it appears to work as a JUnit testcase but fails when try to test the same in the web application running under Tomcat6.
When I modify the drl file under Tomcat, I do see logs saying KnowledgeAgent is rebuilding the knowledgeBase and so on and I do see new a instance of KBase under KAgent in the debugger but still when I execute the rule it shows the original values.
Was wondering if there is any cache tomcat uses internally for rules and if yes whats the workaround?
Any help is appreciated.
As I understand your question, I think you have to reload your drl file when it gets changed.
Are you using ResourceFactory.newClassPathResource() method for loading your rule files? If yes, then use ResourceFactory.newInputStreamResource(stream) method. It always gets latest modified drl file.