Skip to content

How to enable azure connect for java tomcat worker role?

January 23, 2012

Last week, I started investigation on hosting spring application in windows azure using the java tomcat accelerator provided by Microsoft. The application required access to the on premises database. So I need to enable azure connect on java tomcat worker role. The steps were not very difficult, I just followed the instructions on the Microsoft web site IDE option for eclipse are not available. So I need to add following entries manually to config files.

1) Add following entry to .csdef file

<Import moduleName=”Connect”/>

2) Add following to cscfg file

<Setting name=”Microsoft.WindowsAzure.Plugins.Connect.ActivationToken” value=”xxxxxx”/>
<Setting name=”Microsoft.WindowsAzure.Plugins.Connect.Refresh” value=””/>
<Setting name=”Microsoft.WindowsAzure.Plugins.Connect.WaitForConnectivity” value=””/>
<Setting name=”Microsoft.WindowsAzure.Plugins.Connect.Upgrade” value=””/>
<Setting name=”Microsoft.WindowsAzure.Plugins.Connect.EnableDomainJoin” value=””/>
<Setting name=”Microsoft.WindowsAzure.Plugins.Connect.DomainFQDN” value=””/>
<Setting name=”Microsoft.WindowsAzure.Plugins.Connect.DomainControllerFQDN” value=””/>
<Setting name=”Microsoft.WindowsAzure.Plugins.Connect.DomainAccountName” value=””/>
<Setting name=”Microsoft.WindowsAzure.Plugins.Connect.DomainPassword” value=””/>
<Setting name=”Microsoft.WindowsAzure.Plugins.Connect.DomainOU” value=””/>
<Setting name=”Microsoft.WindowsAzure.Plugins.Connect.Administrators” value=””/>
<Setting name=”Microsoft.WindowsAzure.Plugins.Connect.DomainSiteName” value=””/>

That is all you require for azure connect to work from java worker role.

From → Tech, Uncategorized

  1. Francesco permalink

    Hello …. My name is Francesco and I’m doing a project on azure using java on eclipse. My project is in a web role where I put the job in a queue and the worker role take the job form queue and process it. But I’m having many problems … You know how do I create a class that represents the Worker Role?Sorry for my english!

    • Hi Francesco,
      Just go through this ( video you will get exact details how to write worker class. I am also planning to write one for me. Let me know if you still have issue with writing java worker role

      • Francesco permalink

        Hi rajendersaini..
        Thank you very much for the video it was very helpful. .I’ll tell you something … My project is a project for college so I don’t have the account storage. I configured the environment and use the code without the account and it works. But I do not understand a step in the video, when he creates the class “HelloWorker” can I do, whatever he does, in a method and then create an instance of HelloWorker (HelloWorker HelloWorker = new HelloWorker (); hello. m1 ()) in the Servlet? can it be done?

      • Hi Francesco,

        Azure have no idea whether it is running java or any other exe. Essentially what he is trying to to do is writing a .net wrapper worker role and then invoking some process in Run() method.

        In nutshell it is equivalent of running “java someclass” on command line. java.exe will be started and it will load jvm and then it will invoke main method of the someclass.

  2. Francesco permalink

    yes … my intention is to create the equivalent of “WorkerRole.cs” file in java. Anyway I’ll try and see how it goes … Thanks for the help rajendersaini!

    • Hi Francesco,

      The way go about it is to have .net worker role calling java class. One way to do that is jni layer from .net and jni layer loading and calling java class. Let me know how it goes for you…

      • Francesco permalink

        Hi Rajendersaini
        sorry for the late, but I solved the problem … I wanted to ask one thing …. when I put an object that is instance of a class created first, in a CloudQueueMessage give me error … do you know if the class that represent the object must implement some class or interface?

  3. Sorry Francesco, I did not understand your question. Can you be bit more clear?

    • Francesco permalink

      ok …. for example I have a CloudQueueMessage and I want to insert “Hello World” so I write:
      CloudQueueMessage message = new CloudQueueMessage(“Hello World”);
      it’s perfect.
      My problem is that I want to put an object in place of “Hello World”. For explane you, this object is called MyObject.
      I would can write like :
      CloudQueueMessage message = new CloudQueueMessage (new MyObject (parameter1, parameter2, …);
      But the compiler will not let me because it tells me:
      The constructor CloudQueueMessage (MyObject) is undefined.
      Do you understand now?

      • You need to covert your parameters into string and from string to object again


        create object from the string when you retrieve the message again .

        I will look for other option if we have any

  4. Francesco permalink

    thanks rajendersaini I think that your solution is good…I try to do it and after I’ll know about it!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: