【问题标题】:How to deploy a module in an Alfresco deployed in Tomcat如何在部署在 Tomcat 中的 Alfresco 中部署模块
【发布时间】:2017-08-08 06:59:44
【问题描述】:

我已经成功在 Tomcat 7.0.59 中部署了 alfresco community 4.2.f,数据库 MySQL5.6 和 jdk1.8.0_141

到目前为止没有问题,现在,我得到了我们公司开发的一个模块,我需要部署在露天。这个模块调用一个 WS,它将一个 PDF 发送到某个地方。

我把这个模块放在一个用 jdk1.8.0_141 编译的 jar 中

在 Tomcat 的 WEB-INF/lib 中部署之前,我尝试将它放在 alfresco.war 中,但是当我这样做并使用 Tomcat 中的 startup.bat 进行部署时,它会在控制台中弹出

instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/codehaus/xfire/XFireRuntimeException

我了解此异常是由于将罐子放入战争中造成的。 有人告诉我这个jar也是用jdk8编译的。

另外,告诉你,如果我在 WEB-INF/classes 的 alfresco.war 中放置一个属性文件而不是这个 jar 来让我们的数据库投入部署,它就可以正常工作。

问题出在我尝试部署模块时。

我看到有很多教程指向做类似的事情:

java -jar bin/alfresco-mmt.jar

我不能这样做,因为我假设这是用它的向导安装 alfresco 完成的。我在全新的 tomcat 安装中部署了 alfresco。

有谁知道如何使用我们部署 alfresco 的方式部署我们的模块?谢谢。

【问题讨论】:

  • 看起来你制作的模块是一个罐子而不是一个放大器。因此,如果您有外部依赖项,它们将不会包含在您的打包中:“对于不存在对第三方库的依赖项的扩展,简单的 JAR 模块通常是首选的打包类型。”你应该使用我给你的解决方案之一。
  • 我刚看到这个评论,这个jar没有第三方库,那最好带jar吧?那么有可能以我告诉你我做对的方式之一部署扩展程序吗?
  • 这很难说,因为你手动把一个罐子放进了WAR:我不能保证你没问题,对不起。
  • 我发现了问题所在,首先正如我在对您的帖子的评论中告诉您的那样,它不是用 jdk8 编译的,但这不是唯一的问题,依赖关系没有更新到 alfresco 4.2.f,它们针对之前部署的 alfresco 2.1.0 进行了更新。你知道一种方法来检查或知道哪些是新 pom.xml 的兼容依赖项吗?
  • 我太专注于我部署错误,但问题是模块中的代码......

标签: java tomcat deployment alfresco


【解决方案1】:

您有两种安装放大器的方法:

第一个传统的:

这是使用应用放大器程序 (alfresco-mmt) 安装的。 对我来说,它与您的安装不兼容是不正确的。您可以在 alfresco 包装中轻松找到 bin 文件夹(包含 alfresco-mmt.jar 文件):https://download.alfresco.com/release/community/4.2.f-build-00012/alfresco-community-4.2.f.zip

当你拥有它时,你可以按照文档:http://docs.alfresco.com/4.2/tasks/amp-install.html

并以这种方式应用您的放大器:

java -jar alfresco-mmt.jar install <AMPFileLocation> <WARFileLocation>

第二个:

您可以使用 alfresco sdk 重新创建战争,并在构建中包含您创建的模块。 如果您遵循此文档:http://docs.alfresco.com/4.2/tasks/dev-extensions-maven-sdk-tutorials-all-in-one-archetype.html repo 部分的目标文件夹中生成的战争将包含您的模块,因为此模块的 pom 将包含对 amp 模块的依赖项:

...
<dependencies>
     <dependency>
          <groupId>${alfresco.groupId}</groupId>
          <artifactId>alfresco</artifactId>
          <type>war</type>
     </dependency>
     <!-- Demonstrating the dependency on the repo AMP developed in the 'amp' 
                           module -->
      <dependency>
          <groupId>x.y.z</groupId>
          <artifactId>my-amp</artifactId>
          <version>${my-amp.version}</version>
          <type>amp</type>
          </dependency>
      </dependencies>
      ...
      <build>
            <plugins>
                    <plugin>
                         <artifactId>maven-war-plugin</artifactId>
                         <configuration>
                         <!-- Here is can control the order of overlay of your (WAR, AMP, etc.) 
                                              dependencies | NOTE: At least one WAR dependency must be uncompressed first 
                                              | NOTE: In order to have a dependency effectively added to the WAR you need 
                                               to | explicitly mention it in the overlay section. | NOTE: First-win resource 
                                              strategy is used by the WAR plugin -->
                                 <overlays>
                                 <!-- Current project customizations -->
                                       <overlay />
                                       <!-- The Alfresco WAR -->
                                       <overlay>
                                           <groupId>${alfresco.groupId}</groupId>
                                           <artifactId>alfresco</artifactId>
                                           <type>war</type>
                                            <!-- To allow inclusion of META-INF -->
                                            <excludes />
                                             </overlay>
                                            <!-- Add / order your AMPs here -
                                        <overlay>
                                             <groupId>x.y.z</groupId>
                                             <artifactId>my-amp</artifactId>
                                             <type>amp</type>
                                         </overlay>
                                       </overlays>
                               </configuration>
                      </plugin>
               </plugins>
       </build>

【讨论】:

  • 我部署 alfresco 所做的是将 alfresco.war 和 share.war 放在 alfresco-community-4.2.f.zip\web-server\webapps 中的 alfresco-community-4.2.f.zip\web-server\webapps 中tomcat-7.0.59\webapps,然后是 apache-tomcat-7.0.59/bin 中的 startup.bat。当我在 webapp 内的 alfresco 文件夹中执行此操作时,我看不到 bin 文件夹
  • 对不起,我不太明白你的问题。你能澄清一下你的问题是什么吗?
  • 我想使用你提出的第一个解决方案,但是当我在 tomcat 中部署 alfresco 时,正如我告诉你的那样,我在 tomcat/webapps/alfresco 中没有 bin 文件夹。我看到的唯一 bin 文件夹是来自 tomcat 的那个,我列出了我在 tomcat/webapps/alfresco 中的目录以澄清我拥有的目录:META-INF、WEB-INF、cmis-browser-app、cmisfs、css、css -样板,favicon.ico,图像,index.jsp,jsp,脚本,服务,swf,wsdl,yui
  • 我还尝试创建 tomcat/shared/classes 和 tomcat/shared/lib 并在 catalina.properties 中设置:shared.loader=${catalina.base}/shared/classes, ${catalina .base}/shared/lib 当我再次执行 startup.bat 时,它无法识别我的 jar,因为我无法执行它在部署 jar 模块时执行的操作
  • 好的,我的意思是你可以复制 alfresco-community-4.2.f.zip 存档根目录下的 bin 文件夹到你的 tomcat 的根文件夹(或者只是 mmt jar 任何地方),然后使用命令 java -jar alfresco-mmt.jar install 。集成您的放大器的好方法。
猜你喜欢
  • 2011-07-05
  • 2012-03-19
  • 1970-01-01
  • 2011-07-28
  • 2015-05-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多