0

I haven't worked with Java in about 10 years, so it's very probable I'm doing something elementary wrong here...

I am writing a "server-side extension" for SmartFoxServer (SFS). In my login script, I need to make a connection to MS SQL Server, which I am attempting to do using JDBC. I have tested the JDBC code in my debug environment, and it works fine.

BUT

When I put the server-side extension in the SFS "extensions" folder (as per spec), I'm getting a NoClassDefFoundError thrown - clearly SFS can't find the required JAR (sqljdbc4.jar). I have tried putting this JAR in my classpath; I tried including it in my Eclipse project - but for some reason, SFS adamantly refuses to accept the existence of this JAR.

What am I doing wrong?

Shaul Behr
  • 36,951
  • 69
  • 249
  • 387

1 Answers1

1

I have no experience with the product you mention but many years of Java experience.

Have you tried putting the sqljdbc4.jar in the same location as your server-side extension (the extensions 'directory') ? You will likely have to restart SFS after this.

basszero
  • 29,624
  • 9
  • 57
  • 79
  • Oh. Wow. That worked! But why? Why didn't the classpath setting work? – Shaul Behr May 22 '11 at 09:42
  • The location of the jar is important to the SFS server/process, not what YOUR classpath is set to. – basszero May 22 '11 at 12:23
  • Oho... so is that perhaps also the reason behind this problem? http://stackoverflow.com/q/6087819/7850 – Shaul Behr May 22 '11 at 12:25
  • If you mean a CLASSPATH environment variable, perhaps your ten-year-old Java experience is doing you a disservice. No one has CLASSPATH environment variables anymore, because every IDE and every app server there is ignores it. All it did in this case is fool you into thinking that CLASSPATH was set properly. – duffymo May 22 '11 at 13:30