[rules-users] Error Loading Input Files

Fnu Mahalakshmi FMahalakshmi at nyx.com
Mon Jun 7 11:46:17 EDT 2010


Hi Greg,

It was my mistake and a very basic java question. But you need not be rude for that.

-M
-----Original Message-----
From: rules-users-bounces at lists.jboss.org [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of rules-users-request at lists.jboss.org
Sent: Monday, June 07, 2010 10:44 AM
To: rules-users at lists.jboss.org
Subject: rules-users Digest, Vol 43, Issue 28

Send rules-users mailing list submissions to
        rules-users at lists.jboss.org

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.jboss.org/mailman/listinfo/rules-users
or, via email, send a message with subject or body 'help' to
        rules-users-request at lists.jboss.org

You can reach the person managing the list at
        rules-users-owner at lists.jboss.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of rules-users digest..."


Today's Topics:

   1. Re: Error Loading Input Files. (Fnu Mahalakshmi)
   2. Re: Exception using persistence (Robert)
   3. Re: Exception using persistence (PAYET, Manuel)
   4. Re: Error Loading Input Files. (Greg Barton)


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

Message: 1
Date: Mon, 7 Jun 2010 10:01:23 -0400
From: Fnu Mahalakshmi <FMahalakshmi at nyx.com>
Subject: Re: [rules-users] Error Loading Input Files.
To: "'rules-users at lists.jboss.org'" <rules-users at lists.jboss.org>
Message-ID:
        <994758E35590274E955FA75763C5AA5002D0107B at MTEXMBXP01.ad.NYX.com>
Content-Type: text/plain; charset="us-ascii"

Hi Thomas,

Thanks a lot for the help.
I am also facing problem in uploading my modified working memory back to my output file.
Once the rules are fired and the data in my working memory is modified how do I reupload it to my text file?
I store all my data in a vector which loads it to the working memory.
Could you point me towards some documentation which explains it?

Thanks so much.
M

-----Original Message-----
From: rules-users-bounces at lists.jboss.org [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of rules-users-request at lists.jboss.org
Sent: Monday, June 07, 2010 9:53 AM
To: rules-users at lists.jboss.org
Subject: rules-users Digest, Vol 43, Issue 26

Send rules-users mailing list submissions to
        rules-users at lists.jboss.org

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.jboss.org/mailman/listinfo/rules-users
or, via email, send a message with subject or body 'help' to
        rules-users-request at lists.jboss.org

You can reach the person managing the list at
        rules-users-owner at lists.jboss.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of rules-users digest..."


Today's Topics:

   1. Re: Error Loading Multiple Input Files (Fnu Mahalakshmi)
   2. Re: Error Loading Multiple Input Files (Swindells, Thomas)


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

Message: 1
Date: Mon, 7 Jun 2010 09:41:39 -0400
From: Fnu Mahalakshmi <FMahalakshmi at nyx.com>
Subject: Re: [rules-users] Error Loading Multiple Input Files
To: "'rules-users at lists.jboss.org'" <rules-users at lists.jboss.org>
Message-ID:
        <994758E35590274E955FA75763C5AA5002D0107A at MTEXMBXP01.ad.NYX.com>
Content-Type: text/plain; charset="us-ascii"

Hi Greg,

I have my input files inside the src directory of my eclipse project.

I am passing the files as follows:
private static final String DATA_INPUT_FILE = new String []{ "Input1.txt", "Input2.txt"};

private static final String DATA_OUTPUT_FILE = "Output.1.txt";

private static final String RULES_FILES = new String [] {"Rule1.drl", "Rules2.drl"};

public static void main(String[] args) throws Exception {
BufferedReader input =  new BufferedReader(new FileReader(DATA_INPUT_FILE));
       Converter c = new Converter(DATA_INPUT_FILE); // this reads my input files
          Vector<Object> v  = new Vector<Object>();
          v = c.getFactInput();                     // loads all information contained in the input files

          new RuleRunner().runStatelessRules(RULES_FILES,null, v,null);                               FileOutputStream output = new FileOutputStream(DATA_OUTPUT_FILE);


Error Log:

Exception in thread "main" java.io.FileNotFoundException: Input1.txt (The system cannot find the file specified)
      at java.io.FileInputStream.open(Native Method)
      at java.io.FileInputStream.<init>(Unknown Source)
      at java.io.FileInputStream.<init>(Unknown Source)
      at java.io.FileReader.<init>(Unknown Source)
      at com.org.RulesTest.main(RulesTest.java:29)


Can you tell me why that happens??
The file is present.
Thanks.
M
</pre>

<P><hr size=1></P>
<P><STRONG><font color=green>Please consider the environment before printing this email.</font></STRONG></P>
<P><STRONG>Visit our website at <a href="http://www.nyse.com">http://www.nyse.com</a> <br>

*****************************************************************************
<br>
Note:  The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure.  If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.  If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system.  Thank you.  NYSE Euronext.

</STRONG></P><pre>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100607/cb3ee90b/attachment-0001.html

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

Message: 2
Date: Mon, 7 Jun 2010 14:51:54 +0100
From: "Swindells, Thomas" <TSwindells at nds.com>
Subject: Re: [rules-users] Error Loading Multiple Input Files
To: Rules Users List <rules-users at lists.jboss.org>
Message-ID:
        <DAC86F5F3B84F14088F0DB16092558CA07E8F9E8D3 at UKMA1.UK.NDS.COM>
Content-Type: text/plain; charset="us-ascii"

This isn't really a Drools question just a basic java programming question.
You are trying to read your input files from the current working directory (which defaults to the root of your project in eclipse).
What you probably want to be doing is reading your files from the classpath instead.  Using ResourceFactory.newClassPathResource is the way I normally go about reading my files but you can do it with the standard class loader methods as well.

Thomas

From: rules-users-bounces at lists.jboss.org [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Fnu Mahalakshmi
Sent: 07 June 2010 14:42
To: 'rules-users at lists.jboss.org'
Subject: Re: [rules-users] Error Loading Multiple Input Files

Hi Greg,

I have my input files inside the src directory of my eclipse project.

I am passing the files as follows:
private static final String DATA_INPUT_FILE = new String []{ "Input1.txt", "Input2.txt"};

private static final String DATA_OUTPUT_FILE = "Output.1.txt";

private static final String RULES_FILES = new String [] {"Rule1.drl", "Rules2.drl"};

public static void main(String[] args) throws Exception {
BufferedReader input =  new BufferedReader(new FileReader(DATA_INPUT_FILE));
       Converter c = new Converter(DATA_INPUT_FILE); // this reads my input files
          Vector<Object> v  = new Vector<Object>();
          v = c.getFactInput();                     // loads all information contained in the input files

          new RuleRunner().runStatelessRules(RULES_FILES,null, v,null);                               FileOutputStream output = new FileOutputStream(DATA_OUTPUT_FILE);


Error Log:

Exception in thread "main" java.io.FileNotFoundException: Input1.txt (The system cannot find the file specified)
      at java.io.FileInputStream.open(Native Method)
      at java.io.FileInputStream.<init>(Unknown Source)
      at java.io.FileInputStream.<init>(Unknown Source)
      at java.io.FileReader.<init>(Unknown Source)
      at com.org.RulesTest.main(RulesTest.java:29)


Can you tell me why that happens??
The file is present.
Thanks.
M
________________________________

Please consider the environment before printing this email.

Visit our website at http://www.nyse.com
*****************************************************************************
Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext.



________________________________

**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster at nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100607/a24dc501/attachment.html

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

_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


End of rules-users Digest, Vol 43, Issue 26
*******************************************
Please consider the environment before printing this email.

Visit our website at http://www.nyse.com

****************************************************

Note:  The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure.  If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.  If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system.  Thank you.  NYSE Euronext.




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

Message: 2
Date: Mon, 07 Jun 2010 16:16:25 +0200
From: Robert <robert.weissmann at web.de>
Subject: Re: [rules-users] Exception using persistence
To: rules-users at lists.jboss.org, "Mark Proctor"
        <mproctor at codehaus.org>
Message-ID: <op.vdxolnqngqrarf at ntnbrwe.rgb.systemagmbh.de>
Content-Type: text/plain; charset=iso-8859-15; format=flowed;
        delsp=yes

Hi,

still struggling with this one (see below),

but I did a slide change in the test-code

     try {
       val env = new java.util.Hashtable[String, String]
       env.put(Context.INITIAL_CONTEXT_FACTORY,
"bitronix.tm.jndi.BitronixInitialContextFactory")
       val ctx = new InitialContext(env)
       val ut1 : UserTransaction = (ctx.lookup(
"java:comp/UserTransaction")).asInstanceOf[UserTransaction]
     } catch {
       case ex: Exception => ex.printStackTrace()
     }

(Sorry, code is in Scala, but should not be a problem to read it).

Instead of "java:comp/UserTransaction" (as written in the docs) I wrote
"comp/UserTransaction" and it works.

But since this is some test-code and I am able to do the look-up as I want
("comp/UserTransaction"), as soon as I use


JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env )


I have no influence anymore (its drools-code ;-) and it looks like its
using internally "java:comp/UserTransaction".


Is there any way to change this (setting it) ?

Cheers, Rob



Am 01.06.2010, 23:54 Uhr, schrieb Robert <robert.weissmann at web.de>:

> Well, I tried this but it does not work.
>
> Checking additionally the BitronixInitialContextFactory API where it
> says:
>
> ---------------------------------------------
> "Implementation of InitialContextFactory that allows lookup of
> transaction
> manager and registered resources.
>
> The easiest way to use this provider is to create a jndi.properties file
> in your classpath with this content:
> java.naming.factory.initial=bitronix.tm.jndi.BitronixInitialContextFactory
> Alternatively, you can create a InitialContext object with an environment
> pointing to this class:
>   Hashtable env = new Hashtable();
>   env.put(Context.INITIAL_CONTEXT_FACTORY,
> "bitronix.tm.jndi.BitronixInitialContextFactory");
>   Context ctx = new InitialContext(env);
>
> The transaction manager can be looked up at the standard URL
> java:comp/UserTransaction while resources can be looked up using their
> unique name as set in ResourceBean.getUniqueName(). "
> ---------------------------------------------
>
>
> So, I tried the following ( Its in Scala, but shouldn't be a problem to
> read):
>
>    try {
>      val env = new java.util.Hashtable[String, String]
>      env.put(Context.INITIAL_CONTEXT_FACTORY,
> "bitronix.tm.jndi.BitronixInitialContextFactory");
>      val ctx = new InitialContext(env);
>      val ut1 : UserTransaction = (ctx.lookup( "java:comp/UserTransaction"
> )).asInstanceOf[UserTransaction]
>    } catch {
>      case ex: Exception => ex.printStackTrace()
>    }
>
>
> But still getting the same problem as before at line   "val ut1 : ...".
>
> What I do not get is that the Bitronix API says that the standard URL is
> "java:comp/UserTransaction", but its somehow not found !?!?!?
>
> Any ideas ?
>
> Cheers, Rob.
>
>
>
> Am 31.05.2010, 02:54 Uhr, schrieb Mark Proctor <mproctor at codehaus.org>:
>
>> On 30/05/2010 20:28, Robert wrote:
>>> Hi, I followed the instructions on setting up the persistence in the
>>> drools flow doc, but I get the following exception:
>>>
>>>
>>> Exception in thread "main" java.lang.RuntimeException: Could not commit
>>> session
>>>     at
>>> org.drools.persistence.session.SingleSessionCommandService.<init>(SingleSessionCommandService.java:133)
>>>     at
>>> org.drools.persistence.jpa.impl.JPAKnowledgeServiceProviderImpl.newStatefulKnowledgeSession(JPAKnowledgeServiceProviderImpl.java:44)
>>>     at
>>> org.drools.persistence.jpa.JPAKnowledgeService.newStatefulKnowledgeSession(JPAKnowledgeService.java:93)
>>>     at
>>> com.rob.server.core.process.drools.tasks.DroolsProcessHandler.<init>(DroolsProcessHandler.scala:130)
>>>     at
>>> com.rob.server.core.process.drools.tasks.StartDroolsProcessHandler$.main(DroolsProcessHandler.scala:33)
>>>     at
>>> com.rob.server.core.process.drools.tasks.StartDroolsProcessHandler.main(DroolsProcessHandler.scala)
>>> Caused by: javax.naming.NameNotFoundException; remaining name
>>> 'UserTransaction'
>>>     at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:576)
>>>     at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:663)
>>>     at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:678)
>>>     at
>>> org.eclipse.jetty.jndi.java.javaRootURLContext.lookup(javaRootURLContext.java:110)
>>>     at javax.naming.InitialContext.lookup(InitialContext.java:392)
>>>     at
>>> org.drools.persistence.session.SingleSessionCommandService.<init>(SingleSessionCommandService.java:109)
>>>     ... 5 more
>>>
>>>
>>> I have no idea what this means. I guess SingleSessionCommandService is
>>> looking up for "UserTransaction", but whats the "UserTransaction" ?
>>>
>> You need to configure JTA and JNDI, it uses the standard JNDI lookup
>> mechanism to find the UserTransaction it's to be associated with. See
>> javadocs example here:
>> http://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/javadocs/stable/drools-api/org/drools/persistence/jpa/JPAKnowledgeService.html
>>
>> Each transaction framework has a different way to be configured, some
>> are simpler than others.
>>
>> Mark
>>> Cheers, Rob.
>>>
>>>
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


--
Erstellt mit Operas revolution?rem E-Mail-Modul: http://www.opera.com/mail/


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

Message: 3
Date: Mon, 7 Jun 2010 16:22:18 +0200
From: "PAYET, Manuel" <manuel.payet at capgemini.com>
Subject: Re: [rules-users] Exception using persistence
To: Rules Users List <rules-users at lists.jboss.org>, Mark Proctor
        <mproctor at codehaus.org>
Message-ID:
        <5104F06B63E3164FAEB2F42B920311654CB7762E at CORPMAIL05.corp.capgemini.com>

Content-Type: text/plain; charset="iso-8859-1"

It's probably that your transaction manager, for an odd reason, doesn't bind with the good name;
You can do the following workaround:

Final InitialContext initContext = new InitialContext();
initContext.bind("java:comp/UserTransaction",initContext.lookup("comp/UserTransaction"));

And voila, those two jndi name should point to the same object.

I stress the fact that what I've written hasn't been tested.

-----Message d'origine-----
De : rules-users-bounces at lists.jboss.org [mailto:rules-users-bounces at lists.jboss.org] De la part de Robert
Envoy? : lundi 7 juin 2010 16:16
? : rules-users at lists.jboss.org; Mark Proctor
Objet : Re: [rules-users] Exception using persistence

Hi,

still struggling with this one (see below),

but I did a slide change in the test-code

     try {
       val env = new java.util.Hashtable[String, String]
       env.put(Context.INITIAL_CONTEXT_FACTORY,
"bitronix.tm.jndi.BitronixInitialContextFactory")
       val ctx = new InitialContext(env)
       val ut1 : UserTransaction = (ctx.lookup( "java:comp/UserTransaction")).asInstanceOf[UserTransaction]
     } catch {
       case ex: Exception => ex.printStackTrace()
     }

(Sorry, code is in Scala, but should not be a problem to read it).

Instead of "java:comp/UserTransaction" (as written in the docs) I wrote "comp/UserTransaction" and it works.

But since this is some test-code and I am able to do the look-up as I want ("comp/UserTransaction"), as soon as I use


JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env )


I have no influence anymore (its drools-code ;-) and it looks like its using internally "java:comp/UserTransaction".


Is there any way to change this (setting it) ?

Cheers, Rob



Am 01.06.2010, 23:54 Uhr, schrieb Robert <robert.weissmann at web.de>:

> Well, I tried this but it does not work.
>
> Checking additionally the BitronixInitialContextFactory API where it
> says:
>
> ---------------------------------------------
> "Implementation of InitialContextFactory that allows lookup of
> transaction manager and registered resources.
>
> The easiest way to use this provider is to create a jndi.properties
> file in your classpath with this content:
> java.naming.factory.initial=bitronix.tm.jndi.BitronixInitialContextFac
> tory Alternatively, you can create a InitialContext object with an
> environment pointing to this class:
>   Hashtable env = new Hashtable();
>   env.put(Context.INITIAL_CONTEXT_FACTORY,
> "bitronix.tm.jndi.BitronixInitialContextFactory");
>   Context ctx = new InitialContext(env);
>
> The transaction manager can be looked up at the standard URL
> java:comp/UserTransaction while resources can be looked up using their
> unique name as set in ResourceBean.getUniqueName(). "
> ---------------------------------------------
>
>
> So, I tried the following ( Its in Scala, but shouldn't be a problem
> to
> read):
>
>    try {
>      val env = new java.util.Hashtable[String, String]
>      env.put(Context.INITIAL_CONTEXT_FACTORY,
> "bitronix.tm.jndi.BitronixInitialContextFactory");
>      val ctx = new InitialContext(env);
>      val ut1 : UserTransaction = (ctx.lookup( "java:comp/UserTransaction"
> )).asInstanceOf[UserTransaction]
>    } catch {
>      case ex: Exception => ex.printStackTrace()
>    }
>
>
> But still getting the same problem as before at line   "val ut1 : ...".
>
> What I do not get is that the Bitronix API says that the standard URL
> is "java:comp/UserTransaction", but its somehow not found !?!?!?
>
> Any ideas ?
>
> Cheers, Rob.
>
>
>
> Am 31.05.2010, 02:54 Uhr, schrieb Mark Proctor <mproctor at codehaus.org>:
>
>> On 30/05/2010 20:28, Robert wrote:
>>> Hi, I followed the instructions on setting up the persistence in the
>>> drools flow doc, but I get the following exception:
>>>
>>>
>>> Exception in thread "main" java.lang.RuntimeException: Could not
>>> commit session
>>>     at
>>> org.drools.persistence.session.SingleSessionCommandService.<init>(SingleSessionCommandService.java:133)
>>>     at
>>> org.drools.persistence.jpa.impl.JPAKnowledgeServiceProviderImpl.newStatefulKnowledgeSession(JPAKnowledgeServiceProviderImpl.java:44)
>>>     at
>>> org.drools.persistence.jpa.JPAKnowledgeService.newStatefulKnowledgeSession(JPAKnowledgeService.java:93)
>>>     at
>>> com.rob.server.core.process.drools.tasks.DroolsProcessHandler.<init>(DroolsProcessHandler.scala:130)
>>>     at
>>> com.rob.server.core.process.drools.tasks.StartDroolsProcessHandler$.main(DroolsProcessHandler.scala:33)
>>>     at
>>> com.rob.server.core.process.drools.tasks.StartDroolsProcessHandler.m
>>> ain(DroolsProcessHandler.scala) Caused by:
>>> javax.naming.NameNotFoundException; remaining name 'UserTransaction'
>>>     at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:576)
>>>     at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:663)
>>>     at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:678)
>>>     at
>>> org.eclipse.jetty.jndi.java.javaRootURLContext.lookup(javaRootURLContext.java:110)
>>>     at javax.naming.InitialContext.lookup(InitialContext.java:392)
>>>     at
>>> org.drools.persistence.session.SingleSessionCommandService.<init>(SingleSessionCommandService.java:109)
>>>     ... 5 more
>>>
>>>
>>> I have no idea what this means. I guess SingleSessionCommandService
>>> is looking up for "UserTransaction", but whats the "UserTransaction" ?
>>>
>> You need to configure JTA and JNDI, it uses the standard JNDI lookup
>> mechanism to find the UserTransaction it's to be associated with. See
>> javadocs example here:
>> http://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifac
>> t/trunk/target/javadocs/stable/drools-api/org/drools/persistence/jpa/
>> JPAKnowledgeService.html
>>
>> Each transaction framework has a different way to be configured, some
>> are simpler than others.
>>
>> Mark
>>> Cheers, Rob.
>>>
>>>
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


--
Erstellt mit Operas revolution?rem E-Mail-Modul: http://www.opera.com/mail/ _______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users






This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is
intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to
read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message
in error, please notify the sender immediately and delete all copies of this message.




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

Message: 4
Date: Mon, 7 Jun 2010 07:43:55 -0700 (PDT)
From: Greg Barton <greg_barton at yahoo.com>
Subject: Re: [rules-users] Error Loading Input Files.
To: Rules Users List <rules-users at lists.jboss.org>
Message-ID: <135980.74869.qm at web81507.mail.mud.yahoo.com>
Content-Type: text/plain; charset=iso-8859-1

Like a previous commenter said, the code below won't compile.  java.io.FileReader has three constructors, none of which take a String[].

What you are asking are very, very basic Java questions.  Does the NYSE seriously employ java coders who don't know the answer to these questions?  Try google:

http://www.google.com/search?q=java+writing+text

--- On Mon, 6/7/10, Fnu Mahalakshmi <FMahalakshmi at nyx.com> wrote:

> From: Fnu Mahalakshmi <FMahalakshmi at nyx.com>
> Subject: Re: [rules-users] Error Loading Input Files.
> To: "'rules-users at lists.jboss.org'" <rules-users at lists.jboss.org>
> Date: Monday, June 7, 2010, 9:01 AM
> Hi Thomas,
>
> Thanks a lot for the help.
> I am also facing problem in uploading my modified working
> memory back to my output file.
> Once the rules are fired and the data in my working memory
> is modified how do I reupload it to my text file?
> I store all my data in a vector which loads it to the
> working memory.
> Could you point me towards some documentation which
> explains it?
>
> Thanks so much.
> M
>
> -----Original Message-----
> From: rules-users-bounces at lists.jboss.org
> [mailto:rules-users-bounces at lists.jboss.org]
> On Behalf Of rules-users-request at lists.jboss.org
> Sent: Monday, June 07, 2010 9:53 AM
> To: rules-users at lists.jboss.org
> Subject: rules-users Digest, Vol 43, Issue 26
>
> Send rules-users mailing list submissions to
> ??? rules-users at lists.jboss.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> ??? https://lists.jboss.org/mailman/listinfo/rules-users
> or, via email, send a message with subject or body 'help'
> to
> ??? rules-users-request at lists.jboss.org
>
> You can reach the person managing the list at
> ??? rules-users-owner at lists.jboss.org
>
> When replying, please edit your Subject line so it is more
> specific
> than "Re: Contents of rules-users digest..."
>
>
> Today's Topics:
>
> ???1. Re: Error Loading Multiple Input Files
> (Fnu Mahalakshmi)
> ???2. Re: Error Loading Multiple Input Files
> (Swindells, Thomas)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 7 Jun 2010 09:41:39 -0400
> From: Fnu Mahalakshmi <FMahalakshmi at nyx.com>
> Subject: Re: [rules-users] Error Loading Multiple Input
> Files
> To: "'rules-users at lists.jboss.org'"
> <rules-users at lists.jboss.org>
> Message-ID:
> ??? <994758E35590274E955FA75763C5AA5002D0107A at MTEXMBXP01.ad.NYX.com>
> Content-Type: text/plain; charset="us-ascii"
>
> Hi Greg,
>
> I have my input files inside the src directory of my
> eclipse project.
>
> I am passing the files as follows:
> private static final String DATA_INPUT_FILE = new String
> []{ "Input1.txt", "Input2.txt"};
>
> private static final String DATA_OUTPUT_FILE =
> "Output.1.txt";
>
> private static final String RULES_FILES = new String []
> {"Rule1.drl", "Rules2.drl"};
>
> public static void main(String[] args) throws Exception {
> BufferedReader input =? new BufferedReader(new
> FileReader(DATA_INPUT_FILE));
> ? ? ???Converter c = new
> Converter(DATA_INPUT_FILE); // this reads my input files
> ? ? ? ? ? Vector<Object>
> v? = new Vector<Object>();
> ? ? ? ? ? v =
> c.getFactInput();? ? ? ? ? ?
> ? ? ? ???// loads all
> information contained in the input files
>
> ? ? ? ? ? new
> RuleRunner().runStatelessRules(RULES_FILES,null,
> v,null);? ? ? ? ? ? ?
> ? ? ? ? ? ? ?
> ???FileOutputStream output = new
> FileOutputStream(DATA_OUTPUT_FILE);
>
>
> Error Log:
>
> Exception in thread "main" java.io.FileNotFoundException:
> Input1.txt (The system cannot find the file specified)
> ? ? ? at java.io.FileInputStream.open(Native
> Method)
> ? ? ? at
> java.io.FileInputStream.<init>(Unknown Source)
> ? ? ? at
> java.io.FileInputStream.<init>(Unknown Source)
> ? ? ? at
> java.io.FileReader.<init>(Unknown Source)
> ? ? ? at
> com.org.RulesTest.main(RulesTest.java:29)
>
>
> Can you tell me why that happens??
> The file is present.
> Thanks.
> M
> </pre>
>
> <P><hr size=1></P>
> <P><STRONG><font color=green>Please
> consider the environment before printing this
> email.</font></STRONG></P>
> <P><STRONG>Visit our website at <a href="http://www.nyse.com">http://www.nyse.com</a> <br>
>
> *****************************************************************************
> <br>
> Note:? The information contained in this message and
> any attachment to it is privileged, confidential and
> protected from disclosure.? If the reader of this
> message is not the intended recipient, or an employee or
> agent responsible for delivering this message to the
> intended recipient, you are hereby notified that any
> dissemination, distribution or copying of this communication
> is strictly prohibited.? If you have received this
> communication in error, please notify the sender immediately
> by replying to the message, and please delete it from your
> system.? Thank you.? NYSE Euronext.
>
> </STRONG></P><pre>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100607/cb3ee90b/attachment-0001.html
>
>
> ------------------------------
>
> Message: 2
> Date: Mon, 7 Jun 2010 14:51:54 +0100
> From: "Swindells, Thomas" <TSwindells at nds.com>
> Subject: Re: [rules-users] Error Loading Multiple Input
> Files
> To: Rules Users List <rules-users at lists.jboss.org>
> Message-ID:
> ??? <DAC86F5F3B84F14088F0DB16092558CA07E8F9E8D3 at UKMA1.UK.NDS.COM>
> Content-Type: text/plain; charset="us-ascii"
>
> This isn't really a Drools question just a basic java
> programming question.
> You are trying to read your input files from the current
> working directory (which defaults to the root of your
> project in eclipse).
> What you probably want to be doing is reading your files
> from the classpath instead.? Using
> ResourceFactory.newClassPathResource is the way I normally
> go about reading my files but you can do it with the
> standard class loader methods as well.
>
> Thomas
>
> From: rules-users-bounces at lists.jboss.org
> [mailto:rules-users-bounces at lists.jboss.org]
> On Behalf Of Fnu Mahalakshmi
> Sent: 07 June 2010 14:42
> To: 'rules-users at lists.jboss.org'
> Subject: Re: [rules-users] Error Loading Multiple Input
> Files
>
> Hi Greg,
>
> I have my input files inside the src directory of my
> eclipse project.
>
> I am passing the files as follows:
> private static final String DATA_INPUT_FILE = new String
> []{ "Input1.txt", "Input2.txt"};
>
> private static final String DATA_OUTPUT_FILE =
> "Output.1.txt";
>
> private static final String RULES_FILES = new String []
> {"Rule1.drl", "Rules2.drl"};
>
> public static void main(String[] args) throws Exception {
> BufferedReader input =? new BufferedReader(new
> FileReader(DATA_INPUT_FILE));
> ? ? ???Converter c = new
> Converter(DATA_INPUT_FILE); // this reads my input files
> ? ? ? ? ? Vector<Object>
> v? = new Vector<Object>();
> ? ? ? ? ? v =
> c.getFactInput();? ? ? ? ? ?
> ? ? ? ???// loads all
> information contained in the input files
>
> ? ? ? ? ? new
> RuleRunner().runStatelessRules(RULES_FILES,null,
> v,null);? ? ? ? ? ? ?
> ? ? ? ? ? ? ?
> ???FileOutputStream output = new
> FileOutputStream(DATA_OUTPUT_FILE);
>
>
> Error Log:
>
> Exception in thread "main" java.io.FileNotFoundException:
> Input1.txt (The system cannot find the file specified)
> ? ? ? at java.io.FileInputStream.open(Native
> Method)
> ? ? ? at
> java.io.FileInputStream.<init>(Unknown Source)
> ? ? ? at
> java.io.FileInputStream.<init>(Unknown Source)
> ? ? ? at
> java.io.FileReader.<init>(Unknown Source)
> ? ? ? at
> com.org.RulesTest.main(RulesTest.java:29)
>
>
> Can you tell me why that happens??
> The file is present.
> Thanks.
> M
> ________________________________
>
> Please consider the environment before printing this
> email.
>
> Visit our website at http://www.nyse.com
> *****************************************************************************
> Note: The information contained in this message and any
> attachment to it is privileged, confidential and protected
> from disclosure. If the reader of this message is not the
> intended recipient, or an employee or agent responsible for
> delivering this message to the intended recipient, you are
> hereby notified that any dissemination, distribution or
> copying of this communication is strictly prohibited. If you
> have received this communication in error, please notify the
> sender immediately by replying to the message, and please
> delete it from your system. Thank you. NYSE Euronext.
>
>
>
> ________________________________
>
> **************************************************************************************
> This message is confidential and intended only for the
> addressee. If you have received this message in error,
> please immediately notify the postmaster at nds.com
> and delete it from your system as well as any copies. The
> content of e-mails as well as traffic data may be monitored
> by NDS for employment and security purposes. To protect the
> environment please do not print this e-mail unless
> necessary.
>
> NDS Limited. Registered Office: One London Road, Staines,
> Middlesex, TW18 4EX, United Kingdom. A company registered in
> England and Wales. Registered no. 3080780. VAT no. GB 603
> 8808 40-00
> **************************************************************************************
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100607/a24dc501/attachment.html
>
>
> ------------------------------
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> End of rules-users Digest, Vol 43, Issue 26
> *******************************************
> Please consider the environment before printing this
> email.
>
> Visit our website at http://www.nyse.com
>
> ****************************************************
>
> Note:? The information contained in this message and
> any attachment to it is privileged, confidential and
> protected from disclosure.? If the reader of this
> message is not the intended recipient, or an employee or
> agent responsible for delivering this message to the
> intended recipient, you are hereby notified that any
> dissemination, distribution or copying of this communication
> is strictly prohibited.? If you have received this
> communication in error, please notify the sender immediately
> by replying to the message, and please delete it from your
> system.? Thank you.? NYSE Euronext.
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>






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

_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


End of rules-users Digest, Vol 43, Issue 28
*******************************************
Please consider the environment before printing this email.

Visit our website at http://www.nyse.com

****************************************************

Note:  The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure.  If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.  If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system.  Thank you.  NYSE Euronext.





More information about the rules-users mailing list