• Post Reply Bookmark Topic Watch Topic
  • New Topic

JavaEE on IntelliJ  RSS feed

 
Farhod Miralimov
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
I'm learning Java in a school now, and we are covering JavaEE stuff right now. Our teacher, prepared "Eclipse EE developing kit" which includes all we need to develop EE stuff, you know, with the WildFly 9 server, some plugins bundled with Eclipse for EE developers and so on.
All the learning, apart from the actual coding, looks pretty much like "click here, next, next and then finish, and there you go".

From the beginning of the course, I got IntelliJ IDEA student license, and liked it much more than Eclipse, and got used to it!. But because of the instructors teaching style, I'm having problems doing the same on IntelliJ. For instance:

1. How do I create eclipse's "Enterprise application project" in IDEA?
When I create a project with "JavaEE application" selected, it creates a simple project with "src" folder. In Eclipse i'ts just a container for other modules/projects

2.When I Create a JAX-RS project on Eclipse, there is a way to use the dependency provided with the server, in this case Wildfly 9. Idea, however, lets me choose the library jars, download Jersey, or configure it later. How do I use Resteasy implementation provided with WildFly?

Thank you!
 
L Foster
Ranch Hand
Posts: 242
14
Android Angular Framework AngularJS Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, @Farhod, and welcome to the Ranch.

I am trying a "create project" wizard right now, on my profession licensed copy of IntelliJ IDE v 14.x. As I create the project, I see Project SDK, Java EE Version, and I see the Application Server dropdown. There I can pick JBoss (I do not happen to have Wildfly, but the JBoss is found. I would try assuming JBoss, then browsing to a Wildfly installation).

In the checkboxes on that "Additional Libraries and Frameworks", I see one for RESTful Web Services 2.2. Next I see that with that RESTFul option's text selected (not just checking that box), I see some library options appearing below. I have not specifically used that install to create RESTful web services, so I do not have any libraries from which to select. There is a Download radio button (also setup library later, and you can create a library). I also see an advisory message claiming that Jersey-2.2 jars will be downloaded to create that library.

Perhaps that answers the question. I have no experience with the student license, so I am just assuming it works the same way as the professional. I just tried the Community version which I use at home, and did not get these options. I have seen RESTful work just fine in IntelliJ. IMHO, IntelliJ IDEA is very good for Java EE.

My disclaimer: if anyone has done this recently, and knows more, please pipe up. I very seldom have occasion to produce a new Java EE application, and often when I do it is on Community, where I just download what I need separately.
 
Farhod Miralimov
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
L Foster wrote:Hi, @Farhod, and welcome to the Ranch.

I am trying a "create project" wizard right now, on my profession licensed copy of IntelliJ IDE v 14.x. As I create the project, I see Project SDK, Java EE Version, and I see the Application Server dropdown. There I can pick JBoss (I do not happen to have Wildfly, but the JBoss is found. I would try assuming JBoss, then browsing to a Wildfly installation).

that part I figured out. You can actually choose jBoss server and point it to wildfly, and it just identifies it as Jboss 9, and it works as it should.
L Foster wrote:
In the checkboxes on that "Additional Libraries and Frameworks", I see one for RESTful Web Services 2.2. Next I see that with that RESTFul option's text selected (not just checking that box), I see some library options appearing below. I have not specifically used that install to create RESTful web services, so I do not have any libraries from which to select. There is a Download radio button (also setup library later, and you can create a library). I also see an advisory message claiming that Jersey-2.2 jars will be downloaded to create that library.

This is the problem. I don't want to provide a dependency for something that is already, as I understand, included with the server. When the teacher creates "dynamic web project" with jax-rs, eclipse asks about the implementation, and he chooses "library provided with target runtime", and it works. He says that wildfly server includes resteasy.

L Foster wrote:
Perhaps that answers the question. I have no experience with the student license, so I am just assuming it works the same way as the professional. I just tried the Community version which I use at home, and did not get these options. I have seen RESTful work just fine in IntelliJ. IMHO, IntelliJ IDEA is very good for javaEE


Student licence is not limited version of some sort. It's just a licence for full ultimate edition that jetbrains provide if you have university email and they provide it for a year.

And I just love intellij!

The problem is, all tutorials on the web that I have found (including paid ones like lynda) teach you how to do it in eclipse. I have found tutorials for intellij too, but they all use maven, and it's whole another world to learn.
 
L Foster
Ranch Hand
Posts: 242
14
Android Angular Framework AngularJS Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Farhod,
I think, now, I am beginning to understand where you are coming from. However, making the dependency is not so bad. You are providing, under IntelliJ, an environment like that on the server (like on Wildfly), so that everything will compile, and you can run whatever unit tests are doable. For that, you will need to have all the annotations found under RESTeasy. When your teacher says "it just has that" (or words to that effect), they mean that you won't have to put those jar files, or their contents, into whatever it is that you deploy to Wildfly. Because, Wildfly will have copies of all that already in the designated library folders.

I have not worked closely with Eclipse for some time, although it is the environment of choice for textbooks--I found that out while studying Android some time back. Maybe Eclipse is integrating closely with the server, so this issue does not come up.

However, at the end of the day, you have to just have all the classes upon which your WAR file depends (meaning upon which your RESTful services depends) on the server when you try and contact the services. I would take your instructor's comments to mean:
1. Don't bother including any RESTeasy jar/class into your war file before deploying it.
2. Make sure that when you setup the dependencies (when building your project with the wizard) that it uses the same version of RESTeasy as Wildfly 9. Before using IntelliJ's suggested 2.2, first ensure Wildfly 9 uses 2.2.

If you are using Ant, your build.xml can be coded so it does not include RESTeasy. It may be a little more work, but you will also know more about what is going on, rather than treating it as some black box.
 
Farhod Miralimov
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@L Foster,
I just found out that when I create any JavaEE project using WildFly, IDEA automatically adds "WildFly application server library" to the "Dependencies" tab and marks it as "Provided" in the "Scope" column. As I understand, it's exactly what I'm looking for. Now the problem is, when I click "edit" to view the contents of the library, it includes only three jars: ejb-api, servlet-api and jsp-api. It doesn't include the JAX-RS api for instance. Because of that, when I try to use, for example, annotations like @Path or @GET, IDEA doesn't recognize them. Now I tried to add the jars from the WildFly folder manually, and it actually worked, but it doesn't seem right. Why IntelliJ decided to add these three jars and not the others? I mean, later, after testing the rest thing, I tried to add a new module with support of EJB, JMS, CDI and JPA, and just got lost in the jars! I have no Idea which ones I need to add to the library so that Intellij recognizes it.

And if I understand you correctly, I need to worry about dependencies only for IDEA to be familiar with them, so it can compile them. But when deploying, I don't need to include the dependencies with the .war, because they are already included with the server.

thank you for your help!
 
L Foster
Ranch Hand
Posts: 242
14
Android Angular Framework AngularJS Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I think this will be my final input, but hopefully we can get this laid to rest. JBoss tends to have "client jars" bundled with it.

Here's the find.


The two you see first below are about calling EJBs and supporting jboss-cli.bat, and jboss-cli.sh

./bin/client/jboss-cli-client.jar
./bin/client/jboss-client.jar


These, on the other hand, are the famous "jar hell". Note the "resteasy-client" one. That may be what you need for RESTeasy. BTW, this was found in a copy of Wildfly 8, which I know is not the latest. But a similar find should get you this. All these paths are relative to the root directory for the Wildfly installation.

./modules/system/layers/base/org/apache/httpcomponents/main/httpclient-4.2.1.jar
./modules/system/layers/base/org/hornetq/main/hornetq-core-client-2.4.5.Final.jar
./modules/system/layers/base/org/hornetq/main/hornetq-jms-client-2.4.5.Final.jar
./modules/system/layers/base/org/infinispan/client/hotrod/main/infinispan-client-hotrod-6.0.2.Final.jar
./modules/system/layers/base/org/jboss/as/appclient/main/wildfly-appclient-8.2.1.Final.jar
./modules/system/layers/base/org/jboss/as/controller-client/main/wildfly-controller-client-8.2.1.Final.jar
./modules/system/layers/base/org/jboss/as/management-client-content/main/wildfly-management-client-content-8.2.1.Final.jar
./modules/system/layers/base/org/jboss/ejb-client/main/jboss-ejb-client-2.0.1.Final.jar
./modules/system/layers/base/org/jboss/iiop-client/main/jboss-iiop-client-1.0.0.Final.jar
./modules/system/layers/base/org/jboss/metadata/main/jboss-metadata-appclient-8.0.0.Final.jar
./modules/system/layers/base/org/jboss/resteasy/resteasy-jaxrs/main/resteasy-client-3.0.10.Final.jar
./modules/system/layers/base/org/jboss/ws/jaxws-client/main/jbossws-cxf-client-4.3.2.Final.jar
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!