RSS LinkedIn Twitter

Maven JBoss Plugin Won’t Deploy EAR

December 22nd, 2007 Categories: JBoss, Maven

I’ve just spent a couple hours troubleshooting a problem that I should have realized sooner. I was trying to deploy a Flex/Java application to JBoss using a Maven script (with the JBoss 1.5 plugin) and I was getting an error like this:
Error opening connection java.io.IOException: Server returned HTTP response code: 505 for URL: http://localhost:8080/jmx-console/HtmlAdaptor?action=invokeOpByName&name=jboss.system:service%3DMainDeployer&methodName=undeploy&argType=java.net.URL&arg0=file:C:\Documents and Settings\umptyscratch\deploy/target/umptyscratch-deployment-1.0.ear
I tried entering the URL manually as well as going to the JMX console to enter the parameters and invoke the operation manually. These solutions appeared to work (The browser displayed a message indicating “the operation succeeded with no return code”) but there was no output on the JBoss console indicating deployment had actually occurred.

I finally tracked down this error to the spaces in the file path. To be complete, I url-encoded the spaces and entered the URL manually, but it still failed. I should have known, Java has always had issues with spaces. Part of the difficulty in solving the problem was that I was confounding it with a similar (but different error):
Error opening connection java.io.IOException: Server returned HTTP response code: 500 for URL: http://localhost:8080/jmx-console/HtmlAdaptor?action=invokeOpByName&name=jboss.system:service%3DMainDeployer&methodName=deploy&argType=java.net.URL&arg0=file:C:\umptyscratch\deploy/target/umptyscratch-deployment-1.0.ear
From the start I actually did suspect that the problem was caused by the spaces, the way I initially tested my theory was by copying my project to a different directory (one without spaces in the path) and try redeploying it. That’s when I started to get the second error message. It wasn’t until I noticed the exception stack on the JBoss console that I really started getting anywhere. Here’s the error message output by JBoss before outputting the stack trace:
ERROR [[HtmlAdaptor]] Servlet.service() for servlet HtmlAdaptor threw exception javax.management.InstanceAlreadyExistsException: jboss.j2ee:service=EARDeployment,url='umptyscratch-deployment-1.0.ear' already registered.
It turns out that JBoss doesn’t allow you to deploy two applications with the same name from a different location. I don’t know how it works, there’s probably a signature that includes the file path or something. I had to go into the JBoss server directory and manually remove all references of the one I wasn’t using. This is probably documented in the JBoss documentation, but I haven’t had the priviledge of reading that cover-to-cover yet. And at any rate, the search engines weren’t really turning up anything useful. But there’s nothing like an undocumented solution to make you better at doing what you do.

Tags:
No comments yet.

Leave a Comment

*