首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >M2M转换:在prolog // Null指针中不允许删除关闭//内容的Eclipse

M2M转换:在prolog // Null指针中不允许删除关闭//内容的Eclipse
EN

Stack Overflow用户
提问于 2014-02-21 11:47:27
回答 1查看 153关注 0票数 0

我试图在两个模型之间进行转换,除了在独立模式下使用eclipse之外,每件事似乎都是正常的,我在尝试从java编程执行transformation时出现了错误,

如何解决这个问题?它的鱼缸。谢谢你的帮助,也很抱歉我的英语不好。

错误:

代码语言:javascript
复制
ResourcesPlugin.getWorkspace().getRoot();

线程“主”java.lang.IllegalStateException:工作区中的异常已关闭。在org.eclipse.core.resources.ResourcesPlugin.getWorkspace(ResourcesPlugin.java:399)

代码语言:javascript
复制
File f = new File(Path);            
URI transformationURI = URI.createFileURI(f.getAbsolutePath()); 
resource = resourceSet.getResource(transformationURI, true);`

org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.xml.sax.SAXParseException: org.xml.sax.SAXParseException线程中的异常在prolog中是不允许的。在org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:315) at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274) at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:397)

当我省略这一行时:

代码语言:javascript
复制
//resource = resourceSet.getResource(transformationURI, true);

我还有另外一个例外:

org.eclipse.m2m.qvt.oml.TransformationExecutor.doLoad(TransformationExecutor.java:205) at org.eclipse.m2m.qvt.oml.TransformationExecutor.loadTransformation(TransformationExecutor.java:108) at org.eclipse.m2m.qvt.oml.TransformationExecutor.execute(TransformationExecutor.java:137)上的线程"main“java.lang.ExceptionInInitializerError中的异常 造成: org.eclipse.m2m.internal.qvt.oml.compiler.UnitResolverFactory$Registry$1.readFactories(UnitResolverFactory.java:66) at org.eclipse.m2m.internal.qvt.oml.compiler.UnitResolverFactory$Registry$1.(UnitResolverFactory.java:44) at org.eclipse.m2m.internal.qvt.oml.compiler.UnitResolverFactory$Registry.(UnitResolverFactory.java:43) .6

EN

回答 1

Stack Overflow用户

发布于 2014-02-21 17:48:13

正如this question中所介绍的,您必须运行一个Eclipse应用程序,以确保完成所有必要的Eclipse设置。

对于没有UI的“无头”应用程序,IApplication类可以非常简单:

代码语言:javascript
复制
public class Application implements IApplication
{
  @Override
  public Object start(final IApplicationContext context)
    throws Exception
  {
    .. your code here ...

    return IApplication.EXIT_OK;
  }

  @Override
  public void stop()
  {
    // No action
  }

  private static void ensurePluginStarted(String id)
  {
    Bundle bundle = Platform.getBundle(id);
    if (bundle != null)
     {
       if ((bundle.getState() & Bundle.ACTIVE) == 0)
        {
          try
           {
             bundle.start(Bundle.START_TRANSIENT);
           }
          catch (BundleException ex)
           {
             ex.printStackTrace();
           }
       }
    }
  }
}

此应用程序可以使用Eclipse工作区,但不能使用UI。在某些情况下,可能需要调用ensurePluginStarted方法,以确保将要使用的所有插件都在运行。任何尝试使用UI的插件都会失败。

如果您想要一个UI,那么需要一个完整的Eclipse。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21933636

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档