IKVM + DatabaseLoader = 类路径问题
.net 中的 Weka 通过 IKVM 效果很好。 Wiki 里的教程很多 帮助。但是,我认为 weka 加载 jdbc jar 文件的方式导致 .net 中的一些问题。不知有人遇到过这个问题吗 之前知道我做错了什么?
- 我已经使用 ikvmc 编译了 sql jar:ikvmc -target:library sqljdbc4.jar
- 我已将其包含在.net项目中,并放入DatabaseUtils.props 在正确的目录中。
- 我引用的 jar 作为独立版本工作得很好,但在通过 Visual Studio 加载后无法找到 JDBC。
提前致谢。
这是错误输出:
Trying to add database driver (JDBC): com.microsoft.sqlserver.jdbc.SQLServerDriver - Warning, not in CLASSPATH?
java.sql.SQLException: No suitable driver found for jdbc:sqlserver://172.30.157.250;DatabaseName=Bidding;integratedSecurity=false;
ssword=expedia1
at java.sql.DriverManager.getConnection(DriverManager.java:647)
at java.sql.DriverManager.getConnection(DriverManager.java:226)
at weka.experiment.DatabaseUtils.connectToDatabase(DatabaseUtils.java:505)
at weka.experiment.InstanceQuery.retrieveInstances(InstanceQuery.java:287)
at weka.experiment.InstanceQuery.retrieveInstances(InstanceQuery.java:272)
at clusterer.InstanceBuilder.getInstances(InstanceBuilder.java:29)
at clusterer.Clusterer.getTripAdvisorClassified(Clusterer.java:85)
at clusterer.Clusterer.main(Clusterer.java:39)
at cli.ConsoleApplication1.Program.Main(Program.cs:14)
Weka in .net through IKVM works great. The tutorial in Wiki is lots of
help. However, I think the way that weka loads the jdbc jar file is causing
some problems in .net. I wonder if anyone has encountered this problem
before and knows what I am doing wrong?
- I have compiled the sql jar using ikvmc: ikvmc -target:library
sqljdbc4.jar - I have included it in the .net project, and put DatabaseUtils.props
in the proper directory. - The jar that I'm referencing works great as a stand alone, but fails to find the JDBC once it is loaded through Visual Studio.
Thanks in advanced.
Here is the error output:
Trying to add database driver (JDBC): com.microsoft.sqlserver.jdbc.SQLServerDriver - Warning, not in CLASSPATH?
java.sql.SQLException: No suitable driver found for jdbc:sqlserver://172.30.157.250;DatabaseName=Bidding;integratedSecurity=false;
ssword=expedia1
at java.sql.DriverManager.getConnection(DriverManager.java:647)
at java.sql.DriverManager.getConnection(DriverManager.java:226)
at weka.experiment.DatabaseUtils.connectToDatabase(DatabaseUtils.java:505)
at weka.experiment.InstanceQuery.retrieveInstances(InstanceQuery.java:287)
at weka.experiment.InstanceQuery.retrieveInstances(InstanceQuery.java:272)
at clusterer.InstanceBuilder.getInstances(InstanceBuilder.java:29)
at clusterer.Clusterer.getTripAdvisorClassified(Clusterer.java:85)
at clusterer.Clusterer.main(Clusterer.java:39)
at cli.ConsoleApplication1.Program.Main(Program.cs:14)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许在编译时为
ikvmc
工具指定-classloader
选项会有所帮助。示例:
其中 PathToJarsFolder 包含尝试从 java
classpath
加载的所有jar
文件。参考
Maybe it will help to specify the
-classloader
option for theikvmc
tool when compiling.Example :
where PathToJarsFolder contains all the
jar
files that were trying to load from the javaclasspath
.Reference