1

Do you know how to deploy correctly a java EE application in IntelliJ IDEA? I don't like using NetBeans on Mac Os X. It has poor performance on my system. I have got some issues in running and deploying correctly an application on that.

For instance I have these simple classes.

Could you explain me how to configure step-by-step the aforementioned IDE in order to execute correctly the client application? I already have Glassfish in my machine.

EDIT

well go step-by-step. When I open IntelliJ IDEA, this is what I see:

enter image description here

As you may see, I have installed properly GlassFish. I choose EJB (since I use it in my application) and CDI. is it right?


package myejb;

import javax.ejb.Remote;

@Remote
public interface Hello
{
    public String sayHello(String name);
}

package myejb;

import javax.ejb.Remote;
import javax.ejb.Stateless;


@Stateless(name = "HelloEJB")
@Remote({Hello.class})
public class HelloBean implements Hello
{
    public HelloBean()
    {

    }

    @Override
    public String sayHello(String name)
    {
        return "Hello, " + name + "!";
    }
}

and the Client application

package myejbclient;

import javax.ejb.EJB;
import myejb.Hello;

public class HelloClient
{
    @EJB(lookup = "HelloEJB")
    private static Hello hello;

    public HelloClient()
    {

    }

    public static void main(String[] args)
    {
        HelloClient client = new HelloClient();
        client.doConversation();
    }

    public void doConversation()
    {
        System.out.println(hello.sayHello("World"));
    }
}
4
  • Do you have Community or Ultimate version of IntelliJ Idea? Apr 10, 2014 at 13:30
  • yes I know that in java ee environment, servlet is typically used to run but it is just an example nothing more to show that everything is configured properly. I should be able to run client application and see in terminal Hello World when glassfish server is running but I got a java NullPointerException. I'm pretty sure that the entire application is not deployed correctly. Please help me to fix it...
    – Mazzy
    Apr 10, 2014 at 14:31
  • What I don't understand is why no one could help me...it is two days I'm asking and no one is able to fix this problem. I ask you a simple question. If you had this code, how would you execute it on Intellij Idea ?
    – Mazzy
    Apr 10, 2014 at 15:40
  • I have read the following guide wiki.jetbrains.net/intellij/…. Now I have understood more thing than before. I followed it closely considering my web application no the servlet but the helloClient application. I have exploded the artfact and still not work. WHYYYYYYY?
    – Mazzy
    Apr 10, 2014 at 18:55

1 Answer 1

-1

Go to Settings and choose Application Servers. Add Glassfish server configuration there. Make sure you have Glassfish Integration plugin installed.

Then go to Run -> Edit Configurations... and add run configuration for Glassfish Server.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.