首页 新闻 会员 周边 捐助

Python调用spring jar包提示找不到类(Jpype)

-1
[待解决问题]

hi all,

spring-context-3.0.5.RELEASE.jar;spring-core-3.0.5.RELEASE.jar;TestApi.jar这三个jar在同一目录下,调用 ;spring-core-3.0.5.RELEASE.jar;TestApi.jar两个jar包都没有问题,但我调用spring-context-3.0.5.RELEASE.jar包里面的ClassPathXmlApplicationContext类提示如下错误,大侠帮忙看一下吧, 非常感谢:

Traceback (most recent call last):
  File "D:\workspase7\LearnNose\src\testcases\callJava.py", line 28, in <module>
    ClassPathXmlApplicationContext = JClass("org.springframework.context.support.AbstractApplicationContext")
  File "C:\Python27\lib\site-packages\jpype\_jclass.py", line 54, in JClass
    raise _RUNTIMEEXCEPTION.PYEXC("Class %s not found" % name)
jpype._jexception.ExceptionPyRaisable: java.lang.Exception: Class org.springframework.context.support.AbstractApplicationContext not found

 

代码如下:

from jpype import *
import os

jarpath = os.path.join(os.path.abspath('.'), 'D:/workspase7/LearnNose/src/testcases/')  

startJVM("C:/Program Files (x86)/Java/jre7/bin/client/jvm.dll","-ea", \
         "-Djava.class.path=spring-context-3.0.5.RELEASE.jar;spring-core-3.0.5.RELEASE.jar;TestApi.jar")  

ClassPathXmlApplicationContext = JClass("org.springframework.context.support.ClassPathXmlApplicationContext")
appContext = ClassPathXmlApplicationContext()


DefaultResourceLoader = JClass("org.springframework.core.io.DefaultResourceLoader")
appContext = DefaultResourceLoader()

shutdownJVM(); 

Eko的主页 Eko | 菜鸟二级 | 园豆:208
提问于:2014-07-24 12:14
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册