wood burning stoves 2.0*
The moose likes IDEs, Version Control and other tools and the fly likes Eclipse + JBoss - some JAR files not deployed. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Eclipse + JBoss - some JAR files not deployed." Watch "Eclipse + JBoss - some JAR files not deployed." New topic
Author

Eclipse + JBoss - some JAR files not deployed.

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19556
    
  16

I have an Eclipse Indigo installation with a JBoss 6 server managed by it. I have a Maven project with a few modules. These modules all build just fine from the command line.

One of the modules is an EAR. This is dependent on two JAR modules and a couple of WAR modules. When I package the EAR from the command line (mvn clean package), the EAR contains all the necessary JAR and WAR files. However, when I deploy it from Eclipse, the two module JAR files are missing from JBoss. The WAR files are just fine. Inside the "Add and Remove..." dialog the JAR files are also present, but not when deployed. I've checked JBoss' deployments folder and there they are indeed missing. The strange thing is, with the exact same POMs and code, all of my colleagues with the same(?) setup don't have this problem.

The two JAR modules are listed in the dependency management part of the parent POM. They are also listed as dependencies in the EAR POM. Still, Eclipse refuses to deploy them with the EAR.

Does anybody have any idea how I can solve this issue? I can manually package and deploy the EAR, but 1) that takes longer, and 2) I can't use Eclipse's debugging functionality this way.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9343
    
111

I have never used an IDE for deploying application, so I guess I won't be of much help. But I'll just a guess here:

The two JAR modules are listed in the dependency management part of the parent POM. They are also listed as dependencies in the EAR POM. Still, Eclipse refuses to deploy them with the EAR.


Maybe Eclipse considers them just plain jar libraries and not something that need to be deployed? Maybe there's some setting in Eclispe which can be used to mark them as deployables or EJB modules (are those EJB modules by the way)?

[My Blog] [JavaRanch Journal]
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19556
    
  16

There's one other EJB JAR file, but these two just contain a lot of shared code.

The odd thing is (as I've said), in the "Add and Remove..." dialog these two JARs are listed as "children" of the EAR.
I will check if I can mark them as deployable separately and if that will work tomorrow.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19556
    
  16

Marking the two JAR files as deployable doesn't help, I still get the same ClassNotFoundExceptions.

I've now reposted this at http://stackoverflow.com/questions/10595517/eclipse-jboss-some-jar-files-not-deployed.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19556
    
  16

I definitely need to trace this back to Eclipse, since I now get the same problem with a different project and a different JBoss server (5.1.1) which had worked just fine previously. The odd thing is, I have already removed my old workspace and Eclipse installation to start over brand new, and I still get this problem.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19556
    
  16

The problem is solved by throwing away both Eclipse and the workspace, and starting with a fresh Eclipse installation and workspace. No idea why it didn't work before.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15661
    
  15

A little late to the party, but I can think of 2 possibilities that may or may not contribute.

1. Maven/Eclipse. Eclipse can run Maven, but it doesn't understand Maven. Sometimes the two systems get a little confused about file productions and one will think the output files are there and the other won't. Usually you can whack the project with a hammer and they'll fall back into line. I've found that the Project/Clean menu action can be a big help, occasionally augmented by a restart of Eclipse. The more inter-dependent projects you have, however, the more stuff there is that can get out of sync.

2. WTP. If you're using the presupplied webapp server management plugin, that thing is an abomination. Chances are you've already heard me rant on the subject, so I won't repeat, but the major problem there is that the configuration in your projects is neither well-mapped to the WTP application server configuration info nor is it capable of keeping itself in sync with changes automatically.


Customer surveys are for companies who didn't pay proper attention to begin with.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19556
    
  16

Well, the problem reoccurred unfortunately, and this time reinstalling Eclipse + workspace doesn't help. I'll try the project clean / build, and hope that that'll help. I'd like to stop using Maven if that would solve it, but Eclipse + Maven (+ Subversion) is a company policy.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15661
    
  15

The bigger the system, the more you really need Maven. Primarily because if you don't have some sort of standard build architecture - no matter how annoying - everything tends to degenerate into a set of quirky one-off subsystems that require advanced study to work with instead of being able to simply hurl them at random to the first unlucky junior programmer who happens to step through the door.

Worse yet, it's common for people to make their builds dependent on their IDEs, which means that it can be difficult-to-impossible to do quick fixes on any machine but the one that was specifically set up to do the builds on (someday my scars may heal). Maven is designed from the get-go to make building a fully portable process.

So Maven is kind of like Democracy: the worst system in the world - except for all the others.

What I recommend is that you turn off Eclipse entirely and verify that the Maven process itself is clean. If it isn't, Eclipse will only compound the trouble. Ideally, you would select a tabula rasa machine that had absolutely nothing on it except for the core OS, a JDK, JBoss and a VCS client, use the VCS client to pull the source projects and run the top-level build that initiates all the other builds.

Once Maven has been vetted you can bring up Eclipse and tweak its project inter-dependencies.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15661
    
  15

Something I should do more of. Go back and read the original posting.

I did, and kept running into the same offensive phrase: "Eclipse deploy". I don't trust Eclipse to deploy anything. Especially since it almost certainly means that WTP is involved and I've already pronounced curses on WTP in this thread.

I do my deployments without using Eclipse. Aside from everything else, I construct the same identical module for development, test, and production so I generally do only one build and use an external deployment mechanism to install copies of the master images as needed. In the development environment, my desktop copy of Tomcat actually uses the Maven target directly without moving anything anywhere, although I haven't investigated to see how JBoss can deal with that tactic.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19556
    
  16

Maven works just fine from the command line. That's what I'm doing now to deploy the EAR - build from the command line, then manually copy the EAR to JBoss' deployment folder. However, it limits me in my work; it takes longer (just over 1 minute for a mvn clean package, which I have to do several times a day) plus no debug mode (other than adding logging statements, rebuilding and redeploying). The odd thing is that everything worked just fine until I started with this project, and now other projects won't deploy either. Also, this morning everything was working after an Eclipse reinstall until the EAR's application.xml didn't deploy. I then deleted Eclipse again and ever since the JAR file problem is back.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15661
    
  15

I know, I'm working backwards on complaints you made earlier and I was too dim to note them. Sorry. Story of my life. In all fairness, it's like I tell the greenhorns, though. For free, all I can spare is superficial analysis.

First of all, you definitely do not have to deploy EARs via Eclipse to get debugging. Just start JBoss stand-alone with debugging enabled and attach as a remote debugging client same as you would for any other remote Java app. WTP "Run on Server" does exactly the same process, except that it's done internal to Eclipse (and done poorly).

Secondly, an EAR should be completely self-contained. If your EAR is missing critical JARs, that's not a deployment issue, it's a build issue. The EAR wasn't properly built if the dependent JARs aren't part of the EAR file constructed in the EAR POM's target directory. Note that I'm using the term "critical JARs" to mean things like WARs and EJB jars that should rightly be part of the EAR. Application external JARs such as JDBC drivers would be installed separately. Note that auto-building the project probably won't do what you want. You'll actually need to to the "Run As..." command using a Maven goalset, which can be either one of the listed ones or one of your own devising. In either case, a run/debug configuration will be built and saved by Eclipse.

Finally, I've noticed that the Maven plugin for Eclipse does alter the Maven environment somewhat to the point that I've had more than one project fail to build inside Eclipse even though there was nothing wrong at the command-line level. Usually I can fix it, but it's so much work that more often I just flip over to a command prompt and do a "mvn -o clean package" command. Or, if I'm feeling cocky, I have Eclipse open an internal command shell pane and do it there, although the Eclipse shell pane doesn't do command history as neatly.

The "-o" (offline) build option, can shorten the build time noticeably. Once a day I do an online build just to get any mods pulled from the Maven repositories, but most of my builds are offline,
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19556
    
  16

Tim Holloway wrote:Secondly, an EAR should be completely self-contained. If your EAR is missing critical JARs, that's not a deployment issue, it's a build issue. The EAR wasn't properly built if the dependent JARs aren't part of the EAR file constructed in the EAR POM's target directory.

The JAR files (shared code) are inside the lib folder inside the EAR when built from the command line. That's the annoying part. The WARs and EJB JARs don't pose any problems.

Anyway, I now have a long weekend so I can't try anything until Monday. I'll definitely check out that "-o" option though.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15661
    
  15

Rob Spoor wrote:
The JAR files (shared code) are inside the lib folder inside the EAR when built from the command line.


Which is where they should be. If Eclipse is not building them there, then it's either a fault in how you've got Eclipse set up or in how you use Eclipse. I did mention that the auto-builders in Eclipse won't normally do everything. So if you're not doing an explicit invocation of Maven from inside Eclipse, that's your most likely fault. Eclipse will automatically run certain Maven functions, but not a full project build.

Enjoy the weekend!
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19556
    
  16

I will
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Eclipse + JBoss - some JAR files not deployed.
 
Similar Threads
EAR Isolation in Jboss 4.0.2
EAR Isolation in Jboss 4.0.2
WAR inside EAR is not being deployed by WLS 8.1
Best packaging and deployment strategy for web applications
Ant NoClassDefFoundError