• 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 ...
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

J2EE Project Structure and IntelliJ

Posts: 20
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I'm setting up a new J2EE project using IntelliJ IDEA 10.5, and I want to follow the guidelines for a proper project structure. I have created the complete directory structure shown at the top here:

I'm having a lot of difficulty working out what artifacts I need IntelliJ to create and which ones to deploy to Glassfish.

I'm given the choice of artifacts "JavaEE Application", "Web Application", "EJB Application".

At first, I thought I'd just need a "JavaEE Application" artifact to represent "myapp1" in that diagram. This points to an application.xml file in myapp1/myapp1-ejb/src/java/META-INF/application.xml. However, IntelliJ complains that the web resources aren't included in this artifact, and I'm not sure how to point the application.xml to the war (myapp1-war) as I prefer everything to be exploded so there isn't a war file to put inside <web-uri></web-uri>.

So, I created another artifact, this time a "Web Application" one, and pointed that to "myapp1-war". It them seems I can include this web artifact inside the JavaEE Application one. Still, I can't get any of this to deploy to Glassfish... it just throws an exception saying there were no valid components in the application.

Could someone perhaps advise me with how resolve the above, or maybe share with me how their project is set up, or better yet, provide me with an IntelliJ project that's already set up for me to examine?

I always find setting up projects and getting things to build/deploy a million times more difficult than actual coding... so thanks for any advice you can give.


EDIT: I found this:
...but this project doesn't have the recommended structure from the link further above, doesn't have a place for EJBs, and thus only uses a Web Application artifact. What I need to do is similar to this, except for a J2EE Application that will have EJBs.
Posts: 74606
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think this discussion would sit better on our IDEs forum. Moving.
Saloon Keeper
Posts: 24804
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
Exploded WARS are not J2EE-standard. Any properly-designed webapp project should be capable of producing a WAR file. ANY J2EE server can (MUST) accept a WAR file.

Having said that, however, WAR files are typically produced by assembling all the components in a work directory and ZIPPING (or "jar"ing) them up. That directory often remains, and it is an exploded WAR, since an exploded WAR is nothing more than an unzipped WAR.

I take advantage of that in Eclipse by setting up application contexts that use that work directory as the context codebase. I don't do that because I love exploded WARs so much as I do because it says a small but useful amount of time not to actually ZIP up the WAR for testing.

As far as I know, IntelliJ can be made to function the same way, particularly since I'm doing a lot of the work by invoking Maven, and it doesn't care what IDE you have.
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic