Monday Nov 01, 2010

TOTD #149: How to clean IntelliJ cache, preferences, etc on Mac OS X ?

I've installed, un-installed, re-installed, re-un-installed, re-re-installed and so on IntelliJ IDEA multiple times on my MacBook. However the uninstall leaves a few remnants in different directories all over the system. These directories need to be manually removed in order for a clean install next time. This TOTD (Tip Of The Day) provide the list of directories which need to be removed explicitly:

~/Library/Caches/IntelliJIdea90
~/Library/Logs/IntelliJIdea90
~/Library/Preferences/IntelliJIdea90
~//Library/Application Support/IntelliJIdea90

And IntelliJ IDEA is installed in the directory "/Application/IntelliJIdea90" which gets deleted if the application is deleted. And you'll need to get rid of this directory if the mystical plugin configuration is not configured right the first time.

Also read IDEA-43039 for more details on invalidating caches. Read more on stackoverflow.com on how to clear out global settings.

That's it, just a short one this time!

Is there a better way to deal with this mess ?

Technorati: totd intellij idea cache osxtips

Friday Oct 15, 2010

Java EE 6 & GlassFish @ Silicon Valley Code Camp 2010 Trip Report - Slides Now Available

What's common between 350 Mountain Mike's Pizza, 920 Erik's Deli Sandwiches, 29 huge jugs of Peet's Coffee, and 194 geek sessions ?

It takes 1876 developers, hackers, architects, technology honchos etc to consume all of them over a weekend :-)

Yes, we are talking about Silicon Valley Code Camp 5.0!

This is a for the developer community, by the developer community, and to the developer community event focused on Agile, Cloud, HTML5, Google Developer Tools & Platforms, Java, Web services, and many other topics. The code camp website shows attendance records from the previous years as:

A slightly updated view of this data is:

As you can see, there is steady year/year growth in the number of sessions, registration, and attendance. This year specifically has seen about 60% growth on registrations and 80% on the actual attendance. The ratio between registered/attended was also steady for the first few years and has also gone higher this year. This event has truly grown organically over the past years and is the second biggest conference, with Java focus, in the USA after JavaOne! Oracle certainly was a platinum sponsor of this conference. Are there any other bigger conferences that I don't know of ? ;-)

It would be interesting to revisit this pattern if the event starts charging a nominal (may be optional) fees from all the attendees. However the main website highlights three points:

  • by/for the developer community
  • always free
  • never occur during work hours

GlassFish team presented several sessions at the Code Camp:

  1. Java EE 6: Doing More with Less
  2. Java EE 6 Tooling
  3. Introduction to JAX-RS
  4. Servlets 3.0: Asynchronous, Extensible, Easy-to-use
  5. OSGi and Java EE in GlassFish
  6. Running your Java EE 6 applications in the Cloud

I could not deliver #5 due to a conflict but slides from all the sessions are now available:

Here are some key pointers for you:

Check out the complete list of sessions by Oracle at the Code Camp. Please enter session evaluations at http://siliconvalley-codecamp.com/SessionsOverview.aspx (make sure you are logged in and then click the link at the end of the session you attended that says 'Evaluate').

The Android App was pretty useful, did not try the iPhone App. I wonder if there was a session on "How I created the Android/iPhone App" :-)

Personally, this was my fourth code camp (2009, 2008, 2007) and I enjoyed meeting the local geek community. I could barely spend Saturday morning at the code camp and delivered two of my sessions but its always fun to meet the usual suspects. Many thanks to Peter Kellner, Van Riper, Tammy Baker, Kevin Nilson, other organizers, and many other volunteers for running a great show!

Couple of suggestions for next year ...

  • Expose the RESTful API for the code camp registration/session/speaker/etc data and organize a competition on the best created app. May be a panel with different attendees who attempted to build this application ?
  • Make sure the speakers are not running across the campus between their back-to-back talks. 

Check out some of the pictures:


And the complete photo album:

Looking forward to Silicon Valley Code Camp 6.0 next year!

Technorati: conf svcc javaee6 glassfish netbeans eclipse intellij cloud osgi servlets restful

Wednesday Apr 07, 2010

Java EE 6, GlassFish, NetBeans, Eclipse, OSGi at Über Conf: Jun 14-17, Denver

Über Conf is a conference by No Fluff Just Stuff gang and plans to blow the minds of attendees with over 100 in-depth sessions (90 minutes each) from over 40 world class speakers on the Java platform and pragmatic Agile practices targeted at developers, architects, and technical managers.

Get your hands dirty and learn from the industry leaders in an intimate setting where the attendance is capped at 500 and in the beautiful city of Denver.

I'll be speaking on:

  • Java EE 6 & GlassFish v3: Paving the path for the future
  • Getting the best of both worlds: OSGi & Java together

The talks will start with an introduction of key concepts and then provide a detailed overview of the technology. The talks will be interspersed with multiple demos to leave you feel empowered. There will be NetBeans and Eclipse (hopefully IDEA too) showing the simplicity, ease-of-use, and increased productivity with Java EE 6. There will be multiple demos showing OSGi application development and how OSGi + Java EE leverage the best of both worlds.

Keeping with the spirit of "No Fluff Just Stuff", the material presented will be purely technical :-)

Hear Jay Zimmerman (Über Conf Director) talk about the event. My first engagement with NFJS was Rich Web Experience 2007 and that was a great experience, truly "rich". This is my first speaking engagement with NFJS and looking forward to a long term relationship :-)

On a personal front, I never ran in Denver so looking forward to some nice runs in the mile high city! Any recommendations ?

Technorati: conf nofluffjuststuff uberconf denver glassfish javaee netbeans eclipse intellij osgi

Friday Jul 18, 2008

GlassFish @ Utah JUG Summer 2008 - Trip Report

I presented on GlassFish at Utah JUG yesterday, slides are available. The topic provided insight into GlassFish v2, the current production version, and GlassFish v3 - the upcoming modular, embeddable & extensible version. The slides have data on leading adoption indicators on how GlassFish momentum. There were close to 100 attendees and the list of sponsors is certainly impressive ;-)

Here are the list of demos:
There are very few developer meets where I've not met a Hudson (Extensible continuous integration engine) user. I had good conversation with some folks about some of the missing pieces around Hudson and will follow up with Kohsuke on that. I also got to meet Manfried Riem - the local Java Champion. And it was great to know that Allen Day (one of the UJUG board members) is already a GlassFish evangelist - see the first picture with GlassFish sticker on his laptop ;)



As mentioned, the new functionality in GlassFish v3 is undergoing review. Please send us feedback on dev@glassfish and more details here.

After all day back-to-back meetings, it was good unwinding at a concert in the Salt Lake City Downtown park - thanks to Harold (actually his wife who pointed us to the concert :) Andrew Bird was performing there and enjoy a short clip of his performance:


It's always good to meet colleagues and old friends!

Technorati: conf ujug glassfish netbeans eclipse intellij hudson saltlakecity utah jug

Wednesday Jul 09, 2008

Getting Started with GlassFish in IntelliJ IDEA


IntelliJ IDEA 7.0.x include plugins that provide support for configuring GlassFish. This blog provides clear instructions on how to get started by developing and deploying a JSP, Servlet and Web services using GlassFish in IntelliJ. The instructions are using IntelliJ 7.0.3 Build #7757 (with no additional plugins).
  1. Create a new project
    1. Clicking on "Create New Project" or "File", "New Project". Take the default as shown below:



      and click on "Next >".
    2. Enter the project name as "GlassFishRocks" and take all defaults as shown:



      and click on "Next >".
    3. Take another default for the source directory as shown:



      and click on "Next >".
    4. For the first time use, JDK needs to be specified. Click on "+" in top-left corner as shown here:



      Take the default option of "JSDK" and specify the Home Directory as shown:



      Click on "OK" and then click on "Next >".
    5. Let's create a Web application. Select the list of technologies as shown:



      and finally (phew!) click on "Finish". The expanded project looks like:

  2. Create a GlassFish configuration
    1. Select "Run", "Edit Configurations" as shown:


    2. Click on "+" on top-left corner and select GlassFish as shown below:


    3. Specify the location of GlassFish Application server at:



      by clicking on "Configure" button and enter the values as shown:



      and click on "OK". You can download and install GlassFish v2 UR2 from here.
    4. Enter the "Name" and select the "Server Domain" as shown:



      and click on "OK".
  3. Deploy the Web application
    1. Click on the green button in the toolbar:


    2. Click on the "Fix" button on the bottom and then click "Run". The recently created Web module is selected to be deployed as shown:

    3. This starts the GlassFish v2 UR2 Application Server and deploys the Web application showing the console as:



      and also shows the default page at "http://localhost:8080/GlassFishRocksWeb/". You can edit "index.jsp", re-deploy the Web facet and refresh the page to see the updated message.

      Notice, even though project's name is "GlassFishRocks", the application context root is "GlassFishRocksWeb".
  4. Now lets create/deploy a new Servlet.
    1. Create a new project as described above and name it "KillerServlet".
    2. Right-click on the project and select "New", "Servlet" as shown:

    3. Enter the values as shown:



      and click on "OK".
    4. The "Java EE: Structure" shows the project as:


    5. Double-click on "HelloServlet" (nested one) and add the following fragment to "doGet" method:

              java.io.PrintWriter out = response.getWriter();
              try {
                  out.println("<html>");
                  out.println("<head>");
                  out.println("<title>Servlet NewServlet</title>");
                  out.println("</head>");
                  out.println("<body>");
                  out.println("<h1>Servlet NewServlet at " + request.getContextPath () + "</h1>");
                  out.println("</body>");
                  out.println("</html>");
              } finally {
                  out.close();
              }

      NetBeans IDE auto-generates this code for a Servlet ;-) And add the following to "doPost" method:

             doGet(request, response);
    6. Double-click on "web.xml" and then select "Assembly Descriptor" tab.
    7. Click on "+" in Servlet Mappings and specify the values as:


    8. Deploy the project (as described above) and output from Servlet is displayed at "http://localhost:8080/KillerServletWeb/hello". Read more details in Creating Java EE Apps and Servlets with IntelliJ IDEA.

      Remember the weird context root, it's "KillerServletWeb" instead of "KillerServlet". Now there may be a good reason to do so but nothing obvious.
  5. Now lets create a simple Web service using the Metro Web services stack (the stack baked into GlassFish)
    1. Create a new project with name "GlassFishWS" following the instructions given above.
    2. Select the list of technologies as shown:

    3. The default generated Web service looks like:

    4. The default generated Web service uses light-weight Endpoint API to host the endpoint. Run the Web service by right-clicking in the editor pane and selecting "Run" as shown or default shortcut of Ctrl+Shift+F10:

    5. The WSDL is now available at "http://localhost:9000/HelloWorld?wsdl".
    6. Right-click on the project and select "New", "Web Service Client" as shown:



      enter the value as "WSClient" and click on "OK".
    7. In the next dialog, enter the values as shown:

    8. The generated client code has some errors as shown:



      Change the code to:

            client.HelloWorld service = new client.HelloWorldService().getHelloWorldPort();
            //invoke business method
            System.out.println(service.sayHelloWorldFrom("Duke"));

      and run WSClient.main to see the result as:



      Now you deployed a Metro Web service using light-weight Endpoint API.  The bundled plugin version is 0.9 build 2 and the steps are so much cleaner from 0.7 version of the plugin.

      Read more about Web Services support in IntelliJ IDEA.
    9. Deploying this Web service on GlassFish is really simple.
      1. Create a new GlassFish configuration as explained above.
      2. Run the project using this configuration and the Web service is now hosted at "http://localhost:8080/GlassFishWSWeb/services/HelloWorld?wsdl".
      3. Generate a client using the steps described above.
Here are few issues filed:
  • JEEAS-180 does not allow an application to be re-deployed to GlassFish and that's why the examples above use different projects.
  • JEEAS-181  asks for better integration of GlassFish logs in the IDE.
  • JEEAS-182 require support for GlassFish v3 in the GlassFish plugin. Please help by voting for this issue.
  • WSVC-61 reports the errors generated in Web services client code
So whether you are using Eclipse, IntelliJ or NetBeans - you can easily configure GlassFish and deploy your applications directly from within the IDE. Here are some related links:
However of all the IDEs, NetBeans IDE still provides the most comprehensive coverage in terms of development and deployment of Java EE applications (JSP, Servles, Java Server Faces, SOAP-based .NET 3.0-interoperable Web service, RESTful Web services, JPA, EJBs) and server plug-ins (GlassFish, Tomcat, JBoss, WebLogic, WebSphere, OC4J, SAP BusinessOne and JOnAS).


Technorati: glassfish intellij idea jsp servlets metro webservices

Tuesday May 01, 2007

GlassFish support in IntelliJ

Interested in first-class support for GlassFish in IntelliJ IDEA ?

Vote here.

Since this is still a wish for IntelliJ developers, consider using NetBeans IDE that provide comprehensive support for GlassFish. Developing/deploying a Web service on GlassFish using IntelliJ (and here) was certainly non-intuitive. I tried it few weeks ago and the plug-in might have improved since then.

Technorati: IntelliJ GlassFish NetBeans webservices

Saturday Feb 10, 2007

GlassFish v2 supported in IntelliJ Web Services Plugin

As a follow up from a previous blog, the Web Services plugin in IntelliJIDEA now supports GlassFish v2. Here are the steps I followed to deploy the Web service on GlassFish:

  1. I updated the plugin version from "0.6 build 2" to "0.7 build 1" as shown here.
  2. Using Project Settings (default shortcut Ctrl+Alt+S), configure GlassFish in the Web Services plugin as shown here.
  3. Following steps 1, 2, and 3 from the previous blog, I created a POJO and enabled Web service support as shown here. There is no need to add any GlassFish specific deployment descriptor. However make sure web.xml is using version 2.5 as shown here.
  4. Following Steps 4, 5, and 6 from the previous blog, I added the @javax.jws.WebService annotation and exposed the class as Web service as shown here. The menu item changed from "Expose Class as Web Service" to "Deploy Class as Web Service". I find this confusing since at this stage the service endpoint is not getting deployed. Instead, under the covers required artifacts are generated. There is an explicit deploy step later and it's confusing to mix that here. I think it should be renamed back to "Expose Class as Web Service".
  5. To configure and run the GlassFish instance and deploy the newly created module, follow the instructions as shown in Step 7 here.
  6. Once the GlassFish server has started, the endpoint is hosted at http://localhost:8080/hello/services/Hello.

Now, we need to invoke the Web service using the following steps:

  1. Add a new "Java Module" to the project by selecting "File", "New Module".
  2. Select the newly created module in the "Project" window. In "Tools" menu, select "WebServices", "Generate Java Code From Wsdl" as shown here. This generates the client-side artifacts and can be seen by expanding "src" node in "helloclient" module.
  3. Add a new class "HelloClient" in the "client" subnode of "src" as shown below:

    public class HelloClient {
      public static void main(String[] args) {
        System.out.println(new HelloService().getHelloPort().sayHello("Duke";));
      }
    }
  4. Build the module by selecting "helloclient" node, right-click, selecting "Make module "helloclient"".
  5. Add add activation.jar as a module library as shown here.
  6. Right-click HelloClient, select "Run "HelloClient.main()"" (default shortcut Ctrl+Shift+F10).
  7. The output window shows the result as shown here.

Thanks to AdvancedTools for adding GlassFish v2 support to the Web Services plugin.

Technorati: NetBeans IntelliJ Eclipse GlassFish Web service WSIT

Monday Feb 05, 2007

Creating and Invoking a Web service using GlassFish in NetBeans, IntelliJ, and Eclipse - Part 3

In this third and last part of a blog series (part 1 and part 2), I plan to explore the steps to develop/deploy/invoke a Web service on GlassFish using Eclipse IDE.

Eclipse does not offer GlassFish as a a bundled container. Instead you need to install GlassFish plugin for Eclipse explicitly. The plugin requires WTP 1.0 installed in Eclipse so I did that following the instructions. After installing WTP, I configured GlassFish v2 M4 following rest of the plugin install instructions.

Here are the steps I followed to successfully build and deploy a Web service:

  1. Create a new "Dynamic Web Project" with name "hello" as shown here. Note the target runtime is "GlassFish V2 Java EE 5". Click Next.
  2. Uncheck "Sun DD Files" in "Project Facets" window as shown here. Click "Next" and "Finish" buttons.
  3. In "Projects" pane, expand the "WebContent", "WEB-INF", and open "web.xml" as shown here.
  4. GlassFish has a Deployment Descriptor Web service deployment but Eclipse seems to require "web.xml" for a WAR. So replace the contents of "web.xml" with a simplistic fragment shown below:

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/javaee"
           xmlns:j2ee="http://java.sun.com/xml/ns/javaee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5"
           xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                           http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    </web-app>
  5. In "Projects" pane, right click on "Java Resources" and create a new package as shown here.
  6. Right-click on the newly created package and add a new class "Hello" as shown here.
  7. Add the @javax.jws.WebService annotation and a method as shown below:
    @javax.jws.WebService
    public class Hello {
      public String sayHello(String name) {
        return "Hello " + name;
      }
    }
  8. Select "Project" menu, "Build All" (default shortcut Ctrl+B).
  9. In "Projects" pane, right-click on the project, select "Run As", "Run on Server". Take the defaults (GlassFish V2 Java EE 5) as shown here. Click "Next" and "Finish" buttons.
  10. The endpoint gets deployed as shown here. This can be verified by clicking on the "Servers" tab, and expanding GlassFish node as shown here. The endpoint is hosted at http://localhost:8080/hello/HelloService?wsdl.

So far we have been able to deploy JAX-WS based Web service on GlassFish. Eclipse allows generating a Web service client using Axis run-time environment only. So as with IntelliJ, if you want to invoke a Web service using JAX-WS, the recommended way is to use NetBeans 5.5.1 to invoke the Web service.

Enjoy Web services deployed on GlassFish in Eclipse! And remember, GlassFish v2 uses Web Services Interoperability Technology (WSIT) that gives you interoperable Web services with Microsoft .NET 3.0 framework.

So if you want first-class Web services support in an industry-grade, cross-platform IDE and deploy it on an open source, production-quality, Java EE5-compatible Application Server, NetBeans IDE is the only choice.

Technorati: NetBeans IntelliJ Eclipse GlassFish Web services WSIT

Thursday Feb 01, 2007

Web services in IntelliJIDEA using the Web Services plugin

As I mentioned in my previous post, here are the steps to develop/deploy/invoke a Web service using the Web Services plugin in IntelliJ IDEA. Thanks to AdvancedTools, author of the plugin, for helping me through this process.

The Web service plugin bundles Axis 1.4 and supports JWSDP 2.0 ( contains JAX-WS 2.0 EA1 which is now final in Java 6), Axis 2, and XFire through pluggability. If you are interested in deploying on GlassFish using IDEA, then read this. The author has agreed to add support for GlassFish v2 though.

The first step is to install the plugin. Select "File", "Settings ...", "Plugins", "Available" tab, scroll to the bottom and select "WebServicesPlugin" as shown here. I clicked "Ok" after selecting the plugin and the dialog box disappeared without installing it. The arrow on the top-left corner has a tooltip of "Update Plugin" but did not convey the message. When I right-clicked on the plugin, I got "Download and Install" which made complete sense. And then I realized the arrow on top-left serves the same purpose as well. So I installed the plugin and restarted the IDE for plugin to take effect. I had to manually restart the IDE even though the plugin said that the IDE will restart automatically.

Once the plugin is successfully installed, at least following changes are noticed in the IDE:

  1. A "WebServices" tab is displayed in the bottom left corner of the IDE
  2. A new "Tools", "Web Services" menu is added
  3. A new "Window", "Tool Windows", "WebServices" menu item is added.
  4. A new "WebServices" icon is added to "Project Settings" (Ctrl+Alt+S default shortcut).

Of the supported toolkits, the closest to GlassFish is JWSDP and so I downloaded and installed JWSDP 2.0.

After JWSDP 2.0 installation, I configured the Web services plugin for JWSDP 2.0 location by selecting "File", "Settings", "WebServices" as shown here. Now, on to real business of creating a Web service. Here are the steps I used:

  1. Create a new Web module (wonder why 12 clicks are required for a default project).
  2. Add a new POJO as:
    package hello;

    public class Hello {
      public String sayHello(String name) {
        return "Hello " + name;
      }
    }

    It is required to have a non-default package ("hello" in this case).
  3. Select "Tools", "WebServices", "Enable Web Service Support" as shown here.
  4. Add @javax.jws.WebService annotation and so the class looks like
    package hello;

    @WebService
    public class Hello {
      public String sayHello(String name) {
        return "Hello " + name;
      }
    }
  5. Compile the class (default shortcut Ctrl+Shift+F9).
  6. Select "Tools", "WebServices", "Expose Class as Web Service" as shown here. The menu says "expose" and the window says "deploy" which I find confusing.
  7. It is recommended to "File", "Synchronize" before this step so that IntelliJ recognizes any newly generated files.
  8. Add a local Tomcat configuration using "Run", "Edit Configurations" (see GlassFish configuration instructions for more details). I used Tomcat 5.5.20.
  9. This runs the Tomcat server and displays "http://localhost:8080" and tries to display the resource "/" and shows 404. Instead type "http://localhost:8080/services/Hello" in the browser and the deployed Web service is shown correctly.

So far we have been able to deploy a JAX-WS based Web service and now we will invoke it.

  1. Create a new Web module (with all default settings). In "Deployment Descriptors" tab, uncheck "Include standard JavaEE runtime support". A warning message is displayed when you click on Next, select "Ok" and move on.
  2. Select "Tools", "WebServices", "Generate Java Code From Wsdl". Specify the package name as shown here. This generates the client-side artifacts. After clicking on "Ok" button, the dialog box just disappears without any information. But then I realized wsimport progress bar came and disappeared. Synchronize (default shortcut Ctrl+Alt+Y) the IDEand and then the artifacts are all generated in the client directory. A message box indicating what happened would be helpful.
  3. Expand "src", "client" and add a new class "HelloClient" to invoke the endpoint as shown below:

    public class HelloClient {
      public static void main(String[] args) {
        System.out.println(new HelloService().getHelloPort().sayHello("Duke"));
      }
    }
  4. Build the project (default shortcut Ctrl+F9).
  5. Select HelloClient, right-click and select "Run "HelloClient.main()"" (default short cut Ctrl+Shift+F10) as shown here.
  6. And finally you view the result as shown here.

As you can see by the traffic on the forum, this was all not intuitive :) The plugin author has promised to make the plugin more easy to use by providing wizards. But I'd expect Web service creation to be a first-class functionality in an IDE and so I recommend to vote for IDEA-13000. Look on the left bar for casting your vote.

Alternatively, you can use NetBeans 5.5.1 and GlassFish that gives you native and first class support for building/deploying/invoking interoperable Web services.

Technorati: NetBeans IntelliJ Eclipse GlassFish Web services WSIT

Wednesday Jan 31, 2007

Creating and Invoking a Web service using GlassFish in NetBeans, IntelliJ, and Eclipse - Part 2

In this second part of a blog series (part 1), I plan to explore the steps to develop/deploy/invoke a Web service on GlassFish using IntelliJIDEA IDE.

Searching in the help bundled with the IDE on "web service from Java" returned no results relevant to Web service. I found several (1,2,3) people asking "How do I develop Web service in IntelliJ 6.x?" but all the questions are unanswered. The online documentation does not seem to talk anything about Web service. Searching on intellij.org gave no results. Finally I found some lead after searching in the forums but there is no help on "Enable Web Service Support" as mentioned in the post. Another response in the forum requires you to add @javax.jws.WebService manually, pretty primitive. So I decided to ask the question (1, 2) in the forum. 

After discussion in the forum I found that IntelliJ does not support creation of Web services natively but instead support it through a Web service plugin. The plugin, at the time of this writing is "0.6 build 2" with few skeptical comments but anyway worth a try. This plugin supports JWSDP 2.0 so first I'll investigate how Web services can be deployed on GlassFish and then come back to this plugin.

Here are the steps I followed to successfully build and deploy a Web service:

  1. Create a Web module (requires 12 clicks for default settings), say with name "hello". On Deployment Descriptors tab, select the default "Web Module Deployment Descriptor" and delete it as shown here. This is not required for deploying a Web service in GlassFish v2. Take all other defaults.
  2. In the "Project" pane, click on "src", add a new package "hello" as shown here.
  3. Select the package "hello", add a new class "Hello" as shown here.
  4. Click on the Project, right-click and select "Module Settings". Select the module and remove "j2ee.jar" as shown here. Add a new module library, javaee.jar, from GlassFish lib directory as shown here.
  5. Add @javax.jws.WebService annotation to the class and add a method as shown:

    @WebService
    public class Hello {
      public String sayHello(String name) {
        return "Hello " + name;
      }
    }
  6. Select "Build", "Make Project" (default shortcut Ctrl+F9).
  7. Configure and Run GlassFish v2 in IntelliJ. I added GlassFish v2 M4 using the following steps.
    1. Select "Run", "Edit Configurations ..." menu.
    2. Click on "+" in top-left corner to add a new configuration and then select "GlassFish Server" and "Local" as shown here.
    3. Specify the location of GlassFish by clicking on "Configure" button.
    4. Select the domain (default value "domain1";) in "GlassFish Server Settings".
    5. Add a new server by clicking on "+" in top-left corner and give the location where GlassFish is installed as shown here. Ignore the "There are no modules to deploy" warning as this will be fixed during Run. Now GlassFish is configured.
    6. To run the GlassFish instance
      1. Select "Run", "Run" (default shortcut Shift+F10) menu item. 
      2. Run configuration window displays the warning message "There are no modules to deploy". Go to "Deployment" tab and selecting the newly created module to deploy as shown here .
      3. Check "Deploy Web Module" check box and click "Configure" button and select "Create web module war file". A warning is displayed "Warning: 'Glassfish Web Module Deployment Descriptor' is not defined" as shown here. This message can be ignored as no GlassFish specific deployment descriptors are required.
      4. Click "Run" button.
  8. Once the GlassFish server has started, the endpoint is hosted at http://localhost:8080/hello/HelloService?wsdl.

The key point to note here is that no Deployment Descriptors (either standard or application serve specific) are required in the WAR file. The deployed WAR file in GlassFish consists only of the compiled class. 

The only way IDEA support creation of Web service clients is through Web Services plugin so I'll explore it in another blog. So the recommended way is to use NetBeans 5.5.1 to invoke the Web service.

Enjoy Web services deployed on GlassFish in IntelliJIDEA! And remember, GlassFish v2 uses Web Services Interoperability Technology (WSIT) that gives you interoperable Web services with Microsoft .NET 3.0 framework.

Technorati: NetBeans IntelliJ Eclipse GlassFish Web service WSIT

About

profile image
Arun Gupta is a technology enthusiast, a passionate runner, author, and a community guy who works for Oracle Corp.


Java EE 7 Samples

Stay Connected

Search

Archives
« July 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  
       
Today