Pages

Thursday, July 21, 2011

Org.jboss.deployers.spi.DeploymentException: Error determining structure

Share it Please

We see some deployment issue like this

org.jboss.deployers.spi.DeploymentException: Error determining structure: app.war at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49) at org.jboss.deployers.vfs.plugins.structure.explicit.DeclaredStructure.determineStructure(DeclaredStructure.java:89) at org.jboss.deployers.vfs.plugins.structure.StructureDeployerWrapper.determineStructure(StructureDeployerWrapper.java:73) at org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl.doDetermineStructure(VFSStructuralDeployersImpl.java:196)

There’s no way for an application server to identify whether a copy is completed or not. In this case the transfer of the war file is still in progress and JBoss tried to deploy the war. The file was not completely copied hence we get this exception.

One solution may be to copy the war file first to the virtual temp directory and from there we can move the war to deploy directory. Move operation is considered to be atomic than copy.

Hot Deployment Scanner: the transfer of the war file is not completed but JBoss tried to deploy the application. This may be due to hot deployment option in Jboss.We can disable the hot deployment option in /deploy/hdscanner-jboss-beans.xml

<!-- Hotdeployment of applications -->
<bean name="HDScanner" class="org.jboss.system.server.profileservice.hotdeploy.HDScanner">
<property name="deployer"><inject bean="ProfileServiceDeployer"/></property>
<property name="profileService"><inject bean="ProfileService"/></property>
<property name="scanPeriod">5000</property>
<property name="scanThreadName">HDScanner</property>
</bean>

But disabling the hot deployment means, the changes to any application will not get updated until the server is restarted.

<property name="scanPeriod">5000</property>

This is the property which will cause the scan of the deploy directory (or any other) for every 5 seconds. We can raise the value, raising the value means the changes are notified less frequently and decreasing the value is a waste of CPU time.

To disable the hot deployment, add the attribute
<attribute name="ScanEnabled">false</attribute>
There was one more option like to disable the Hot deployment scanner and deploy the application and invoke start operation on application using twiddle like

./twiddle.sh –s localhost invoke "jboss.system.service=MainDeployer" deploy "
file:///...."
(We can redeploy and undeploy also)

We can get the status of the deployments by using twiddle, with operations invoking on
jboss.system:service=MainDeployer like listdeployed () and listdeployedmodules().

Once the application is active we can start the deployment scanner.

The last option is to make sure that the deployment scanner will not deploy files that are still in transfer, every file even while it is transferring will have a suffix. So we can include the suffix in the DeploymentFilter so that the application will not get deployed while it is transferring.

This is available in /conf/bootstrap/profile.xml

<!-- A filter for excluding files from the scanner -->
<bean name="DeploymentFilter" class="org.jboss.virtual.plugins.vfs.helpers.ExtensibleFilter">
<!-- Files starting with theses strings are ignored -->
<property name="prefixes">#,%,\,,.,_$</property>
<!-- Files ending with theses strings are ignored -->
<property name="suffixes">#,$,%,~,\,v,.BAK,.bak,.old,.orig,.tmp,.rej,.sh</property>
<!-- Files matching with theses strings are ignored -->
<property name="matches">.make.state,.nse_depinfo,CVS,CVS.admin,RCS,RCSLOG,SCCS,TAGS,core,tags</property></bean>
We can make sure we add the suffix to this line to disable deployment while the file is in transfer
<property name="suffixes">#,$,%,~,\,v,.BAK,.bak,.old,.orig,.tmp,.rej,.sh</property>


Any other options , please let me know.

More Articles to come, Happy Coding.. J

No comments :

Post a Comment