Jahia DX > Trouble deploying...

1 (1 Good)
0 (0 Bad)

Trouble deploying template module

by  doahh »  2013/07/14 10:04

I have never used Maven or Jahia before, and I am struggling while trying to get a good work flow for developing templates and would appreciate some advice. I have used a Maven archetype and a standard Jahia install in:

C:\Jahia_xCM_v6.6.1.0

I have modifed the pom.xml and added:

<outputDirectory>C:\Jahia_xCM_v6.6.1.0\tomcat\webapps\ROOT\WEB-INF\var\shared_modules</outputDirectory>

which successfully copies the war to Jahia. However, when Jahia picks up the deloyment I get this in the Jahia log:

java.io.IOException: Unable to delete file: C:\Jahia_xCM_v6.6.1.0\tomcat\webapps\ROOT\modules\template-test-4\META-INF\MANIFEST.MF

as Jahia is holding a file lock (I am on Windows 7). This requires a restart of Jahia which I think will make template development a very tedious task. I can't believe that the Jahia developers put up with that and there must be a better way to do things. I have also tried:

mvn install jahia:deploy

but I not only get the same error in the Jahia log (due to the outputDirectory l added to pom.xml) but also a message from Maven stating:

[ERROR] Failed to execute goal org.jahia.server:maven-jahia-plugin:2.81:deploy (default-cli) on project template-test-4: Error while validating deployers: Factory not initialized properly, you must set the targetServerDirectory variable before calling getInstance ! -> [Help 1]

I have no idea what targetServerDirectory is or how to use it.

Can anyone offer any pointers how they setup their workflow please?

  • Trouble deploying template module
    2013/07/14 10:25

    doahh <p> I have never used Maven or Jahia before, and I am struggling while trying to get a good work flow for developing templates and would appreciate some advice. I have used a Maven archetype and a standard Jahia install in:</p> <p> <em>C:\Jahia_xCM_v6.6.1.0</em></p> <p> I have modifed the pom.xml and added:</p> <p> <em>&lt;outputDirectory&gt;C:\Jahia_xCM_v6.6.1.0\tomcat\webapps\ROOT\WEB-INF\var\shared_modules&lt;/outputDirectory&gt;</em></p> <p> which successfully copies the <em>war</em> to Jahia. However, when Jahia picks up the deloyment I get this in the Jahia log:</p> <p> <em>java.io.IOException: Unable to delete file: C:\Jahia_xCM_v6.6.1.0\tomcat\webapps\ROOT\modules\template-test-4\META-INF\MANIFEST.MF</em></p> <p> as Jahia is holding a file lock (I am on Windows 7). This requires a restart of Jahia which I think will make template development a very tedious task. I can&#39;t believe that the Jahia developers put up with that and there must be a better way to do things. I have also tried:</p> <p> <em>mvn install jahia:deploy</em></p> <p> but I not only get the same error in the Jahia log (due to the <em>outputDirectory</em> l added to pom.xml) but also a message from Maven stating:</p> <p> <em>[ERROR] Failed to execute goal org.jahia.server:maven-jahia-plugin:2.81:deploy (default-cli) on project template-test-4: Error while validating deployers: Factory not initialized properly, you must set the <strong>targetServerDirectory </strong>variable before calling getInstance ! -&gt; [Help 1]</em></p> <p> I have no idea what <em><strong>targetServerDirectory</strong></em> is or how to use it.</p> <p> Can anyone offer any pointers how they setup their workflow please?</p>

  • Number of messages  5
    Registration date Jul 14, 2013
    0 (0 Good)
    0 (0 Bad)

    Re: Trouble deploying template module

    by  doahh »  2013/07/14 10:35

    OK, I found this link and so can now use:

    mvn install jahia:deploy

    but that ended up being a dead-end as I still have the problem with the locked file whether I use jahia:deploy or not:

    java.io.IOException: Unable to delete file: C:\Jahia_xCM_v6.6.1.0\tomcat\webapps\ROOT\modules\template-test-4\META-INF\MANIFEST.MF

    is there no way around this other than to use Linux?

  • Re: Trouble deploying template module
    2013/07/14 15:01

    doahh <p> OK, I found this <a href="http://www.jahia.com/community/documentation/jahiapedia/development/prerequisites.html">link</a> and so can now use:</p> <p> <em>mvn install jahia:deploy</em></p> <p> but that ended up being a dead-end as I still have the problem with the locked file whether I use <em>jahia:deploy</em> or not:</p> <p> <em>java.io.IOException: Unable to delete file: C:\Jahia_xCM_v6.6.1.0\tomcat\webapps\ROOT\modules\template-test-4\META-INF\MANIFEST.MF</em></p> <p> is there no way around this other than to use Linux?</p>

  • Number of messages  5
    Registration date Jul 14, 2013
    0 (0 Good)
    0 (0 Bad)

    Re: Re: Trouble deploying template module

    by  doahh »  2013/07/15 16:36

    Fantastic video here describing how to build templates and shows that I had misunderstood something fundemental about Jahia Studio. It is possible to create the HTML through the user interface (the video shows the use of the default 960gs CSS framework). Therefore it isn't necessary to create the HTML elsewhere and then import it into Jahia as I had thought. Just create it in Jahia and then export it for safety. That means I don't need to hot redeply and can avoid the locked file issue.

    Is this also possible for creating mroe complex modules that would involve Flex application, Java classes and a custom database? I assume that would be a Jahia-app.

  • Re: Re: Trouble deploying template module
    2013/07/15 16:36

    doahh <p> <a href="http://www.youtube.com/watch?v=AiHO0as9CNA&amp;list=PL7D7E1D8C58BCAAD1&amp;feature=plcp">Fantastic video here</a> describing how to build templates and shows that I had misunderstood something fundemental about Jahia Studio. It is possible to create the HTML through the user interface (the video shows the use of the default 960gs CSS framework). Therefore it isn&#39;t necessary to create the HTML elsewhere and then import it into Jahia as I had thought. Just create it in Jahia and then export it for safety. That means I don&#39;t need to hot redeply and can avoid the locked file issue.</p> <p> Is this also possible for creating mroe complex modules that would involve Flex application, Java classes and a custom database? I assume that would be a Jahia-app.</p>

  • Number of messages  5
    Registration date Jul 15, 2013
    0 (0 Good)
    0 (0 Bad)

    Re: Re: Re: Trouble deploying template module

    by  doahh »  2013/07/15 18:28

    OK, I finally have this issue solved. I downloaded Unlocker from here and installed it. I then created an Unlocker.bat file in my project root as follows:

    @echo OFF
    REM The path to the Unlocker executable
    set unlockerExe=C:\Program Files\Unlocker\Unlocker

    REM The path to Jahia
    set jahia=C:\Jahia_xCM_v6.6.1.0\

    REM The name of the expanded folder in Jahia that is to be deleted
    set projectName=template-test-4

    REM **************************************************************************
    REM *           There should be no need to edit below here                   *
    REM **************************************************************************

    REM The path in Jahia that the modules are expanded into
    set modulesDir=tomcat\webapps\ROOT\modules\

    REM The command that causes Unlocker to delete the expanded project directory in Jahia
    REM -S Causes Unlocker to run in silent mode
    REM -D Causes Unlocker to delete rather than just unlock the file
    "C:\Program Files\Unlocker\Unlocker" %jahia%%modulesDir%%projectName% -S -D

    and then in the pom.xml I added this:

    <plugin>
                    <artifactId>exec-maven-plugin</artifactId>
                    <groupId>org.codehaus.mojo</groupId>
                    <executions>
                        <execution>
                            <id>Script Run</id>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>exec</goal>
                            </goals>
                            <configuration>
                                <executable>${basedir}/Unlocker.bat</executable>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

    which causes the batch file to be called which then deletes the expanded war folder from Jahia. The flags in the batch file:

    -S  :runs unlocker in silent mode so that it doesn't open the GUI

    -D  :causes the file to be deleted rather than just unlocked.

    Every 5 or 6 times I get an error from Jahia and need to restart it but I am not sure that is related to the batch file..

    If anyone knows a simpler way then I would love to hear it.

  • Re: Re: Re: Trouble deploying template module
    2013/07/15 18:50

    doahh <p> OK, I finally have this issue solved. I downloaded <a href="http://www.emptyloop.com/unlocker/">Unlocker from here</a> and installed it. I then created an <em>Unlocker.bat</em> file in my project root as follows:</p> <blockquote> <p> @echo OFF<br /> REM The path to the Unlocker executable<br /> set unlockerExe=C:\Program Files\Unlocker\Unlocker<br /> <br /> REM The path to Jahia<br /> set jahia=C:\Jahia_xCM_v6.6.1.0\<br /> <br /> REM The name of the expanded folder in Jahia that is to be deleted<br /> set projectName=template-test-4<br /> <br /> REM **************************************************************************<br /> REM *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; There should be no need to edit below here&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *<br /> REM **************************************************************************<br /> <br /> REM The path in Jahia that the modules are expanded into<br /> set modulesDir=tomcat\webapps\ROOT\modules\<br /> <br /> REM The command that causes Unlocker to delete the expanded project directory in Jahia<br /> REM -S Causes Unlocker to run in silent mode<br /> REM -D Causes Unlocker to delete rather than just unlock the file<br /> &quot;C:\Program Files\Unlocker\Unlocker&quot; %jahia%%modulesDir%%projectName% -S -D</p> </blockquote> <p> and then in the pom.xml I added this:</p> <blockquote> <p> &lt;plugin&gt;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;executions&gt;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;execution&gt;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;id&gt;Script Run&lt;/id&gt;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;phase&gt;generate-sources&lt;/phase&gt;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;goals&gt;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb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sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/plugin&gt;</p> </blockquote> <p> which causes the batch file to be called which then deletes the expanded war folder from Jahia. The flags in the batch file:</p> <blockquote> <p> -S&nbsp; :runs unlocker in silent mode so that it doesn&#39;t open the GUI</p> <p> -D&nbsp; :causes the file to be deleted rather than just unlocked.</p> </blockquote> <p> Every 5 or 6 times I get an error from Jahia and need to restart it but I am not sure that is related to the batch file..</p> <p> If anyone knows a simpler way then I would love to hear it.</p>

  • Number of messages  5
    Registration date Jul 15, 2013
    0 (0 Good)
    0 (0 Bad)

    Re: Trouble deploying template module

    by  dgriffon »  2013/07/23 15:23

    Hello,

    Can you remove the <outputDirectory/> entry from your pom and use mvn clean install jahia:deploy ?

     
    Do you have the same lock issue ?
     
    Jahia should not hold the manifest file in any case, it reads it only once after deploying then releases it. Do you have any antivrius or other process that could open the file ?
     
    best regards
     
    David 

    David Griffon (dgriffon)

    Number of messages  76
    Registration date
    Contact
    Share
    Feedback

    Get in touch

    Whether you are a current user or if you are just evaluating Jahia, we are here to help.

    Contact us

    Share this page