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?

  (doahh)

Number of messages  5
Registration date
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?

  (doahh)

Number of messages  5
Registration date
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.

  (doahh)

Number of messages  5
Registration date
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.

  (doahh)

Number of messages  5
Registration date
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