I have a jython servlet as part of a large application running in tomcat5. I 开发者_JS百科tested a few Spring Framework classes and create the objects in the Jython servlet. When I try to create objects of classes in the application I catch an Exception message "No visible constructors for class". These java classes do have a public constructor class, such as:
public SchoolImpl() {
}
I create the object in python:
from com.dc.sports.entity import SchoolImpl
...
school = SchoolImpl()
What am I doing wrong?
doublep / cluch answered the question :-) in the comment
adding just a little info:
From the Jython FAQ :
3.3 Why can't I execute a 'protected' or 'private' Java instance method or access a 'protected' or 'private' attribute in a Java package?
By default, as in Java, these methods are protected from external access. Access to all Java fields and methods can be enabled with the python.security.respectJavaAccessibility registry setting:
# Setting this to false will allow Jython to provide access to
# non-public fields, methods, and constructors of Java objects.
python.security.respectJavaAccessibility = false
精彩评论