Tuesday, February 21, 2012

Using JAXR on JBoss 7.1.1

One of the Technologies specified in the JEE6 Specification is the Java API for XML Registries (JSR 93). Apache Scout is the implementation of this specification. This specification is a client side library to interact with an XML Registry. Examples of XML Registries are UDDI and ebXML. To make a long story short, every Application Server needs to ship with a JAXR implementation, and this is what I have been helping out on.

JBoss JAXR module
On and off over the last few months I have been working on a JAXR module for JBoss-AS-7.1. The requirement for it was such that it needed to pass the JEE6 TCK, and that it should be able to interact with both UDDI v2 and v3 registries. Previous version of JBoss-AS have always shipped with a jUDDI v2 registry but, for the time being,  it was decided to ship the client libraries only this time, which is the only JEE6 required component anyway. In other words, you need to have a running instance of jUDDI for the JAXR module to connect to.

How to use it?
Your deployment will only need to depend on the JAXR API, if you are using maven add the following to the dependencies section in your pom:
Now you can get a handle to the JAXR ConnectionFactory simply by looking it up in JNDI
InitialContext context = new InitialContext();
ConnectionFactory jaxrFactory = (ConnectionFactory) context.lookup("java:jboss/jaxr/ConnectionFactory");
Properties properties = new Properties();
//set some JAXR properties

connection = jaxrFactory.createConnection();

//now you can set the credentials on this connection.
PasswordAuthentication passwdAuth = new PasswordAuthentication(userid, passwd.toCharArray());
Set creds = new HashSet();
at this point you should be able to execute any JAXR registry command. Make sure to add your own exception handling.

What if I don't want to use the default JAXR module configuration?
The default JAXR configuration lives in the standalone/configuration/standalone.xml:


connection-factory attributedefault valuedescriptionrequired
jndi-name-Name used to bind into JNDIY
Class name of the JAXR implementation the JAXR module will instantiateN
property attributedefault valuedescriptionrequired
name-Name of the JAXR propertyY
value-Value of the JAXR propertyY

JAXR specifies the following properties:

Figure 1. The JAXR properties as specified in the JAXR specification.

and by default the following properties are set:
JAXR property namedefault value

Additionally, when using the Scout implementation is used, the following properties are set by default
Scout property namedefault value

To use JAXR in the default configuration, simply use a standalone/configuration/standalone.xml with the following jaxr section:


This means that by default Scout connects to the UDDI registry using the UDDI v2 API specification, using the SaajTransport class. It is this configuration that was used for TCK compatibility testing as the JAXR specification has not been updated since the UDDI v3 specification was published.

What if I want to connect to a UDDI v3 Registry?
The Apache Scout implementation supports connecting to a UDDI v3 registry. For this it uses the jUDDI-client library, and the JBoss JAXR module supports using the following configuration in the standalone/configuration/standalone.xml:


Override the properties set in the configuration
In the first code fragment of this blog post it was shown that you can set properties before using the connection, using jaxrFactory.setProperties(properties). This will add these properties, or override the defaults. This way you can override property setting programmatically.

This concludes this post on using JAXR on JBoss-AS7.1. If you would like to add an entry on how to use Scout on another Application Server, then by all means send it to us and we will add it!




  1. I have installed jUDDI in my machine on Windows 7.But I am getting problem in opening UDDI Portal,it show the following error:
    HTTP Status 404 - /pluto/portal/jUDDI

    Please help me on this...

    1. I wonder if you're using the portal bundle. Subscribe to the jUDDI user mailing list if you need help.



    2. Hi Kurt,

      Kurt I am trying to implement jUDDI in weblogic. I have deployed jUDDI and Pluto portal in weblogic. But i found that its not possible to login to the portal with out normal weblogic user credentials. Hence i set up a user in weblogic and configured the same in jUDDI. DB is also set. I think we need UDDI portlet also, hence i deployed that also. When i deployed UDDI portlet i was getting this error

      Error is: 'weblogic.application.ModuleException: [HTTP:101216]Servlet: "UDDIClerkServlet" failed to preload on startup in Web application: "uddiportlets".


      at org.apache.juddi.v3.client.config.UDDIClerkServlet.init(

      at weblogic.servlet.internal.StubSecurityHelper$



      at weblogic.servlet.internal.StubSecurityHelper.createServlet(

      at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(

      at weblogic.servlet.internal.StubLifecycleHelper.(

      Kurt its very helpful if a solution for the error is there.