Archive

Archive for January, 2008

“Authorization Failed” in DFS-based Service (D6)

January 26, 2008 doquent Leave a comment

The DFS SDK provides convenience Java classes for writing a consumer for a DFS-based web service. The consumer itself can also be a service. On the other hand, a consumer can also be written to use only the service WSDL without using any of the DFS SDK tools. If you are writing both a custom DFS-based service and its consumer using the SDK, things work out relatively smoother. Since the same set of tools are creating the consumer as well as the service, it can ensure that they are compatible in all aspects. If you decide to create the consumer using only the WSDL, then the onus is on you to make it work.

I created a custom DFS-based service staring with the sample AcmeCustomService. I also created a Java consumer using the SDK and it was able to interact with the service easily. Next, I generated a client stub (the plumbing for communicating with the service) based on the WSDL using AXIS2 tools. I wrote a simple client to invoke the service using the stub. I held my breath as I ran the client – only to get a SerializableException. Note that any server-side exception would show up as this exception on the client side. I added some logging and obtained "Authorization Failed" as the embedded message. Note that both the clients were talking to the same service deployment. A day’s worth of research didn’t yield anything concrete. Finally, I started browsing the generated code for the service.

In the file named xxWebService.java where xx was the name of my main service file, there was an annotation reading

@javax.jws.HandlerChain(file="authorized-service-handler-chain.xml")

I tried to locate this file but couldn’t find it in the project. Finally, I found this file in the service EAR file that was being packaged and deployed. Next to it I found a file named anonymous-service-handler-chain.xml. The difference between the content of these two files was a handler dealing with authorization. So, a web service authorization was taking place and the consumer code generated by the DFS SDK was taking care of it somewhere.

There were two options at this time – make the service anonymous or figure out the right way to authenticate the client. I had spent enough time trying to make this work so I decided to just make the service anonymous by altering the annotation to

@javax.jws.HandlerChain(file="anonymous-service-handler-chain.xml")

Then I repackaged the EAR and redeployed it. That was it! The AXIS2-based client worked perfectly. By the way, the DFS SDK-generated Java consumer also continued to work.

Authorizing the consumer will be a battle for another day.

Running DFS Sample Code for D6

January 24, 2008 doquent Leave a comment

D6 provides an SDK for developing custom web services and clients using DFS (Documentum Foundation Services). When I started playing with it, the first thing I wanted to do was to see that the sample code works. I also found that the DFS Development Guide describes the use of the SDK in good detail. The sample service that I tried was AcmeCustomService.

I ran into a few issues but they were not too much to overcome. Following are the key things to keep in mind if you are trying this for the first time:

  1. In the sample code, replace the host IP and port number everywhere with the correct values.
  2. The build.xml file refers to dfs.sdk.libs variable, but it is not defined anywhere. This can be added to the build.properties file. However, it is more appropriate to add it to the build.xml as follows:
    <property name="dfs.sdk.libs" value="${dfs.sdk.home}/lib"/>
  3. The packageService target packages the dfc.properties file from outside the AcmeCustomService folder. Any changes to the dfc.properties files under the AcmeCustomService/etc folder are ignored. These can be fixed as follows:
    <path location="${basedir}/etc/dfs.properties"/>
    <path location="${basedir}/etc/dfc.properties"/>
  4. I found this to be the easiest way to do the build:
    ant clean artifacts package

Continuously “Acquiring Network Address”

January 24, 2008 doquent 28 comments

I was facing this problem intermittently – my wireless network connection would get stuck on “Acquiring Network Address” even though I hadn’t changed anything in network settings. Typically, this would happen after coming back from Standby. I use Windows XP Professional and the wireless router is D-Link DI-524. The only solution I knew would be to reboot the machine.

When even a reboot wouldn’t fix it, I would go to My Computer > Properties > Hardware > Device Manager > Network Adapters and uninstall the wireless adapter. Rebooting would install it back and the connection would work.

Today, I got stuck as none of these approaches would fix the problem. So I went out Googling and found the following solution that worked for me:

  1. Start Control Panel and select Add or Remove Programs
  2. Select Add/Remove Windows Components
  3. Select Networking Services
  4. Click Details button
  5. Uncheck Internet Gateway Device Discovery and Control Client

Save these settings and restart the system.

I have not seen the problem again since making this change.

OutOfMemoryError: PermGen space

January 9, 2008 doquent 6 comments

I encountered this error with Tomcat 5.5 and in Eclipse as well when using Web Tools features. Adding the following JVM options resolved the problem:

-XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:MaxPermSize=256M

Of course, you can use a different value for the MaxPermSize depending upon the available RAM.

For Eclipse, I added these options to the shortcut:

C:\programs\eclipse\eclipse.exe -vmargs -Xmx768M -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:MaxPermSize=256M

For Tomcat, I edited catalina.bat to add the following line:

set JAVA_OPTS=%JAVA_OPTS% -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:MaxPermSize=256M

Categories: Etc Tags: , ,