当我用2个会话测试我的应用程序时,在一个浏览器中所有的东西都可以,而在另一个浏览器中我得到了异常
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@PreserveOnRefresh
@SpringComponent
public class TestUI extends UI {
@Autowired
MainLayout content;
@Autowired
DetailView detailView;
@Override
protected void init(VaadinRequest request) {
VaadinSession.setCurrent(VaadinSession.getCurrent());
Navigator navigator = new Navigator(this, detailView);
navigator.addView("tests", TestView.class);
setContent(content);
}
}
Run Code Online (Sandbox Code Playgroud)
java.lang.IllegalStateException:未锁定会话时无法从父项中删除.此外,还有另一个锁定会话,表示该组件可能即将从一个会话移动到另一个会话.at com.vaadin.ui.AbstractSingleComponentContainer.removeFromParent(AbstractSingleComponentContainer.java:175)at com.vaadin.ui.AbstractSingleComponentContainer.setContent(AbstractSingleComponentContainer.java:148)at com.vaadin.ui.UI.setContent(UI.java:1312) )
我使用Apache Felix来实现osgi包并将其用作嵌入式Felix框架来调用boundle
这是我的 Maven 插件来构建 MANIFEST.MF :
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.5.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
<Bundle-Activator>a.b.c.osgi.activator.Activator</Bundle-Activator>
</instructions>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我构建项目,然后在嵌入的 felix 中使用 jar 文件,如下所示
BundleContext bundleContext = f.getBundleContext();
Bundle bundle = bundleContext.installBundle(
"file:/home/eclipse_workSpace/my-module/target/abc-1.1.0.jar");)
String bName = bundle.getLocation();
bundle.getRegisteredServices();
bundle.getState();
/* Bundle[] bls = bundleContext.getBundles(); */
System.out.println("starting bundle " + bName);
bundle.start();
Run Code Online (Sandbox Code Playgroud)
当我开始 Boundle 时,我遇到了这个异常
线程“main”中的异常 org.osgi.framework.BundleException:无法解析 abc [1](R 1.0):缺少要求 [abc [1](R 1.0)] osgi.wiring.package;(&(osgi.wiring.package=com.google.common.base)(version>=21.0.0)(!(version>=22.0.0))) 未解决的要求:[[abc [1](R 1.0) ] osgi.wiring.package;(&(osgi.wiring.package=com.google.common.base)(版本>=21.0.0)(!(版本>=22.0.0)))]
我应该怎么做才能解决这个问题?