Java Liferay 7和Vaadin 8:Vaadin共享未激活

Java Liferay 7和Vaadin 8:Vaadin共享未激活,java,liferay,vaadin,portlet,vaadin8,Java,Liferay,Vaadin,Portlet,Vaadin8,我正在尝试安装一个带有vaadinportlet的模块。当bundle启动时,抛出以下异常 有人知道如何检查Vaadin-Liferay集成是否处于活动状态吗?或者我的模块需要自动激活 谢谢 2018-08-30 17:45:07.745 INFO [Refresh Thread: Equinox Container: b06cd3dd-72ac-0018-1cb3-ebc69224d879][BundleStartStopLogger:35] STARTED com.smart.servic

我正在尝试安装一个带有vaadinportlet的模块。当bundle启动时,抛出以下异常

有人知道如何检查Vaadin-Liferay集成是否处于活动状态吗?或者我的模块需要自动激活

谢谢

2018-08-30 17:45:07.745 INFO  [Refresh Thread: Equinox Container: b06cd3dd-72ac-0018-1cb3-ebc69224d879][BundleStartStopLogger:35] STARTED com.smart.services.vaadin.test_1.0.0.SNAPSHOT [979]
2018-08-30 17:45:07.755 ERROR [Refresh Thread: Equinox Container: b06cd3dd-72ac-0018-1cb3-ebc69224d879][com_smart_services_vaadin_test:97] [com.vaadin.osgi.liferay.VaadinPortletProvider(3827)] The activate method has thrown an exception 
com.vaadin.osgi.resources.OsgiVaadinResources$ResourceBundleInactiveException: Vaadin Shared is not active!
    at com.vaadin.osgi.resources.OsgiVaadinResources.getService(OsgiVaadinResources.java:66)
    at com.vaadin.osgi.liferay.VaadinPortletProvider.activate(VaadinPortletProvider.java:53)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.felix.scr.impl.inject.BaseMethod.invokeMethod(BaseMethod.java:224)
    at org.apache.felix.scr.impl.inject.BaseMethod.access$500(BaseMethod.java:39)
    at org.apache.felix.scr.impl.inject.BaseMethod$Resolved.invoke(BaseMethod.java:617)
    at org.apache.felix.scr.impl.inject.BaseMethod.invoke(BaseMethod.java:501)
    at org.apache.felix.scr.impl.inject.ActivateMethod.invoke(ActivateMethod.java:302)
    at org.apache.felix.scr.impl.inject.ActivateMethod.invoke(ActivateMethod.java:294)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:297)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:108)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:906)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:879)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:748)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.enableInternal(AbstractComponentManager.java:674)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.enable(AbstractComponentManager.java:429)
    at org.apache.felix.scr.impl.manager.ConfigurableComponentHolder.enableComponents(ConfigurableComponentHolder.java:657)
    at org.apache.felix.scr.impl.BundleComponentActivator.initialEnable(BundleComponentActivator.java:341)
    at org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:403)
    at org.apache.felix.scr.impl.Activator.access$200(Activator.java:54)
    at org.apache.felix.scr.impl.Activator$ScrExtension.start(Activator.java:278)
    at org.apache.felix.utils.extender.AbstractExtender.createExtension(AbstractExtender.java:259)
    at org.apache.felix.utils.extender.AbstractExtender.modifiedBundle(AbstractExtender.java:232)
    at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:482)
    at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:1)
    at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232)
    at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444)
    at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:905)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
    at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:165)
    at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:75)
    at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:67)
    at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:102)
    at org.eclipse.osgi.container.Module.publishEvent(Module.java:461)
    at org.eclipse.osgi.container.Module.start(Module.java:452)
    at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:454)
    at org.eclipse.osgi.container.ModuleContainer.applyDelta(ModuleContainer.java:717)
    at org.eclipse.osgi.container.ModuleContainer.resolveAndApply(ModuleContainer.java:491)
    at org.eclipse.osgi.container.ModuleContainer.resolve(ModuleContainer.java:437)
    at org.eclipse.osgi.container.ModuleContainer.refresh(ModuleContainer.java:955)
    at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.java:1336)
    at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
我添加了部分代码

我的pom.xml看起来像:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <artifactId>PruebaLiferay7-modules</artifactId>
        <groupId>PruebaLiferay7</groupId>
        <version>1.0.0</version>
    </parent>
    <groupId>com.smart.services.vaadin.portlet.reports.active.agent</groupId>
    <artifactId>fielder-tracking-osgi-test</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <dependencies>
        <dependency>
            <groupId>com.fielder</groupId>
            <artifactId>api-fielder</artifactId>
            <version>3.1-migration</version>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-server</artifactId>
            <version>8.5.1</version>
        </dependency>
        <dependency>
            <groupId>com.liferay.portal</groupId>
            <artifactId>com.liferay.portal.kernel</artifactId>
            <version>3.26.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.liferay.portal</groupId>
            <artifactId>com.liferay.util.taglib</artifactId>
            <version>3.3.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.portlet</groupId>
            <artifactId>portlet-api</artifactId>
            <version>2.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.0.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jstl</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>osgi.cmpn</artifactId>
            <version>6.0.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-liferay-integration</artifactId>
            <version>8.5.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-osgi-integration</artifactId>
            <version>8.5.1</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                    <archive>
                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                    </archive>
                    <excludes>
                        <exclude>**/META-INF/resources/**/.sass-cache/</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>biz.aQute.bnd</groupId>
                <artifactId>bnd-maven-plugin</artifactId>
                <version>4.0.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>bnd-process</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>biz.aQute.bnd</groupId>
                        <artifactId>biz.aQute.bndlib</artifactId>
                        <version>4.0.0</version>
                    </dependency>
                    <dependency>
                        <groupId>com.liferay</groupId>
                        <artifactId>com.liferay.ant.bnd</artifactId>
                        <version>2.0.54</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>
</project>
我的vaadin portlet:

@Component(service = UI.class, property = { "com.liferay.portlet.display-category=category.fielder",
        "javax.portlet.name=" + PortletPortletKeys.Portlet, "javax.portlet.display-name=Fielder Tutorial Portlet",
        "javax.portlet.security-role-ref=power-user,user",
        "com.vaadin.osgi.liferay.portlet-ui=true" }, scope = ServiceScope.PROTOTYPE)

public class ReportServiceAgentPortlet extends UI {

    /** Defines serial version UID. */
    private static final long   serialVersionUID    = 1L;
    /** Class logger. */
    private static final Logger LOGGER              = LogManager.getLogger(ReportServiceAgentPortlet.class);
...

详细描述了该问题

修复程序已经包含在Vaadin 8.9和更新版本中,所以今天最简单的方法就是更新Vaadin版本

对于legacy,我开发了一种只需等待Vaadin Shared处于活动状态,然后完成Vaadin Liferay集成启动的方法。这就解决了问题


只需克隆修复程序,更新Vaadin版本并执行maven构建。

可能有人仍然存在此问题,正在寻找答案。。。
根据我的经验,Vaadin 8.9.0修复了OSGi Portlet(例如,
@Component
)还是WAR风格的Portlet(例如,它是否有Portlet.xml)?请添加代码使其成为一个。你用的是什么版本的Liferay和Vaadin?添加次要版本号。是的,这是一个OSGiportlet,我使用的是Liferay 7.1和Vaadin 8.5.1。我在下面添加了部分代码。感谢您的回答,我下载了vaadin集成的修复程序,并使用vaadin 8.5.1和Liferay应用程序管理器中上载的进行了构建。但我仍然有这个问题。因此,为了找出我做错了什么,我将pom vaadin portley示例更新为使用vaadin 8.5.1、liferay内核3.26.0和osgi版本7.0.0。bundle编译它的fine,然后我将de-jar上传到Liferay,当我试图激活应用程序时抛出错误:未解决的需求:导入包:com.Liferay.portal.kernel.exception;version=“[7.4.0,8.0.0]”在pom中,我有…com.liferay.portal.*,com.liferay.portal.kernel.exception.*;version=“[7.4.0,8.0.0]”,Hello.Vaadin portlet示例是在liferay 7.1之前开发的,导入包版本控制不正确。现在已修复(使用Vaadin 8.2.0测试)。关于Vaadin-liferay集成修复,我认为您遇到了另一个问题。Vaadin服务器(版本8.5.1)导入版本为“[7.0,8]”的包com.liferay.portal.kernel.util,但liferay 7.1导出此包的版本8.0.0。因此,Vaadin服务器不会启动(因此Vaadin-liferay集成)。您应该为Vaadin服务器构建并使用此修复程序:感谢您的回答,我在Liferay 7.0和Vaadin 8.5.1中部署了示例portlet,并且没有错误。在我添加的bnd文件中-includeresource:lib/com.Liferay.portal.kernel.jar=com.Liferay.portal.kernel-[0-9]*.jar;lib:=true,\Bundle ClassPath:\,\lib/com.liferay.portal.kernel.jar,\n似乎liferay 7.1与vaadin有一些问题。谢谢,无论如何,您不必在包中包含任何liferay jar。这会与现有的liferay libs产生冲突。我确认vaadin在liferay 7.1上工作,但在vaadin服务器上(最多8.5.1)需要我做的修复(还有Vaadin-Liferay集成)。我会看看是否能提供更详细的指南,但无论如何,我需要时间。
@Component(service = UI.class, property = { "com.liferay.portlet.display-category=category.fielder",
        "javax.portlet.name=" + PortletPortletKeys.Portlet, "javax.portlet.display-name=Fielder Tutorial Portlet",
        "javax.portlet.security-role-ref=power-user,user",
        "com.vaadin.osgi.liferay.portlet-ui=true" }, scope = ServiceScope.PROTOTYPE)

public class ReportServiceAgentPortlet extends UI {

    /** Defines serial version UID. */
    private static final long   serialVersionUID    = 1L;
    /** Class logger. */
    private static final Logger LOGGER              = LogManager.getLogger(ReportServiceAgentPortlet.class);
...