1

我正在开发 Liferay 7。我是 Liferay 的新手,我遇到了一个我花了太多时间处理的问题。

我有一个portlet,我决定创建一个Service Builder(名为“Employee”)。这是我的 service.xml :

   <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 7.0.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_7_0_0.dtd">
<service-builder package-path="com.test">
    <author>sachin.singh</author>
    <namespace>crud</namespace>

    <entity name="Employee" table="user" local-service="true" remote-service="true">
        <column name="iduser" type="int" primary="true" id-type="increment"/>
        <column name="name" type="String" />
        <column name="secret_code" type="String" />
    </entity>
</service-builder>

当我使用 liferay 服务构建器进行构建时,我收到了这个错误

  [copy] Copying 1 file to D:\tools\com.liferay.portal.plugins.sdk-1.0.11\portlets\firstLiferay-portlet\docroot\WEB-INF\classes
     [copy] Copied 3 empty directories to 2 empty directories under D:\tools\com.liferay.portal.plugins.sdk-1.0.11\portlets\firstLiferay-portlet\docroot\WEB-INF\classes
      [jar] Building MANIFEST-only jar: D:\tools\com.liferay.portal.plugins.sdk-1.0.11\portlets\firstLiferay-portlet\service-builder-classpath.jar
   [delete] Deleting: D:\tools\com.liferay.portal.plugins.sdk-1.0.11\portlets\firstLiferay-portlet\service-builder-classpath.jar.manifest
     [java] Java Result: 1
   [delete] Deleting: D:\tools\com.liferay.portal.plugins.sdk-1.0.11\portlets\firstLiferay-portlet\service-builder-classpath.jar
     [echo] java.lang.NoClassDefFoundError: com/thoughtworks/qdox/model/JavaMethod
     [echo]     at java.lang.Class.getDeclaredMethods0(Native Method)
     [echo]     at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
     [echo]     at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
     [echo]     at java.lang.Class.getMethod0(Class.java:3018)
     [echo]     at java.lang.Class.getMethod(Class.java:1784)
     [echo]     at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
     [echo]     at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
     [echo] Caused by: java.lang.ClassNotFoundException: com.thoughtworks.qdox.model.JavaMethod
     [echo]     at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
     [echo]     at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
     [echo]     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
     [echo]     at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
     [echo]     ... 7 more
     [echo] Error: A JNI error has occurred, please check your installation and try again
     [echo] Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0
     [echo] Exception in thread "main"

我检查并交叉验证,所有 jar 都在 jar 库中。

这是添加的jar的屏幕截图: 在此处输入图像描述

4

1 回答 1

0

特别是当您是新手时,我建议您再试一次并使用 Liferay Workspace 而不是(已弃用的)plugins-sdk。所有示例(这里是服务构建器的示例)都建立在此之上,并且 plugins-sdk 应该主要用于将现有的旧插件迁移到最新版本。

我不确定您的屏幕截图显示了什么 - 如果它是所有捆绑的罐子,那么它看起来很糟糕。在使用 OSGi 捆绑包时,您应该只拥有很小的插件,而且看起来这些依赖项确实太多了。

于 2017-10-20T10:32:49.810 回答