Thursday Feb 24, 2011

TOTD #156: JDK 7 Developer Preview Now Available!

JDK 7 developer preview build is now available.
java -version
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b130)
Java HotSpot(TM) Client VM (build 21.0-b02, mixed mode, sharing)

This is milestone 12 (all milestones), build #130 and has 456 bugs fixed since feature complete about a month ago. Download it today and try your applications and provide us feedback via forums and/or file a bug/rfe.

For sanity, I could easily download/install it on Windows 7, run NetBeans 7.0 Beta 2 and GlassFish 3.1 b41, create a simple Java EE 6 Web application and run it on GlassFish. And also encountered bug 195254 which is totally unrelated to JDK7 though ;-)

And if you are interested, screencast #35 showed how to use Project Coin features in NetBeans 7. The video is available below again for your reference:

Today NetBeans has the most comprehensive support for JDK 7 but its also coming in IntelliJ 10.5 and Eclipse.

JDK 7 will be released on the supported set of platforms (Windows, Solaris SPARC, Solaris x86, and Linux) first and then will be released on OSX later. You can also find some more details on community-led JDK 7 builds on Mac OSX.

Technorati: totd jdk7 javase

Wednesday Apr 30, 2008

OSX #8: Java SE 6 U5 on Mac OS X Leopard


Yesterday, Apple released Java SE version 1.6.0_05 for 64-bit Intel-based Mac OS X 10.5.2 or later. Download it here!

It's restricted to 64-bit machines and Charles is unhappy about it. Hopefully, they'll release a 32-bit version as well.

Type "sw_vers" in a terminal to check the Mac OS X version as shown below:
~ >sw_vers
ProductName:    Mac OS X
ProductVersion: 10.5.2
BuildVersion:   9C31
Alternatively, "About This Mac" in the Apple menu shows you the version as well as shown below:



Anyway, after verifying the system requirements, download 57MB bundle and install it following the standard instructions.


And now successfully installed:



It gets installed in "/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0" and shows the version number as:

/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin >./java -version
java version "1.6.0_05"
Java(TM) SE Runtime Environment (build 1.6.0_05-b13-120)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_05-b13-52, mixed mode)

The default Java version can be changed by using "Java Preferences" as shown below:
/Applications/Utilities/Java Preferences.app/Contents/MacOS >./"Java Preferences"
The following window shows up:



Pick the version of your choice and that should get you going!

These are the days before JavaOne and all my demos on this machine have been tested using the default J2SE 5. But I'll play with the new release after JavaOne anyway :)

Do you know sign up for GlassFish Day is FREE and gives you access to JavaOne pavilion as well ? Do it now!

A complete archive of all Mac OS X tips on this blog are available here.

Technorati: osxtips mac leopard javase6 javase jdk

Thursday Jan 24, 2008

TOTD #22: Java SE client for a Metro endpoint

Metro is the Web services stack in GlassFish. It is your one-stop shop from a simple Hello World to Secure, Reliable,  Transactional and .NET 3.0 interoperable endpoint. Metro Tooling is provided by NetBeans and other options are explained here.

Screencast #ws7 describes how a Metro endpoint can be easily created and deployed on GlassFish and invoked from a Web client using NetBeans IDE. This TOTD (as requested here and here) describes how a Secure and Reliable Metro endpoint can be invoked using a Java SE client.

Here is my environment:

Let's get started.

  1. Following screencast #ws7 create a plain (without Reliability and Security enabled) Metro endpoint.
  2. Create the Java SE client project
    1. In NetBeans IDE, create a new project of the type Java/Java Application. Name the project as "SEClient" and take all other defaults.
    2. Right-click on the newly created project, select "New", "Web Service Client...".
    3. Click on the "Browse..." button next to "Project" radio button and select the deployed Web service endpoint.
    4. Enter the package name as "client" and click on "Finish".
  3. Invoke the plain Metro endpoint
    1. Right-click on the project, select "Properties", "Libraries", "Add JAR/Folder" and add "webservices-rt.jar" from the "lib" directory of GlassFish installation. Click on "OK".
    2. Expand the "Web Service References" node in the project and drag the leaf node in the "main" method of "Main.java" of the client project.
    3. Change the value of parameter "name" to "Duke".
    4. Right-click the project and select "Run". This will build the project, invoke the endpoint and show the results in Output window as "Hello Duke".
    5. If your GlassFish instance is configured to show SOAP messages then the following SOAP messages will be shown in the output window:

      ====[com.sun.xml.ws.assembler.server:request]====
      <?xml version="1.0" ?>
      <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
        <S:Body>
          <ns2:sayHello xmlns:ns2="http://server/">
            <name>Duke</name>
          </ns2:sayHello>
        </S:Body>
      </S:Envelope>
      ============
      ====[com.sun.xml.ws.assembler.server:response]====
      <?xml version="1.0" ?>
      <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
        <S:Body>
          <ns2:sayHelloResponse xmlns:ns2="http://server/">
            <return>Hello Duke</return>
          </ns2:sayHelloResponse>
        </S:Body>
      </S:Envelope>
      ============
  4. Invoke the Reliable Metro endpoint
    1. Following the instructions in screencast #ws7, enable Reliability on Metro endpoint and re-deploy.
    2. In the client project, select the first child node of "Web Service References", right-click and select "Refresh Client".
    3. In the "Confirm Client Refresh" window, select "Also replace local wsdl file with original WSDLs located at:" checkbox and click on "Yes".
    4. Right-click the client project and select "Run". This will build the project, invoke the endpoint and show the results in Output window as "Hello Duke".
    5. The SOAP messages during this run will now contain Reliable Messaging protocol messages and resemble as shown below:

      ====[com.sun.xml.ws.assembler.server:request]====
      <?xml version="1.0" ?>
      <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
        <S:Header>
          <To xmlns="http://www.w3.org/2005/08/addressing">http://localhost:8080/SEEndpoint/HelloServiceService</To>
          <Action xmlns="http://www.w3.org/2005/08/addressing">http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence</Action>
          <ReplyTo xmlns="http://www.w3.org/2005/08/addressing">
            <Address>http://www.w3.org/2005/08/addressing/anonymous</Address>
          </ReplyTo>
          ...
  5. Invoke the Secure Metro endpoint
    1. Following the instructions in screencast #ws7, disable Reliability and enable Security on Metro endpoint and re-deploy.
    2. In the client project, select the first child node of "Web Service References", right-click and select "Refresh Client".
    3. In the "Confirm Client Refresh" window, select "Also replace local wsdl file with original WSDLs located at:" checkbox and click on "Yes".
    4. Right-click on the first child of "Web Service References" node, select "Edit Web Service Attributes" and select "Use development defaults". This will ensure that client and endpoint security credentials match.
    5. Expand "Source Packages", "META-INF" and open "HelloServiceService.xml". The name of this file is derived from the service name at the endpoint and may be different. Specify the location of trust store by adding the following attributes to "sc:KeyStore" element:

      location="C:\\testbed\\glassfish\\final\\glassfish\\domains\\domain1\\config\\cacerts.jks" type="JKS" storepass="changeit"

      The updated element looks like:

      <sc:TrustStore wspp:visibility="private" peeralias="xws-security-server" location="C:\\testbed\\glassfish\\final\\glassfish\\domains\\domain1\\config\\cacerts.jks" type="JKS" storepass="changeit"/>

      Make sure to match the value of location and password of the trust store in your environment.
    6. Right-click the client project and select "Run". This will build the project, invoke the endpoint and show the results in Output window as "Hello Duke".
    7. The SOAP messages during this run are now secured using the default security profile in NetBeans. The SOAP messages resemble as shown below:

      ====[com.sun.xml.ws.assembler.server:request]====
      <?xml version="1.0" ?>
      <S:Envelope
        xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
        xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
        xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
        xmlns:exc14n="http://www.w3.org/2001/10/xml-exc-c14n#">
        <S:Header>
          <To xmlns="http://www.w3.org/2005/08/addressing" wsu:Id="5006">http://localhost:8080/SEEndpoint/HelloServiceService</To>
          <Action xmlns="http://www.w3.org/2005/08/addressing" wsu:Id="5005">http://server/HelloService/sayHelloRequest</Action>
          <ReplyTo xmlns="http://www.w3.org/2005/08/addressing" wsu:Id="5004">
            <Address>http://www.w3.org/2005/08/addressing/anonymous</Address>
          </ReplyTo>
          <MessageID xmlns="http://www.w3.org/2005/08/addressing" wsu:Id="5003">uuid:bb0e9571-a773-49bb-bad0-20a01d3af9f1</MessageID>
          <wsse:Security S:mustUnderstand="1">
            <wsu:Timestamp xmlns:ns10="http://www.w3.org/2003/05/soap-envelope" wsu:Id="3">
            <wsu:Created>2008-01-23T20:13:28Z</wsu:Created>
            ...

If you are using JDK version prior to Java SE 6 U4, then need to override the JAX-WS and JAXB API as described here. Java SE 6 U4 already includes JAX-WS and JAXB 2.1 APIs which are required for the Metro client to work.

Please leave suggestions on other TOTD that you'd like to see. A complete archive is available here.

Technorati: totd webservices metro glassfish netbeans javase

Tuesday Jan 15, 2008

Developer.com 2008 Awards Announced - NetBeans, GlassFish and Java SE 6 score well

Developer.com 2008 Product of the year Awards

Developer.com 2008 Awards are announcedNetBeans, GlassFish Metro and Java SE 6 get good ones.

My nominations were announced here and I've recreated the table here along with the winners. 

Category My Selection Winner
Technology Rich Internet Applications Ajax
Framework Java SE 6
Development Tool NetBeans IDE
Development Utility Apache Ant Mozilla Firefox
Web Service Development Tool or Add-in Project jMaki Google Maps
Wireless/Mobile Development Tool or Add-in NetBeans Mobility Pack
Database Tool or Add-in JavaDB PostgreSQL
Java Tool or Add-in NetBeans IDE
JSR JSR 277 JSR 223
.NET Tool or Add-in GlassFish Web Services Interoperability Technology (now Metro)
Open Source Tool NetBeans IDE Subversion

It's interesting to see that GlassFish/WSIT is the only Java entry in ".NET Tool or Add-in" category.

Here are some of the comments from reviewers:
  • Java SE 6 - New parsing and XML to Java object-mapping APIs allow developers to build Web services (now more convenient)
  • NetBeans IDE
    • Eases development with the best out-of-the box experience and management
    • Innovative features such as JRuby/Ruby on Rails and .Net support
    • Visual Mobile Designer for rapid development and prototyping
Enjoy all the details here. Overall 5 of my nominations won, not bad :)

Technorati: survey netbeans glassfish javase developer.com product awards

Sunday Dec 09, 2007

Vote for Product of The Year 2008 @ Developer.com

It's that time of the year, time to cast your vote for the favorite product of the year. The voting ends Dec 21.

In order to make it easy for you, here are my choices :)

Category My Selected Product
Technology Rich Internet Applications
Framework Java SE 6
Development Tool NetBeans IDE
Development Utility Apache Ant
Web Service Development Tool or Add-in Project jMaki
Wireless/Mobile Development Tool or Add-in NetBeans Mobility Pack
Database Tool or Add-in JavaDB
Java Tool or Add-in NetBeans IDE
JSR JSR 277
.NET Tool or Add-in GlassFish Web Services Interoperability Technology (now Metro)
Open Source Tool NetBeans IDE

Technorati: survey netbeans glassfish javase developer.com product awards

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
« April 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
   
       
Today