2014-07-10 6 views
1

나는 SICStus 클래스와 startServer() 방법을 사용하여 이클립스 RCP 응용 프로그램의 일환으로 에서 자바을 SICStus 서버를 시작 SICStus에서 재스퍼 인터페이스를 사용하려고 오전 :이클립스 RCP는 ClassCastException BundleURLConnection JarURLConnection를

http://sicstus.sics.se/sicstus/docs/3.12.7/html/sicstus/Jasper.html http://sicstus.sics.se/sicstus/docs/4.0.8/html/jasper/se/sics/jasper/SICStus.html

나는 SICS에서 jasper.jar을 포함하는 것을 시도했다 내가 알고있는 일반적인 방법을 통해 설치 (플러그인 프로젝트로 포장, & 가져 오기 경로를 추가하여 사용자 라이브러리 만들기). 그러나 SICStus 클래스를 인스턴스화하면 아래에 게시 된 스택 추적을받습니다.

URL classURL = SICStus.class.getResource("SICStus.class"); 
if (debugLevelValueOrig>0) dbgPrintln("classURL==" + classURL); 
String realLibName = System.mapLibraryName(libName); 
try { 
    JarURLConnection juc = (JarURLConnection)classURL.openConnection(); 
… 

BundleURLConnection 및 캐스트 등 일식로드 종속성을 할 수 없기 때문에 인스턴스가 실패 JarURLConnectionclassURL 변수의 캐스트를 만들려고하면 다음과 같이 SICSTus.class의 소스에서 트리거 라인입니다. 클래스는 제품 구성과 연관된 Eclipse 플러그인 프로젝트에서로드해야합니다. 질문 : Eclipse 클래스 로더에 대한 해결 방법이 있습니까? 누구든지 Eclipse 플러그인에서이 클래스를 사용하는 방법에 대한 조언이 있습니까?

는, 사전에 감사 요한 복음

스택 트레이스 :

eclipse.buildId=unknown 
java.version=1.6.0_65 
java.vendor=Apple Inc. 
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US 
Framework arguments: -product com.ios.solstice.base.app.product -cl 
earPersistedState 
Command-line arguments: -product com.ios.solstice.base.app.product 
-data /Users/iosDev11/Documents/ProjectSolstice/../runtime-solstice. 
base.product -dev file:/Users/iosDev11/Documents/ProjectSolstice/.me 
tadata/.plugins/org.eclipse.pde.core/solstice.base.product/dev.prope 
rties -os macosx -ws cocoa -arch x86_64 -consoleLog -clearPersistedS 
tate 

!ENTRY org.eclipse.ui 4 0 2014-07-10 09:58:04.865 
!MESSAGE Unhandled event loop exception 
!STACK 0 
**org.eclipse.e4.core.di.InjectionException: java.lang.ClassCastExcept 
ion: org.eclipse.osgi.framework.internal.core.BundleURLConnection ca 
nnot be cast to java.net.JarURLConnection** 
    at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRe 
questor.java:63) 
    at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(In 
jectorImpl.java:243) 
    at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl 
.java:224) 
    at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(Cont 
extInjectionFactory.java:132) 
    at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.exec 
ute(HandlerServiceHandler.java:167) 
    at org.eclipse.core.commands.Command.executeWithChecks(Command.java 
:499) 
    at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks 
(ParameterizedCommand.java:508) 
    at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.execute 
Handler(HandlerServiceImpl.java:213) 
    at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionIte 
m.executeItem(HandledContributionItem.java:850) 
    at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionIte 
m.handleWidgetSelection(HandledContributionItem.java:743) 
    at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionIte 
m.access$7(HandledContributionItem.java:727) 
    at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionIte 
m$4.handleEvent(HandledContributionItem.java:662) 
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) 
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4166) 
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1466) 
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1489) 
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1474) 
    at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1279) 
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4 
012) 
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:365 
1) 
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.r 
un(PartRenderingEngine.java:1113) 
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Rea 
lm.java:332) 
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run 
(PartRenderingEngine.java:997) 
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(
E4Workbench.java:140) 
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:611) 
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Rea 
lm.java:332) 
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbenc 
h.java:567) 
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java: 
150) 
    at com.ios.solstice.base.app.Application.start(Application.java:21) 
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseApp 
Handle.java:196) 
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.run 
Application(EclipseAppLauncher.java:110) 
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.sta 
rt(EclipseAppLauncher.java:79) 
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStart 
er.java:354) 
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStart 
er.java:181) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessor 
Impl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethod 
AccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636) 
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591) 
    at org.eclipse.equinox.launcher.Main.run(Main.java:1450) 
    at org.eclipse.equinox.launcher.Main.main(Main.java:1426) 
**Caused by: java.lang.ClassCastException: org.eclipse.osgi.framework. 
internal.core.BundleURLConnection cannot be cast to java.net.JarURLC 
onnection 
    at se.sics.jasper.SICStus.loadNativeCode(SICStus.java:536) 
    at se.sics.jasper.SICStus.initSICStus(SICStus.java:834) 
    at se.sics.jasper.SICStus.<init>(SICStus.java:933)** 
    at com.ios.solstice.base.core.prolog.PrologServer.connectSession(Pr 
ologServer.java:52) 
    at com.ios.solstice.base.ui.handler.RunHandler.execute(RunHandler.j 
ava:44) 
    at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerPro 
xy.java:290) 
    at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4Handle 
rProxy.java:90) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessor 
Impl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethod 
AccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRe 
questor.java:56) 
    ... 41 more 
+0

JarURLConnection을 사용하여 무엇을 할 계획입니까? –

답변

1

가 파일 시스템에있는 경우 재스퍼 항아리는 상대적 원래의 파일 시스템 위치에서 작동합니다 의존하는 다른 SICStus 파일. 이것은 SICStus JNI 라이브러리 등을 찾아서로드 할 수 있도록하기위한 것입니다. 따라서 jasper jar 파일을 패키징하는 것은 거의 불가능합니다.

가능한 경우 Jasper를 사용하지 말 것을 권장합니다. SICStus (런타임) 프로세스를 하위 프로세스로 시작하고 표준 스트림을 통해 통신하는 것이 더 좋습니다. 이렇게하면 Java와 SICStus 런타임 사이에 동일한 프로세스에서 공존하려고하는 비 호환성 문제를 피할 수 있습니다. 개발 도중 (표준 스트림 대신 소켓을 통해 통신 할 가능성이 있음) 완전한 개발 시스템을 사용할 수 있기 때문에 디버그하는 것이 훨씬 쉽습니다.