Last week's kickoff of FESI's research program went very well. There are a number of folks (>500) who are now following this blog on Java.net, and a number who have gotten involved. While we wait for more folks, we'll be researching new technologies, the first being NOSQL databases.
If the kind of topics we're research interests you, please feel free to join the project;...
Content available at: http://blogs.sun.com/arungupta/entry/totd_124_using_cdi_jpa
In which our hero makes Jersey dance in ways that probably make the Jersey authors take to their sick beds with a headache.
There is much discussion these days about HATEOAS (Hypermedia as the engine of application state) so it gets time to clearly say what HATEOAS actually means.
Web Services and XML
This week is my last at Oracle, next week I'll be starting a new job with Mitre.
I started looking around for a "Plan B" prior to the Sun acquisition closing in February, mainly due to uncertainty about whether I'd be offerred a position with Oracle. A friend introduced me to an excellent opportunity at Mitre and, after a couple of rounds of interviews and a lot of thought, Plan B...
Recently a user in GlassFish forum asked about developing JAX-WS web service in an OSGi bundle. Here is a complete sample demonstrating the same. You can download it from here.
As the above diagram shows, we have three components, viz:
1) osgi-service.jar: This is an OSGi bundle which provides a service to other bundles. It contains two POJOs, viz:
a) an interface called sahoo.hybridapp.jaxws1.service.Watch
b) an implementation of the same interface called sahoo.hybridapp.jaxws1.service.WatchImpl.
This bundle also contains a bundle activator called sahoo.hybridapp.jaxws1.service.Activator, which is responsible for registering an instance of WatchImpl in OSGi service registry.
2) web-service.war: This is a Web Application Bundle. A Web Application Bundle is a hybrid application - it's both a Java EE archive as well as an OSGi bundle. In this case, it is a war file as well as an OSGi bundle. It's a war file, because it contains a Servlet based JAX-WS end point. It's an OSGi bundle, because we want to make use of OSGi service in the implementation of our web service. It contains a single class called sahoo.hybridapp.jaxws1.webservice.WatchWebService which is defined like this:
The MANIFEST.MF of web-service.war looks like this:
3) web-service-client.jar: This is a plain jar file which makes use of JAX-WS stack of Java SE environment to invoke our web service. It has a single class called sahoo.hybridapp.jaxws1.webserviceclient.Main. The rest of the classes that are part of this jar are generated by wsdl compiler as part of build.
How to build, deploy and test:
Step 1: Start GlassFish
Step 2: Build and deploy the service bundles
mvn clean install
This will produce two OSGi bundles called osgi-service/target/osgi-service.jar and web-service/target/web-service.war. Deploy these two OSGi bundles to GlassFish by simply copying them to domain1/autodeploy/bundles/ dir as shown below:
cp osgi-service/target/osgi-service.jar web-service/target/web-service.war $glassfish.home/domains/domain1/autodeploy/bundles/
GlassFish will automatically detect that web-service.war is a WAB and will perform necessary deployment of EE artifacts as a result of which a web service end point will be available. You can see something like this appearing in server.log:
WS00018: Webservice Endpoint deployed
WatchWebService listening at address at http://localhost:8080/hybridapp.jaxws1.web-service/WatchWebServiceService
Step 3: Build and run the client
Once the web service is available, run
mvn -f web-service-client/pom.xml
to build web-service-client.jar. This is because the WSDL url, as specified in web-service-client/pom.xml, is not available until the web service is deployed.
To test, simple run:
java -jar web-service-client.jar
You shall see it will print the current time as obtained from the web service which in turn obtrains it from the OSGi service.
Enjoy developing OSGi enabled Java EE applications in GlassFish.
If you are using Ant 1.7.1 for developing Web Services with JAX-WS/JAXB, I suggest you to move to the latest version Ant 1.8.0.
I've extended the declarative hyperlinking module to support creation of HTTP Link headers.
New functionality in the experimental declarative hyperlinking module for Jersey.
One of the areas I'm keen to improve in the next version of JAX-RS is link creation. JAX-RS already offers UriBuilder but I think an annotation driven approach could save a lot of repetitive coding.
I've been experimenting with a couple of annotations that I think would be useful and I just checked in an experimental extension that partially implements what I have in mind. Suppose you have a...
One of the big features in Java EE 6 is dependency injection(yeah, 330 & 299 stuff!!). It pretty much integrated with the every EE component. That means you can nicely use all the CDI features with JAX-WS web services.
Content available at: http://blogs.sun.com/arungupta/entry/spark_it_2010_trip_report
Like to use XSLT 2.0 but fear to switch to SAXON? Just drop saxon9he.jar into JRE's lib/ext folder and you're done! NO FEAR, IT WILL WORK.
This article shows how we can use Spring Secirity and Spring remoting together to create a Spring Service in a Web application, secure it using Spring Security and later on invoke it from a Java SE application.
Sick of XALAN bugs in GlassFish? Time to pimp your container!
Christmas holidays is one of my favourite moment in the year, I have time to see my relatives, read books, play with my kids and hack a little bit.
I think I don't like the most in the strawman proposal is that the syntax for function type and for lambda literal reuse the same symbol '#'.
It's something that I've observed when teaching C. The C syntax use * when you...
Enhance your javadoc with UML diagram using UMLGraph with maven.
This relatively long article discusses OSGI, HK2, GlassFish modularity, how to extend GlassFish CLI and GlassFish administration console, Using GlassFish update system and finally setting up and managing an IPS package system.
A lot of applications these days title themselves RESTful. But how much REST is needed to be RESTful?
GlassFish v3 comes bundled with Metro - a secure, reliable, transactional, and .NET interoperable Web services stack. Metro is compliant with JAX-WS and provides additional quality of service attributes that can be easily enabled using NetBeans IDE.
This blog contains a screencast that shows how to create a simple Web service using NetBeans 6.8, implement the business logic by accessing a...