Liferay 7和Vaadin 8:“ Vaadin Shared”未激活

时间:2018-08-30 20:27:43

标签: java liferay vaadin portlet vaadin8

我正在尝试安装具有vaadin portlet的模块。捆绑包启动时,将引发以下异常。

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

谢谢

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>

我的bdn.bnd

Bundle-Name: fielder-tracking-osgi-test
Bundle-SymbolicName: com.smart.services.vaadin.test
Bundle-Version: 1.0.0-SNAPSHOT

Import-Package: !com.liferay.portal.kernel.util,\
!com.google.*,\
!com.smart.service.api.*,\
!com.smart.service.portal.*,\
!com.vaadin.*,\
!com.googlecode.gentyref.*,\
!com.ibm.icu.text.*,\
!com.amazonaws.services.dynamodbv2.model.*,\
!com.amazonaws.services.kinesis.model.*,\
!com.amazonaws.services.s3.event.*,\
!com.squareup.okhttp.*,\
!com.sun.mail.util.*,\
!com.sun.xml.fastinfoset.sax.*,\
!com.sun.xml.fastinfoset.stax.*,\
!com.vaadin.addon.charts.model.style.*,\
!com.vaadin.data.util.converter.*,\
!com.vaadin.sass.internal.*,\
!com.vaadin.server.data.*,\
!elemental.*,\
!javax.inject.*,\
!libcore.io.*,\
!lombok.*,\
!okio.*,\
!org.antlr.stringtemplate.*,\
!com.beust.jcommander.*,\
!com.conversantmedia.*,\
!com.fasterxml.jackson.*,\
!com.ibm.uvm.*,\
!com.lmax.*,\
!com.sun.*,\
!javax.*,\
!org.apache.*,\
!org.atmosphere.*,\
!org.checkerframework.*,\
!org.fusesource.*,\
!org.jctools.*,\
!org.joda.*,\
!org.json.*,\
!org.jsoup.*,\
!org.jvnet.*,\
!org.zeromq.*,\
!scala.*,\
*
Export-Package: com.smart.services.vaadin.portlet.reports.active.agent.constants}
-jsp: *.jsp,*.jspf
-plugin.jsp: com.liferay.ant.bnd.jsp.JspAnalyzerPlugin
-plugin.resourcebundle: com.liferay.ant.bnd.resource.bundle.ResourceBundleLoaderAnalyzerPlugin
-plugin.sass: com.liferay.ant.bnd.sass.SassAnalyzerPlugin
-sass: *
-includeresource: api-fielder-3.1-migration.jar, fielder-util-api-3.1-migration.jar,\

Bundle-ClassPath:\
  .,\
  api-fielder-3.1-migration.jar.jar,\
  fielder-util-api-3.1-migration.jar,\
  portlet-api.jar,\

我的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);
...

2 个答案:

答案 0 :(得分:2)

该问题已详细描述here

我开发了a fix,可以简单地等待Vaadin Shared处于活动状态,然后再完成Vaadin Liferay Integration启动。这样就解决了这个问题。

只需克隆该修补程序,更新Vaadin版本并执行Maven构建即可。

答案 1 :(得分:0)

也许有人仍然有这个问题,正在寻找答案... 根据我的经验,它是通过Vaadin 8.9.0修复的