Download Blaze Trial
Follow FICO
LinkedIn   Twitter   Youtube
Close To access this section, please choose the Community Neighborhood in which you have the most interest.

» Business Rules Management
» Collections & Recovery
» Fraud Management
» Risk Management
» Scoring
Close To access this section, please choose the Community Neighborhood in which you have the most interest.

» Business Rules Management
» Collections & Recovery
» Fraud Management
» Risk Management
» Scoring
Reply
Contributor
Posts: 11
Registered: ‎06-03-2009
Accepted Solution

Non EJB deployment in a j2ee application

Hi ,

 

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.

 

Regards,

Sumesh

DM-Forums Moderator
Posts: 472
Registered: ‎10-02-2008

Re: Non EJB deployment in a j2ee application

Hi,

 

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? 

 

Regards, 

Jostein 

Contributor
Posts: 11
Registered: ‎06-03-2009

Re: Non EJB deployment in a j2ee application

Hi Jostein,

 

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

 

1) Server.java

2) Runner.java

3) client.java

 

For loading the configuration they have the following code

 

private final static String _SERVER_CONFIG = "./ValidationRules.server";

 

String serverConfig = (args.length > 0) ? args[0] : _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)
   throws NdLocalServerException
 {
  super(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.

 

Best regards,

Sumesh

 

 

 

DM-Forums Moderator
Posts: 472
Registered: ‎10-02-2008

Re: Non EJB deployment in a j2ee application

I usually use the createServer method, but I have also used the constructor. Both will work, just choose one :-)

 

Regards, 

Jostein 

Contributor
Posts: 11
Registered: ‎06-03-2009

Re: Non EJB deployment in a j2ee application

Hi Jostein,

 

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

 

 <ServerFactory>
  <JavaName> com.core.blaze.RulesServer </JavaName>
 </ServerFactory>

 

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 .

 

Thanks ,

Sumesh

DM-Forums Moderator
Posts: 472
Registered: ‎10-02-2008

Re: Non EJB deployment in a j2ee application

Usually, this happens for one of two reasons

  1. You don't have the class on your classpath, in which case the solution is to put the class on your classpath (obviously)
  2. 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.

 

Regards,

Jostein  

Super Contributor
Andrei
Posts: 249
Registered: ‎09-26-2008

Re: Non EJB deployment in a j2ee application

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.

Andrei Palskoi
Blaze Solution Architect