Hello World

Jul 8, 2008 at 8:47 PM
Followed steps shown in http://www.codeplex.com/HealthVaultJavaLib/Thread/View.aspx?ThreadId=30294&ANCHOR#Post103188.
Created eclipse projects for sdk & ui. Was able to remove errors after adding classpath variable M2_REPO=$USER/.m2/repository (local repository location). When I try to sign-in to HV pre-prod login, get Unexpected RuntimeException.

Classpath for jwildcat-sdk and jwildcat-ui contains M2_REPO/commons-codec/commons-codec/1.3/commons-codec-1.3.jar.

Exception message:

WicketMessage: Can't instantiate page using constructor public com.microsoft.hsg.applications.weight.AuthenticationPage(org.apache.wicket.PageParameters) and argument wctoken = "[ASAAAFxPJ93Pq6dBl4LmuM+OYwYtT4KB9LVGEHt3jvxd7f6RuuhfzXIyBmUuQaMT1cWNiQ27nbkq5EAcXitvvzL1vSE4kC2x5pfk67N+NJ18y67LTnR5bHSm4IRxn8K90DeNY7poziO/BDrbxQu6xJPI1y0mhAYJfEptxF0J55lbyooXoi/8Jg==]" actionqs = "[/]" target = "[AppAuthSuccess]"

Root cause:

java.lang.NoClassDefFoundError: org/apache/commons/codec/binary/Hex
     at com.microsoft.hsg.DefaultPrivateKeyStore.initData(DefaultPrivateKeyStore.java:148)
     at com.microsoft.hsg.DefaultPrivateKeyStore.getPrivateKey(DefaultPrivateKeyStore.java:112)
     at com.microsoft.hsg.ApplicationAuthenticator.ensurePrivateKey(ApplicationAuthenticator.java:225)
     at com.microsoft.hsg.ApplicationAuthenticator.authenticate(ApplicationAuthenticator.java:137)
     at com.microsoft.hsg.ApplicationAuthenticator.authenticate(ApplicationAuthenticator.java:130)
     at com.microsoft.hsg.Connection.authenticate(Connection.java:159)
     at com.microsoft.hsg.Connection.authenticate(Connection.java:168)
     at com.microsoft.hsg.ConnectionFactory.getConnection(ConnectionFactory.java:63)
     at com.microsoft.hsg.ConnectionFactory.getConnection(ConnectionFactory.java:80)

Jul 11, 2008 at 6:26 PM
The JVM throws this exception when it cannot load a class file.  Can you ensure the jar is actually in your repository and is not corrupt?  You
might want to locate the file on your file system and try a jar tvf commons-code-1.3.jar.  As a second step, you can delete the jar,
then run the mvn build.  Mvn will download the jar again.  If you can successfully build the sdk but cannot run the app, that points to
an environmental problem between eclipse and your command shell. 
Jul 11, 2008 at 7:04 PM
It might be an environment issue. I found that my project jwildcat-ui did not contain classpath variable M2_REPO/commons-codec/commons-codec/1.3/commons-codec-1.3.jar. Once I added the classpath variable and restarted error was gone.
Not sure if the ui pom.xml needs to have dependency for commons-codec.

Jul 14, 2008 at 6:13 PM
Edited Jul 14, 2008 at 6:19 PM
Thanks saiyed.  From your last post, I think I can see what happened. 

Maven serves as a dependency management system.  It loads depedencies from repositories.  In our case, we are using our local repository as a default. 
When maven builds a project, it loads dependencies from the local repository and if they aren't found, will download them from configured external repositories. 

The java sdk is separated into two projects: sdk and ui.  The demo ui declares the sdk as a dependency.  Maven will then look for the sdk in the
local repository.  Calling "mvn install" on the sdk project builds the sdk and copies it into the repository.  The ui cannot be built until the sdk
is installed.  When creating an eclipse project, maven attempts to retrieve all the dependencies and create classpaths from all the transitive
relationships.  If you create the ui eclipse project *before* you have installed the sdk, the eclipse project will succeed but the dependencies from
sdk will not be present. 

Since the ui does not depend directly on commons-codec, it should not be in the pom.xml for the ui project.  You might try ensuring your sdk is
installed in your local repository and run mvn eclipse:eclipse again for your ui project. 

There is also a lot of good information about maven here:  http://maven.apache.org.
Jul 16, 2008 at 9:35 PM
Can you please give sample code that marshals response of GetPersonInfo (like a method getPersonInfo()) and not just record id (getSelectedRecordId()). We need other info, for eg. Person id (for offline access), name, etc.

Jan 21, 2009 at 1:22 PM
Hey guys I am also suffering from the same exception, have made clean build of sdk project as well as added dependency for commons-codec 1.3 but wont work anything.
Anybody got success regarding this?
Jan 22, 2009 at 3:22 AM
Hey all,
I got the solution and it must be true I think, I have tried to build the SDK project and also inserted dependency of commons-codec in my UI project but that was not working.
After this I have noticed that the email id confirmation process has not been completed for the new healthvault account created by me, this may also creating the problem I think.
Posting it because if somebody is troubleshooting with the same can try this also.

Feb 4, 2009 at 5:04 AM
Hi ajani, 

Did you follow the instructions posted here:  http://www.codeplex.com/HealthVaultJavaLib/Thread/View.aspx?ThreadId=30294

If so, where did the process fail?  Are you using maven from the command line, eclipse, other?  You will not have to add a dependency on commons-coded into the pom.
Dec 11, 2009 at 1:10 PM

Hi Saiyed,

The sample downloaded from codeplex site has only "weight" data type. Did you use other data type? [allergy, GetPersonInfo and many more..] How did you use that? Can you send me a sample on that?

Thanks in advance

Dec 22, 2009 at 9:06 PM

Right now I understand that the Java HealthVault SDK only has wrappers for a subset of the data types. For other types you must work directly with the XML documents.

But I heard a rumor that some of the CodePlex project's developers are working to add additional data type wrappers.  I will let one of them chime in with details and an ETA if this rumor is true.


Dec 22, 2009 at 9:21 PM

Update: the wrappers for 80 HealthVault data types have already been added to this project.  See this thread for more info: http://healthvaultjavalib.codeplex.com/Thread/View.aspx?ThreadId=77074