07-06-2009 05:25 AM
Anybody here has tried a non ejb rule sevice ie without using the NdStatelessEjbServerAppBean .
Using EJB has some disadvantages when you have 10+ rule projects and you would want a single class handling the invocation .
This is even better when you do not have an rules which has any transactional nature.
Here the EJB becomes an overhead.
On the other hand we could use dependency injection and try to acheive this.
I tried using the NdStatelessServer and tried dynamically assigning the server config (NdServerConfig) to it when an instance is created and tried invoking the rules through a web application
The only result i get is that the application hangs .
Is there an example some where so that i can have a look at the code for non EJD deployment in a web application.
Solved! Go to Solution.
07-06-2009 06:14 AM
I usually do non-ejb stateless deployment. Try to get the application working using a plain quick deployer deployment first, i.e. just give the server the path to the configuration file.
When that works, go ahead and customize.
I have never had the application just hang. Either it works, or it fails with a more or less legible exception. If it just hangs, could it be an IO block? How is your project loader configuration? Are you loading from CVS, from (local) disk, precompiled ADB's, over a network?
07-06-2009 07:10 AM
Thanks for the quick reply.
All the .server files are in the web folder of the application.
Maybe you are right i have some confusion as to how to load the files
I tried generating the non ejb deployment file and i get the following 3 files
For loading the configuration they have the following code
private final static String _SERVER_CONFIG = "./ValidationRules.server";
String serverConfig = (args.length > 0) ? args : _SERVER_CONFIG;
Server server = (Server)Server.createServer(serverConfig);
The path is just passed as a string from current directory to the .createServer method
about which i have no idea
// Create the client of the server
Client client = new Client(server);
then passes it on to the client to invoke.
But the server has a constructor as below
public Server(NdServerConfig serverConfig)
Which needs a NdServerConfig.
Do i need to pass the configuration as NdServerConfig or is it enough to
pass the path to the createServer() method.
Thanks once again and i really appreciate your response.
You would do me great help if i get this resolved.
07-08-2009 04:34 AM
Thanks for the suggestion .
I tried out your suggestion of using the creater server method.
All went well until i started getting a class not found exception for my customised
rules server class (RulesServer.java) which extends the NdStatelessServer class.
It happens when i call the createServer method passing the path to the server file.
RulesServer rulesServ = (RulesServer)RulesServer.createServer(serverConfig
In the server file
I have specified the custom server class in the follwing node
<JavaName> com.core.blaze.RulesServer </JavaName>
The error happens when blaze tries to load the server configuration
Failed to create the server from a configuration.
Class 'com.core.blaze.RulesServer' could not be found. Please verify it is on the classpath. vmcid: 0x0
RulesServer class is part of my applications project folder so i dont see why the class is not loader before blaze tries to instantiate the class.
Please let me know if you need any more details to help me out .
07-08-2009 04:53 AM
Usually, this happens for one of two reasons
- You don't have the class on your classpath, in which case the solution is to put the class on your classpath (obviously)
- The class is on the classpath, but has not yet been loaded by the application classloader, and can't be loaded by the classloader used by the rules server.
A "fix" I usually use for situations when the rules runtime is unable to find a class is to create a static reference to that class somewhere before the server is initialized.
For example in the method that does the createServer invocation, you could try to add a Class.forName(...) for the relevant classes
I'm not saying this will solve your problem, but it is something that has worked for me before, so you could try that.
07-13-2009 07:14 PM
If your custom server class could not be found, you would get NoClassDefFoundError. ClassNotFoundException means that some other class referenced from your server class is missing. For example, your custom object model classes. Also it may happen when some of classes (e.g. Advisor libraries) are loaded by a global classloader and some others are loaded by the application-level classloader. Try running the server with -verbose:class JVM option, it may tell you more precisely which class exactly is missing.
EJB quick deployer puts all Blaze libraries into the EAR file, but if you do your own deployment (e.g. creating your own WAR file) you need take care of proper class loading sequence.
Blaze Solution Architect