Calling a JAR from SS

Hi Y'all

I'm trying to use a self created JAR with screen scraper but I'm having little success. The interpreted Java within screen scraper appears to just die without any errors/messages when I try to create a new instance of the class. Any suggestions on how to debug this (none of the logs under SS highlight the cause of this issue). Details below...

The JAR has been placed in the Screenscraper lib/ext directory.

I also tried placing the class file in the fully qualified directory based on the Java package name /lib/ext/marksull/library.

I also tried modifying my Classpath variable to make sure the JAR was explicitly included.

I also tried putting a try/catch around the problem commands but it doesn't appear an exception is ever created.

I also tried creating a small java app with the code below (without the session logs) and made sure it could import the class and execute it fine (which it could).

So I'm scratching my head. Its going to be something simple and obvious but I've no idea right now.

Here is a test script I'm using. I attached it to a scraping session so that I can debug and log its progress.

import marksull.library.*;

session.log ("--...--start--...-");
String[] myArray = new String[13];

myArray[0] = "993";
myArray[1] = "Mt Annan";
myArray[2] = "2567";
myArray[3] = "Somewhere";
myArray[4] = "400000";
myArray[5] = "3";
myArray[6] = "2";
myArray[7] = "2";
myArray[8] = "Not me";
myArray[9] = "";
myArray[10] = "";
myArray[11] = "";

session.log (" Property ID - " + myArray[0]);
session.log ("1");
myScreenScrape myscrape = new myScreenScrape();
session.log ("2");
String myResults = myscrape.cleanAndWrite(myArray);
session.log ("3");
session.log (myResults);
session.log ("--...--start--...--");

And here is the scraping session log. Not that the last session output is "1", which is right before a new instance is created.

[quote]

Starting scraper.
Running scraping session: Test
Processing scripts before scraping session begins.
Processing script: "Java - RealEstate.com.au - Write to DB"
--...--start--...--
Property ID - 993
1
Processing scripts after scraping session has ended.
Scraping session finished.

[/quote]

Love to hear any suggestions....cheers

Solution?

Was there a solution to this problem. The same thing is happening to me using the basic version from the command line on linux.

Sorry for the delay. I was

Sorry for the delay. I was trying to milk my resources to figure out what the problem had been.

I'm also sorry for repeating history, but could you send me your JAR file? (I don't need the source itself, but if you could send me the jar, and also that script you're executing, I can be a little more useful.) I will of course post the results here, for future reference. Unfortunately, that didn't get posted last time we solved the issue.

Calling a JAR from SS

Hm. Is there a chance you could send me your jar file and scraping session so that I could take a closer look for you? My email address is my first name at screen-scraper.com.

Thanks,

Todd

Calling a JAR from SS

Thanks for the suggestion Todd. I made the change as you suggested, but experience the same result (the script stops processing at the the variable declaration)

Calling a JAR from SS

Oop! My mistake. This is what I meant to suggest

myscrape = new myScreenScrape();

Leave off the class name before the variable name.

Todd

Calling a JAR from SS

Hey Todd

Thanks for the reply...

First question - no - there wasn't anything in the error logs that gave me any clue - twas the first placed I looked.

Secondly, there doesn't appear to be any difference between your suggested variable declaration an my original ;-)

Mine
myScreenScrape myscrape = new myScreenScrape();

Yours
myScreenScrape myscrape = new myScreenScrape();

cheers

Calling a JAR from SS

Hi,

A couple of possibilities come to mind:

- First, do you see anything in the log\error.log file that may be related?
- Second, this may seem a bit odd, but we've found BeanShell (the library that handles Interpreted Java scripts) to be a bit funny about declaring variables. Try changing this line:

myScreenScrape myscrape = new myScreenScrape();

to this:

myScreenScrape myscrape = new myScreenScrape();

If that doesn't seem to help, feel free to write back.

Kind regards,

Todd Wilson