简体   繁体   中英

How to deploy a module in an Alfresco deployed in Tomcat

I have successfully deployed alfresco community 4.2.f in a Tomcat 7.0.59 with a database MySQL5.6 and jdk1.8.0_141

No problems thus far, now, I got a module developed by our company which I need to be deployed in alfresco. This module invokes a WS which will send a PDF to some place.

I got this module in a jar compiled with jdk1.8.0_141

I tried to put it inside the alfresco.war before deployment in Tomcat in WEB-INF/lib but when I do that and deploy with startup.bat from Tomcat it pops in the console

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

I understand this exception is caused by putting the jar inside the war. I was told that the jar was compiled also in jdk8.

Also, tell you that if instead of this jar I put inside the alfresco.war in WEB-INF/classes a properties file to get our database in deployment it works fine.

The problem is when I try to deploy the module.

I saw there are quite tutorials pointing to do something like:

java -jar bin/alfresco-mmt.jar

I can't do that because this is done installing alfresco with its wizard I assume. I did it deploying alfresco in a fresh tomcat installation.

Does anyone know how to deploy our module with the way we deployed alfresco? Thank you.

You have two ways to install your amp :

The first traditional one :

This is the one installed with the apply amp procédure (alfresco-mmt). To me, this is not true that it is not compatible with your installation. You can easily find the bin folder (containing the alfresco-mmt.jar file) here in the alfresco packaging : https://download.alfresco.com/release/community/4.2.f-build-00012/alfresco-community-4.2.f.zip

When you have it, you can follow the documentation : http://docs.alfresco.com/4.2/tasks/amp-install.html

And apply your amp for example following this way :

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

The second one :

You can recreate the war with the alfresco sdk and include in the build the module you created. If you follow this documentation : http://docs.alfresco.com/4.2/tasks/dev-extensions-maven-sdk-tutorials-all-in-one-archetype.html the war produced in the target folder of the repo part will contain your module, since the pom of this module will contains a dependency to the amp module :

...
<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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM