Hello,

This is a bit of a follow on on a previous thread of mine, 
"org.apache.hadoop.util.Shell$ExitCodeException whenever Samza container 
launches".

So I am not sure whether this is a bug, or if I am not doing something correct, 
or it is intended, but whenever I attempt to call Class.forName() on an 
external library class from within Samza, I am running into a 
ClassNotFoundException. My Maven deps are set up correctly, and the exact same 
code works without any issues if invoked manually through a main() method, for 
example, as opposed to running it through Samza.

The reason I want to do this, is to test that classes for JDBC drivers can be 
found and used. I fully understand that this method is no longer needed as of 
JDBC 4.0, and that the drivers should be automatically loaded if found in the 
class path, although this isn't happening either (an SQLException is thrown 
with "No suitable driver found" if I leave out the Class.forName() call, which 
leads to the same problem). Just so you know, this same code also works fine 
and loads the appropriate JDBC driver if invoked directly through a main() 
method.

I have also tried this with a number of different external libraries, both 
pulled in using Maven and manually linking .jar files on my disk, and the same 
result; those classes can be found fine from a standard Java main() method 
call, but cannot be found running in a Samza container.

Has anyone encountered the same issue, or know of why this could be happening?

I hope all that made sense, let me know if it didn't and I'll try to rephrase.

Here is the class I am trying to do this in, in case anyone wants to see what 
I'm talking about:
https://github.com/poltak/hello-samza/blob/database-reader/samza-wikipedia/src/main/java/samza/examples/databasereader/system/DatabaseReaderConsumer.java

Anyway, thanks for your time,
Jonathan

Reply via email to