2011-08-18 2 views
0

PDE (Eclipse Helios)에서 Scala (2.9.1.RC3)를 사용하는 OSGi 번들을 빌드하는 방법. Scala IDE (2.0.0-beta)를 사용하여 프로젝트를 빌드하고이를 PDE 프로젝트로 변환합니다.Eclipse PDE와 Scala IDE를 사용하여 Scala로 OSGi 모듈 빌드하기

Manifest-Version: 1.0 
Bundle-ManifestVersion: 2 
Bundle-Name: ScalaTest1 
Bundle-SymbolicName: ScalaTest1 
Bundle-Version: 1.0.0.qualifier 
Bundle-Activator: scalatest1.Activator 
Import-Package: org.osgi.framework;version="1.3.0" 
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 

오류없이 프로젝트 빌드 만이 예외가 나타납니다 번들을 시작할 때 (아파치 펠릭스 3.2.2 사용) : 내 MANIFEST.MF는 같다

org.osgi.framework.BundleException: Not found: scalatest1.Activator 
     at org.apache.felix.framework.Felix.createBundleActivator(Felix.java:3812) 
     at org.apache.felix.framework.Felix.activateBundle(Felix.java:1899) 
     at org.apache.felix.framework.Felix.startBundle(Felix.java:1822) 
     at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:927) 
     at org.apache.felix.gogo.command.Basic.start(Basic.java:758) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
     at java.lang.reflect.Method.invoke(Unknown Source) 
     at org.apache.felix.gogo.runtime.Reflective.method(Reflective.java:136) 
     at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:82) 
     at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:469) 
     at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:395) 
     at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108) 
     at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183) 
     at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120) 
     at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89) 
     at org.apache.felix.gogo.shell.Console.run(Console.java:62) 
     at org.apache.felix.gogo.shell.Shell.console(Shell.java:203) 
     at org.apache.felix.gogo.shell.Shell.gosh(Shell.java:128) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
     at java.lang.reflect.Method.invoke(Unknown Source) 
     at org.apache.felix.gogo.runtime.Reflective.method(Reflective.java:136) 
     at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:82) 
     at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:469) 
     at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:395) 
     at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108) 
     at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183) 
     at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120) 
     at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89) 
     at org.apache.felix.gogo.shell.Activator.run(Activator.java:75) 
     at java.lang.Thread.run(Unknown Source) 
Caused by: java.lang.ClassNotFoundException: scalatest1.Activator not found by ScalaTest1 [27] 
     at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:812) 
     at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:72) 
     at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1807) 
     at java.lang.ClassLoader.loadClass(Unknown Source) 
     at org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.java:670) 
     at org.apache.felix.framework.Felix.createBundleActivator(Felix.java:3808) 
     ... 33 more 

그리고 코드를 :

package scalatest1 

import org.osgi.framework._ 

class Activator extends BundleActivator { 
    def start(context: BundleContext) { 
    println("Hello, World!"); 

    val bundleNames = context.getBundles() 
     .map(b => b.getSymbolicName()) 
     .filter(b => b != context.getBundle()); 
    println("Installed bundles: " + bundleNames.mkString(", ")); 
    } 

    def stop(context: BundleContext) { 
    println("Goodbye, World!"); 
    } 
} 

프로세스에 어떤 문제가 있습니까? Activator 클래스를 올바르게 매핑하는 방법은 무엇입니까?

미리 감사드립니다.

+0

활성 기 클래스가 Java 인터페이스 BundleActivator를 구현합니까? 번들 또는 패키지의 activator 클래스에서 참조하는 모든 유형이 가져 왔습니까? –

+0

@ bj-hargrave 예. 나는 코드도 게시 할 것이다. – adelarsq

+1

번들이 스칼라 표준 라이브러리 패키지를 가져 오지 못하는 것 같습니다. 불행히도 나는 이것들이 무엇이 될지 모르지만 적어도 "scala"패키지가 필요할 것입니다. scala 콜렉션을 사용하고있는 것처럼 보이기 때문에'scala.collection'을 가져와야 할 것이고'scala.runtime'도 필요할 것입니다. –

답변

0

나는 어리석은 문제를 발견했습니다. "작업 공간에서 컴파일 된 클래스 파일 사용"필드를 내보낼 때 표시가 해제되었습니다. 작동하지만 .scala 파일이 내 보낸 .jar 파일에있는 또 다른 문제점이 있습니다.

관련 문제