由于OSGI BundleException,GWT插件无法在使用JDK 11或17的Eclipse 2022-03中加载

9njqaruj  于 2022-12-12  发布在  Eclipse
关注(0)|答案(3)|浏览(182)

1.已下载的Eclipse:eclipse-java-2022-03-R-linux-gtk-x86_64.tar.gz
1.已从以下更新站点安装GWT:http://storage.googleapis.com/gwt-eclipse-plugin/v3/release/
1.尝试了各种Java版本(存储库中的OpenJDK 11和17以及从www.example.com下载adoptium.net)
1.总是遇到同样的问题:

org.osgi.framework.BundleException: Could not resolve module: com.gwtplugins.gdt.eclipse.core [600]
  Unresolved requirement: Require-Bundle: com.gwtplugins.gdt.eclipse.platform
    -> Bundle-SymbolicName: com.gwtplugins.gdt.eclipse.platform; bundle-version="3.0.0.201710131939"; singleton:="true"
       com.gwtplugins.gdt.eclipse.platform [602]
         No resolution report for the bundle.  Bundle was not resolved because of a uses constraint violation.
  org.apache.felix.resolver.reason.ReasonException: Uses constraint violation. Unable to resolve resource com.gwtplugins.gdt.eclipse.platform [osgi.identity; type="osgi.bundle"; version:Version="3.0.0.201710131939"; osgi.identity="com.gwtplugins.gdt.eclipse.platform"; singleton:="true"] because it is exposed to package 'javax.servlet' from resources javax.servlet [osgi.identity; type="osgi.bundle"; version:Version="3.0.0.v201112011016"; osgi.identity="javax.servlet"] and jakarta.servlet-api [osgi.identity; type="osgi.bundle"; version:Version="4.0.0"; osgi.identity="jakarta.servlet-api"] via two dependency chains.

Chain 1:
  com.gwtplugins.gdt.eclipse.platform [osgi.identity; type="osgi.bundle"; version:Version="3.0.0.201710131939"; osgi.identity="com.gwtplugins.gdt.eclipse.platform"; singleton:="true"]
    require: (osgi.wiring.bundle=javax.servlet)
     |
    provide: osgi.wiring.bundle: javax.servlet
  javax.servlet [osgi.identity; type="osgi.bundle"; version:Version="3.0.0.v201112011016"; osgi.identity="javax.servlet"]

Chain 2:
  com.gwtplugins.gdt.eclipse.platform [osgi.identity; type="osgi.bundle"; version:Version="3.0.0.201710131939"; osgi.identity="com.gwtplugins.gdt.eclipse.platform"; singleton:="true"]
    require: (osgi.wiring.bundle=org.eclipse.jetty.servlet)
     |
    provide: osgi.wiring.bundle; bundle-version:Version="10.0.6"; osgi.wiring.bundle="org.eclipse.jetty.servlet"
  org.eclipse.jetty.servlet [osgi.identity; type="osgi.bundle"; version:Version="10.0.6"; osgi.identity="org.eclipse.jetty.servlet"]
    import: (&(osgi.wiring.package=javax.servlet)(&(version>=4.0.0)(!(version>=5.0.0))))
     |
    export: osgi.wiring.package: javax.servlet
  jakarta.servlet-api [osgi.identity; type="osgi.bundle"; version:Version="4.0.0"; osgi.identity="jakarta.servlet-api"]
    at org.eclipse.osgi.container.Module.start(Module.java:463)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel$2.run(ModuleContainer.java:1847)
    at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor$1$1.execute(EquinoxContainerAdaptor.java:136)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1840)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1781)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1745)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1667)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345)

我的系统Eclipse描述如下:

eclipse.buildId=4.23.0.I20220308-0310
java.version=17.0.3
java.vendor=Private Build
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=de_DE
Framework arguments:  -product org.eclipse.epp.package.java.product
Command-line arguments:  -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.java.product -data XXXXXXXXX

uname -aLinux mycomputername #25~20.04.2tux1 SMP Tue Apr 12 10:34:50 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Linux:Ubuntu 20.04.4 LTS,带有“Budgie”桌面
我还尝试了另一个Eclipse版本,但结果相同。(eclipse-SDK-4.23-linux-gtk-x86_64.tar.gz
我发现了其他的BundleException问题,但是only one for GWT,它没有答案。而且其他的问题不适用于这个问题。它们是由应用程序的创建者引起的,但我不是GWT的创建者,其他人使用它没有问题。

编辑2022年5月1日:

我没有找到解决办法,但找到了奇怪的变通办法:如果我使用不带“Eclipse Java Web Developer Tools”的Eclipse下载,并使用带有旧Eclipse更新站点的“.p2f”文件从那里安装旧版本的“Eclipse Java Web Developer Tools”,那么GWT就可以工作。
这个问题与javax.servlet“.jar”文件有关。如果Eclipse决定下载javax.servlet_3.1.0.v201410161800.jar,GWT就可以工作。但是如果Eclipse决定使用javax.servlet_3.0.0.v201112011016.jar,GWT就不能工作。奇怪的是:较新版本的Eclipse使用较旧版本的“.jar”,较旧版本的Eclipse使用较新版本的“.jar”。
对于来自https://download.eclipse.org/eclipse/downloads/drops4/R-4.23-202203080310/的Eclipse,下面的“.p2f”文件为我提供了一个可以工作的GWT安装:

<?xml version='1.0' encoding='UTF-8'?>
<?p2f version='1.0.0'?>
<p2f version='1.0.0'>
  <ius size='3'>
    <iu id='org.eclipse.jst.web_ui.feature.feature.group' name='Eclipse Java Web Developer Tools' version='3.22.0.v202103200058'>
      <repositories size='1'>
        <repository location='https://download.eclipse.org/releases/2021-06'/>
      </repositories>
    </iu>
    <iu id='com.gwtplugins.eclipse.sdkbundle.gwt28.feature.feature.group' name='GWT 2.8.1 SDK' version='2.8.0.201710131939'>
      <repositories size='1'>
        <repository location='http://storage.googleapis.com/gwt-eclipse-plugin/v3/release'/>
      </repositories>
    </iu>
    <iu id='com.gwtplugins.eclipse.suite.v3.feature.feature.group' name='GWT Eclipse Plugin' version='3.0.0.201710131939'>
      <repositories size='1'>
        <repository location='http://storage.googleapis.com/gwt-eclipse-plugin/v3/release'/>
      </repositories>
    </iu>
  </ius>
</p2f>

之后,卸载旧的“EclipseJavaWebDeveloperTools”并从当前更新站点安装当前版本。GWT将继续工作。
正如我所说,这不是一个解决方案,只是一个奇怪的变通办法。

fnx2tebb

fnx2tebb1#

获得我发现的GWT插件的最简单的方法是不手动更改Eclipse安装文件(让我们承认,绝大多数开发人员不会这样做):
1.从此处下载Eclipse 2021-09版本https://www.eclipse.org/downloads/packages/release/2021-09/r
1.从Marketplace安装GWT插件
1.将Eclipse更新至最新版本
2021-09之后的任何Eclipse版本都不会让你成功安装GWT插件。

qzwqbdag

qzwqbdag2#

这似乎是com.gwtplugins.gdt.eclipse.platform包中的一个缺陷,它使用Require-Bundle访问javax.servlet包,而它本应使用Import-Package。
com.gwtplugins.gdt.eclipse.platform Require-Bundle的javax.servlet包和org.eclipse.jetty.servlet包使用不同版本的javax.servlet包,因此无法正确构造类加载器。

cyej8jka

cyej8jka3#

以下是修补版本:https://static.sapsailing.com/com.gwtplugins.gdt.eclipse.platform_3.0.0.201710131939.jar我已经将Require-Bundle替换为以下包的相应Import-Package条目:

  • javax.servlet
  • javax.servlet.http
  • javax.servlet.annotation
  • javax.servlet.descriptor安装了这个包,并使用“-clean”选项启动Eclipse后,我成功地获得了GWT菜单项并重新启动了配置。

相关问题