Yeah, it was a classpath error.  I had to create the following dummy
object:

com.sap.jdsr.writer.DsrIPassport

Once I did that and added it to the classpath, I was golden.  Turns
out this is a known error with SAP JCo....

Thanks everyone!

On May 5, 1:49 pm, Sean Devlin <francoisdev...@gmail.com> wrote:
> Another great idea.  Following this technique, the Java code executed
> perfectly when called from Clojure. Time to check my configuration
> again.  Thanks for the tip!
>
> On May 5, 12:59 pm, Adrian Cuthbertson <adrian.cuthbert...@gmail.com>
> wrote:
>
> > Perhaps you could try calling your java class directly from the repl...
>
> > (TutorialConnect1.)
>
> > That might highlight the problem - your java stack strace might give
> > some clues. It does sound like a classpath problem of some sort.
>
> > Rgds, Adrian.
>
> > On Tue, May 5, 2009 at 6:04 PM, Sean Devlin <francoisdev...@gmail.com> 
> > wrote:
>
> > > That's a really good point, thanks for mentioning.  Unfortunately,
> > > after looking into this, it's not the culprit.  The java code's
> > > classpath is a _subset_ of the clojure code's classpath.  Also, the
> > > DsrIPassport class doesn't exist.  It was depricated years ago...
>
> > > The Clojure code appears to be initialized differently from the Java
> > > code.
>
> > > I'll try adding a dummy class, see if that works...
>
> > > On May 5, 11:41 am, David Chamberlin <dawid...@googlemail.com> wrote:
> > >> It sounds like you maybe haven't included all the necessary stuff in
> > >> your classpath.
>
> > >> If you are testing in REPL, then you need to include everything you
> > >> need in the classpath the the invoked JVM, for example:
>
> > >> java -classpath my-jar-file-containing-DsrlPassport.jar;clojure.jar
> > >> clojure.main
>
> > >> On 5 May, 15:54, Sean Devlin <francoisdev...@gmail.com> wrote:
>
> > >> > Okay, I've got code that works in Java but I can't get working in
> > >> > Clojure.  Here's the code in Java
>
> > >> > public class TutorialConnect1 extends Object {
> > >> >   JCO.Client mConnection;
> > >> >   public TutorialConnect1() {
> > >> >     try {
> > >> >       // Change the logon information to your own system/user
> > >> >       mConnection = JCO.createClient(...); //Connection parameters
> > >> >       mConnection.connect();
> > >> >       System.out.println(mConnection.getAttributes());
> > >> >       mConnection.disconnect();
> > >> >     }
> > >> >     catch (Exception ex) {
> > >> >       ex.printStackTrace();
> > >> >       System.exit(1);
> > >> >     }
> > >> >   }
> > >> >   public static void main (String args[]) {
> > >> >     TutorialConnect1 app = new TutorialConnect1();
> > >> >   }
>
> > >> > }
>
> > >> > It simply prints some connection attributes about my system.  Here's
> > >> > the same code in Clojure
>
> > >> > (let [sap-con (com.sap.mw.jco.JCO/createClient ... )] ;connection
> > >> > attributes
> > >> >                            (do
> > >> >                              (. sap-con connect)
> > >> >                              (println (. sap-con getAttributes))
> > >> >                              (. sap-con disconnect)))
>
> > >> > I can successfully create the connection object in Clojure, but I get
> > >> > an error in the following s-exp
>
> > >> > (. sap-con connect)
>
> > >> > The error I get is :
>
> > >> > #<CompilerException java.lang.NoClassDefFoundError: com/sap/jdsr/
> > >> > writer/DsrIPassport (NO_SOURCE_FILE:0)>
>
> > >> > The SAP library I'm using does rely on some native methods.  The only
> > >> > guess I have right now is that the native methods are being linked to
> > >> > properly.
>
> > >> > Can anyone give me a hand?
>
> > >> > Sean
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to