• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Eclipse + JBoss - some JAR files not deployed.

 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)?
 
Rob Spoor
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Rob Spoor
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I will
 
reply
    Bookmark Topic Watch Topic
  • New Topic