在命令行下运行spring-dm的简单方法

spring-dm开发简单的绑定中介绍了编写spring绑定的方法。运行在eclipse环境中。如果需要单独部署,可这样做(不是最优方案,是最简单的):

还是以helloworldService为例。

将dependency目录下的所有jar文件复制到一个单独的文件夹中,比如c:/hh。将target目录下生成的helloworldService-0.0.1-SNAPSHOT.jar也复制到该目录下。

在c:/hh目录下创建configuration目录,并创建config.ini文件,内容如下:

osgi.bundles=com.springsource.net.sf.cglib-2.1.3.jar@start, com.springsource.org.aopalliance-1.0.0.jar@start, com.springsource.org.apache.commons.logging-1.1.1.jar@start, helloworldService-0.0.1-SNAPSHOT.jar@start, org.springframework.aop-2.5.5.A.jar@start, org.springframework.beans-2.5.5.A.jar@start, org.springframework.context-2.5.5.A.jar@start, org.springframework.core-2.5.5.A.jar@start, org.springframework.osgi.core-1.1.2.A.jar@start, org.springframework.osgi.extender-1.1.2.A.jar@start, org.springframework.osgi.io-1.1.2.A.jar@start

即除osgi包(org.eclipse.osgi-3.4.2.R34x_v20080826-1230.jar)以外,其他需要加入equinox osgi中的绑定都需要按照jar文件名@start[,]语法写在osgi.bundles项下。

然后,就可以运行了(在命令行,hh目录下):

java -jar org.eclipse.osgi-3.4.2.R34x_v20080826-1230.jar -console

k

效果和在eclipse下控制台差不多。执行ss后:

hh

上述环境的打包下载:

[Download not found]

如果在运行期间configuration目录下有错误日志,内容如:

java.lang.IllegalStateException: Unable to acquire application service. Ensure that the org.eclipse.core.runtime bundle is resolved and started (see config.ini).
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:74)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:386)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.main(EclipseStarter.java:150)

 

可在config.ini文件中增加:

eclipse.ignoreApp=true

PDF格式打印機    发送文章为PDF   

这篇文章上的评论的 RSS feed TrackBack URI

Leave a Reply