This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

calling external classes method from kawa


Hi,

all is in the title, i want to call external classes method from kawa, 
i have a kawa class from which i want to call a method of a java class compiled not in kawa but javac, i tried many way but the class and method is unknow at runtime and i got wrning at compilation:

the kawa class is ResultatGeneralFKawa.scm

with this inside:


(module-name "eu.oca.kawafunct.ResultatGeneralFKawa")

(require 'regex)

(define-simple-class ResultatGeneralFKawa ()

[code cut]

((work) ::int 

   (eu.oca.DataBase:helloStatic)

   0)

the java DataBase class has some method such as:


public class DataBase {

[code cut]

public static void helloStatic() {
	System.out.println("Sidonie : DataBase : helloStatic : Hello !");
    }

when compiling i have of course wrnings:

java -jar /usr/local/share/java/kawa-2.1.jar -C ResultatGeneralFKawa.scm
(compiling ResultatGeneralFKawa.scm to eu.oca.kawafunct.ResultatGeneralFKawa)
ResultatGeneralFKawa.scm:178:5: warning - no known slot 'helloStatic' in java.lang.Object
ResultatGeneralFKawa.scm:178:5: warning - no declaration seen for eu.oca.DataBase

the problem is that the documention say i can use -J option to pass java arguments such as defining classpath but it does not works:

kawa -J
Unrecognized option: -J
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

i tried to copy DataBase.class definition in same place as ResultatGeneralFKawa.scm or in eu/oca where is the module (originally the module is in NetBeansProjects/Sidonie/build/web/WEB-INF/classes/eu/oca/DataBase.class
but nothing worked....

just want to call method of an external classes in kawa? is it possible?

already read the doc: http://www.gnu.org/software/kawa/Method-operations.html

find no suitable solution...

errors is now at runtime:

Etat HTTP 500 - ResultatGeneralFKawa.scm:178:5: unbound location: eu.oca.DataBase

type Rapport d''exception

message ResultatGeneralFKawa.scm:178:5: unbound location: eu.oca.DataBase

description Le serveur a rencontré une erreur interne qui l''a empêché de satisfaire la requête.

exception

javax.servlet.ServletException: ResultatGeneralFKawa.scm:178:5: unbound location: eu.oca.DataBase
	org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:392)
	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:382)
	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:345)
	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:220)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

cause mère

ResultatGeneralFKawa.scm:178:5: unbound location: eu.oca.DataBase
	gnu.mapping.SharedLocation.get(SharedLocation.java:22)
	gnu.mapping.DynamicLocation.get(DynamicLocation.java:28)
	eu.oca.kawafunct.ResultatGeneralFKawa.work(ResultatGeneralFKawa.scm:178)
	eu.oca.kawafunct.ResultatGeneralFKawa.<init>(ResultatGeneralFKawa.scm:120)
	eu.oca.ResultatGeneralF.postHandler(ResultatGeneralF.java:107)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	java.lang.reflect.Method.invoke(Method.java:497)
	org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
	org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:151)
	org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:171)
	org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:195)
	org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:104)
	org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:402)
	org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:349)
	org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:106)
	org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:259)
	org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
	org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
	org.glassfish.jersey.internal.Errors.process(Errors.java:315)
	org.glassfish.jersey.internal.Errors.process(Errors.java:297)
	org.glassfish.jersey.internal.Errors.process(Errors.java:267)
	org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:318)
	org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:236)
	org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1010)
	org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:373)
	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:382)
	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:345)
	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:220)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

note La trace complète de la cause mère de cette erreur est disponible dans les fichiers journaux de Apache Tomcat/8.0.27.
Apache Tomcat/8.0.27

Regards,

Damien

-- 
Damien.Mattei@unice.fr, Damien.Mattei@oca.eu, UNS / OCA / CNRS


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]