Posts Tagged Java

Distributed Caching, also on Mac OS X

IBM’s distributed caching system, WebSphere eXtreme Scale (formerly ObjectGrid) is a distributed, transactional object caching system for elastic scalability and extreme performance.

It can store any type of data and provides REST API as long with Java (HashMap, JPA, Hibernate, Spring) APIs.  It also natively integrates with WebSphere Application Server and WebSphere Liberty Profile to cache HTTP session data.

It is supported on most platforms and – because it is a pure JavaSE application, it also works on Mac OS X, although this platform is not officially supported by IBM.

How to get started ?

  • Download eXtreme Scale trial and unzip
  • In a Terminal, go to product directory
  • cd ObjectGrid/gettingstarted
  • Run the Catalog Server
  • ./runcat.sh
  • Open another Terminal window and start an ObjectGrid server
  • ./runcontainer.sh server0
  • Repeat the last step to create several instances of ObjectGrid server
  • Then experiment with client script.  It provides basic CRUD operations from command line
  • ./runclient.sh i key value

Congrats, you managed to setup a multi instance grid, in-memory cache system on your Mac.

To further understand how it works and how you can programmatically interact with the cache, refer to eXtreme Scale documentation.

Next step will be to demonstrate how eXtreme Scale integrates with Liberty to create a multi instance cluster with shared HTTP Session. Stay Tuned.

Enjoy !

 

 

, , , , ,

No Comments

JDeveloper Major Release – 11.1.2

This week, Oracle released a major new version of JDeveloper IDE, version 11.1.2

What’s new ?

  • The plugin system has been revamped and is now based on OSGi
  • The startup time has been dramatically reduced.  (We will need to find another activity to allow us for a cup of coffee – or two – in the morning)
  • Integration with Maven 2
  • Support of JSF 2
  • And, for Mac users using OpenJDK 7, no more need to hack your Java installation to make the installer happy. (when using Apple’s provided JDK 1.6, you still have to follow these instructions)

You can download it from OTN.  Have a look at the release notes and the user documentation.

enjoy !

[UPDATE]

I have to admit that the startup time has improved much !  On my Macbook Pro (Core 2 Duo 2.66Ghz / 4GB RAM – Apple JDK 1.6.0_24), a warm start gives the JDeveloper 20 secs to get the main Window. Weblogic seems to follow this path too with an impressive 11 secs to status [RUNNING].

, , , ,

No Comments

NetBeans 7.0 and JAX-RPC Web Services

Sometimes, you encounter old WSDL service definitions, based on RPC style SOAP instead of the newer Document based litteral encoding.

To discover wether a WSDL is using RPC or literal encoding, check the “style” parameter of the “binding” element, such as

<binding name="A_WebServiceBinding" type="tns:A_WebServiceRPC">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>

In Java, RPC based SOAP is implemented by JAX-RPC, a quite old API developed for Java 1.4.  As it is older than JAXB, it even implements its own XML to Java object mapping.

When SOAP 1.2 was released, the Java platform switched to the newer JAX-WS implementation to support it along with other stuffs, namely HTTP Binding (aka XML over HTTP without SOAP), a new data mapping model and support for WS-I basic profile 1.1

You can read this IBM article for a very good, while concise, description of JAX WS vs JAX RPC.

In NetBeans 7.0, only JAX WS is provided out of the box.  When you encounter older WSDL, based on RPC encoding, you must manually install JAX-RPC.  However this plugin is not provided in the default plugin repository anymore.  You will need to add another plugin repository :

  • Select “Tools” in the menu, then “Plugins”, then the “Settings” tab.
  • Add a Repository with the name you choose and this URL : http://deadlock.netbeans.org/hudson/job/nbms-and-javadoc/lastStableBuild/artifact/nbbuild/nbms/updates.xml.gz

  • Then go back to “Available Plugins” and type RPC in the search box, you should find JAX-RPC in the list of proposed plugins.
  • Follow the instructions to download and install the plugins.

Et voilà, you are now ready to create JAX RPC based Java clients by choosing the “File” menu, then “New File” then choose “Web Service Clients” in the “Web Services” section.

Enjoy !

, , , , ,

34 Comments

JDeveloper 11g PS4 is available

JDeveloper team released last week version 11.1.1.5, aka Patch Set 4.

This is a maintenance only release, no new feature has been added in this release. You can download it for free from Oracle Technology network.

Release Notes are available here

As usual, should you try to install it on Mac OS X, don’t forget to symlink classes.jar to rt.jar in your JVM installation, as per instructions on this blog (or from the official documentation)

, , ,

No Comments

NetBeans 7.0 is available

NetBeans 7.0 is available for download.

The major new feature of this release is the support for the upcoming Java SE 7 specification, in particular project Coin (diamond operator, String in switch, multi catch for exceptions …).

Others new / improved features is the support for Maven 3, Git etc … and the support for GlassFish Application Server 3.1, Oracle Weblogic Server and Oracle database (simplified connection wizard, guided installation to JDBC driver, editing and deployment of stored procedures)

Download is free for everyone, release notes are full of details.

Enjoy !

, ,

No Comments

Evaluating Coherence on Mac OS X

Coherence is a in-memory distributed cache system, usually sitting in between your application servers and your databases.
Coherence is designed to be extremely scalable and has no single point of failure.
It was originally developed by TangoSol and acquired by Oracle in March 2007.

Although usually used by large scale Internet web site and transactional system, Coherence happens to be very lightweight and easy to use for evaluation / development.

Coherence is fully developed in Java and runs on any Java-enabled platform, including Solaris, Linux, Windows and Mac OS X.  Coherence provides clients libraries for Java, .Net and C++ applications.

In this serie of articles, I will show how to test and evaluate Coherence on a Mac OS X system.

1. Get the package

You can freely download Coherence from Oracle Technology Network (free membership required)

2. Unzip the package

marsu:~ sst$ unzip coherence-java-3.6.0.0b17229.zip

3. Inspect the package and be sure the scripts are executable

marsu:~ sst$ ls coherence
bin		doc		lib		product.xml

Without surprises :

  • bin – will contains the executable
  • doc – contains the javadoc
  • lib – contains the JAR to be included with your application
marsu:~ sst$ chmod u+x bin/*.sh

4. Start a first cluster node

marsu:coherence sst$ ./bin/cache-server.sh

Many lines will be output on the console.  Be sure to read

Group{Address=224.3.6.0, Port=36000, TTL=4}
MasterMemberSet
(
ThisMember=Member(Id=1, Timestamp=2010-12-10 13:02:01.121, Address=192.168.0.2:8088, MachineId=26626, Location=machine:marsu,process:42007, Role=CoherenceServer)
OldestMember=Member(Id=1, Timestamp=2010-12-10 13:02:01.121, Address=192.168.0.2:8088, MachineId=26626, Location=machine:marsu,process:42007, Role=CoherenceServer)
ActualMemberSet=MemberSet(Size=1, BitSetCount=2
Member(Id=1, Timestamp=2010-12-10 13:02:01.121, Address=192.168.0.2:8088, MachineId=26626, Location=machine:marsu,process:42007, Role=CoherenceServer)
)
RecycleMillis=1200000
RecycleSet=MemberSet(Size=0, BitSetCount=0
)
)
Group{Address=224.3.6.0, Port=36000, TTL=4}
MasterMemberSet  (  ThisMember=Member(Id=1, Timestamp=2010-12-10 13:02:01.121, Address=192.168.0.2:8088, MachineId=26626, Location=machine:marsu,process:42007, Role=CoherenceServer)  OldestMember=Member(Id=1, Timestamp=2010-12-10 13:02:01.121, Address=192.168.0.2:8088, MachineId=26626, Location=machine:marsu,process:42007, Role=CoherenceServer)  ActualMemberSet=MemberSet(Size=1, BitSetCount=2    Member(Id=1, Timestamp=2010-12-10 13:02:01.121, Address=192.168.0.2:8088, MachineId=26626, Location=machine:marsu,process:42007, Role=CoherenceServer)    )  RecycleMillis=1200000  RecycleSet=MemberSet(Size=0, BitSetCount=0    )  )

And … that’s it.  The first cluster node is started.

5. Start a second cluster node

In another terminal, type  :

marsu:~ sst$ cd coherence
marsu:coherence sst$ ./bin/cache-server.sh

In the output, be sure to read

MasterMemberSet
  (
  ThisMember=Member(Id=2, Timestamp=2010-12-10 13:05:16.693, Address=192.168.0.2:8090, MachineId=26626, Location=machine:marsu,process:42023, Role=CoherenceServer)
  OldestMember=Member(Id=1, Timestamp=2010-12-10 13:02:01.121, Address=192.168.0.2:8088, MachineId=26626, Location=machine:marsu,process:42007, Role=CoherenceServer)
	ActualMemberSet=MemberSet(Size=2, BitSetCount=2
	Member(Id=1, Timestamp=2010-12-10 13:02:01.121, Address=192.168.0.2:8088, MachineId=26626, Location=machine:marsu,process:42007, Role=CoherenceServer)
	Member(Id=2, Timestamp=2010-12-10 13:05:16.693, Address=192.168.0.2:8090, MachineId=26626, Location=machine:marsu,process:42023, Role=CoherenceServer)
   )
RecycleMillis=1200000
RecycleSet=MemberSet(Size=0, BitSetCount=0
)
)

6. Troubleshooting startup issues

By default, Coherence uses multicast to communicate between servers.  In some rare cases, Multicast might fail, preventing the second node to join the cluster.

Be sure to check the documentation and these troubleshooting notes if you run into a problem.

7. Using the cache interractively

Coherence has a command line interface to manipulate objects in the cache,

marsu:coherence sst$ ./bin/coherence.sh ** Starting storage enabled console **
(many lines suppressed)
2010-12-10 13:26:02.066/1.264 Oracle Coherence GE 3.6.0.0 <D5> (thread=Invocation:Management, member=3): Service Management joined the cluster with senior service member 1
Map (?):

Let’s first create a cache :

Map (?): cache currencies
2010-12-10 13:31:30.019/329.217 Oracle Coherence GE 3.6.0.0 <Info> (thread=main, member=3): Loaded cache configuration from "jar:file:/Users/sst/coherence/lib/coherence.jar!/coherence-cache-config.xml"
2010-12-10 13:31:30.151/329.350 Oracle Coherence GE 3.6.0.0 <D5> (thread=DistributedCache, member=3): Service DistributedCache joined the cluster with senior service member 1
<distributed-scheme>
<scheme-name>example-distributed</scheme-name>
<service-name>DistributedCache</service-name>
<backing-map-scheme>
<local-scheme>
<scheme-ref>example-binary-backing-map</scheme-ref>
</local-scheme>
</backing-map-scheme>
<autostart>true</autostart>
</distributed-scheme>
Map (currencies):
Map (?): cache currencies2010-12-10 13:31:30.019/329.217 Oracle Coherence GE 3.6.0.0 <Info> (thread=main, member=3): Loaded cache configuration from "jar:file:/Users/sst/coherence/lib/coherence.jar!/coherence-cache-config.xml"2010-12-10 13:31:30.151/329.350 Oracle Coherence GE 3.6.0.0 <D5> (thread=DistributedCache, member=3): Service DistributedCache joined the cluster with senior service member 1<distributed-scheme>  <scheme-name>example-distributed</scheme-name>  <service-name>DistributedCache</service-name>  <backing-map-scheme>    <local-scheme>      <scheme-ref>example-binary-backing-map</scheme-ref>    </local-scheme>  </backing-map-scheme>  <autostart>true</autostart></distributed-scheme>
Map (currencies):

Populate the cache :

Map (currencies): put USD "US Dollar"
null

Map (currencies): put EUR "Euro"
null

Map (currencies): put CHF "Swiss Franc"
null

Map (currencies): put GPB "British Pound"
null

Play with the cache :

Map (currencies): size
4

Map (currencies): get CHF
Swiss Franc

Map (currencies): remove CHF
Swiss Franc

Map (currencies): size
3

Map (currencies): list
GPB = British Pound
USD = US Dollar
EUR = Euro

8. Next Step

In the next article, I will show you how to programmatically interact with Coherence from a Java application.

, , ,

No Comments

YaJuG General Assembly

YaJuG‘s next General Assembly will be hosted at Espace Reunion, Leudelange on December the 14th.

YaJuG will welcome David Delabassee, Oracle‘s Java Ambassador for the region and JavaOne speaker.

David will do a recap of the recent changes around the various Java platforms.

Then, to follow YaJuG’s tradition, we will have some fun with electronic devices programmation – David will make you discover the world of Arduino.

Registration is now open !

, ,

No Comments

First run of OpenJDK 1.7 for Mac OS X

My colleague Alexis recently shared a couple of links on Twitter to DMG files containing recent builds of OpenJDK for Mac OS X.

These builds are created by the community for the community – they are experimental and are probably not stable.  Thanks Gildas and Henri for your work !

I downloaded the 64 bits version (32 bits version also available) and installed it in a couple of minutes.  These builds install in Apple proposed location : /Library/Java/JavaVirtualMachines

First test is obviously :

marsu:~ sst$ /Library/Java/JavaVirtualMachines/openjdk-1.7-x86_64/bin/java -version
openjdk version "1.7.0-internal"
OpenJDK Runtime Environment (build 1.7.0-internal-henri_2010_11_25_16_22-b00)
OpenJDK 64-Bit Server VM (build 20.0-b02, mixed mode)

Then I configured Netbeans to use that JDK to compile and run projects :

Netbeans 6.9 has build in modules to support some upcoming Java SE 7 syntax, such as the language simplifications proposed by project Coin.

BTW, should you want to create the builds yourself, everything is documented – you can even start a continuous build with Hudson. You can then download specific scripts to build OpenJDK on MacOSX and to create the installation packages (Will require Apple’s Developer Tools to be installed)

Enjoy !

, ,

4 Comments

JavaFX Client for JAX-RS Tutorial

Last week, during the Devoxx conference, Alexis (Java and GlassFish dude) and Antonio (book author and Paris JUG Leader) gave a Java EE 6 hands-on training session.

They based their labs and samples on the Java EE 6 Tutorial code sample project available on Kenia.com

I modestly contributed to Demo 11, JAX-RS and Jersey.  The demo already included several clients (web based, android,…) and we added a JavaFX application to the set.

You can get the source code from Kenai and experiment with it (this a NetBeans project that should compile just fine with NetBeans 6.9)

Have fun !

, ,

No Comments

Devoxx unofficial videos posted

Nicolas, the french guy behind Le Touilleur Express blog, just posted three Devoxx videos, these are great 3 minutes show giving you a sense of what Devoxx really is.

Day 1

Day 2

Day 3

, ,

No Comments