Hello all. I trying to run one of nine web-api examples for testing web-api mechanism from CLI, but always get java.lang.NoClassDefFoundError. I do it this way: java -cp web-api.jar Example2 [arg0] [arg1] [arg2] [arg3]. There are directory with web-api.jar in classpath. The question is, what i should do for testing web-api examples?
NoClassDefFoundError obviously points to a problem with your path. It may be easier for you to run the samples in an IDE first (like Eclipse, NetBeans etc) because they take care of your class path when running the examples. You only need to import web-api.jar into your classpath and everything works.
Hallo, Mark. Its important for me to decide the problem with my path, because I am going to write my own web-api application based on examples. What I should import in the classpath in addition to web-api.jar?
Thanks, Mark. I have successfully run Example2 this way: java -cp web-api.jar com.hp.itsm.api.examples.Example2 [arg0] [arg1] [arg2] [arg3] But I couldnt run Example3..8, only examples 2 and 9. Example2 and Example9 classes are imported in web-api.jar. Is it mean that I should include my custom class in web-api.jar for it executing possibility?
only Example 2 and Example9 are actually included in web-api.jar. In order to use the other examples you have to compile the source code by yourself. If you are developing standalone Java applications for OpenView then you should have a look at the Eclipse Rich Client. Using this framework you can build a nice GUI including some OpenView functionality within hours. (The initial effort to get going is about 1-2 weeks)
after compiling the sourcecode (it is included in the javadoc files from web-api) you have to include the path to the Example3.class file into your -cp argument. Then you call it in the same way as Example2 (including the package name com.hp.itsm.api.examples) Or you create your own package (e.g. my.package) and call it via my.package.Example3...
i tried to understand what source docs you are talking about but couldn't. there are only html docs in a javadoc folder i have.
i also am trying to make a program relevant to these examples, especially example3. i run example2 and example9. i found these two examples only separately in another web-api folder which includes web-api.jar. but also i have found examples from 1 to 9 in a different folder with sd-webapi.jar. although i have included sd-webapi.jar into eclipse those examples(1-9) are all showing an error regarding OID table, i.e. "The import com.hp.ov.obs.OID; cannot be resolved". i have extracted web-api.jar and sd-webapi and couldn't find any class regarding OID. so, is there any other library by which i can run Example3,4,5,6,7,8?
On sd5 i had to add this jars to CP: sd-webapi.jar OvObsWebApi-Client.jar You can look at source code of your program to see what packages are imported and find related jars. So, then add them to classpass. Ð Ð°Ð²ÐµÑ Ð½Ð¾Ðµ Ð¼Ð¾Ð¶Ð½Ð¾ Ð±Ñ Ð»Ð¾ Ð¸ Ð½Ð° Ñ Ñ Ñ Ñ ÐºÐ¾Ð¼ Ð½Ð°Ð¿Ð¸Ñ Ð°Ñ Ñ .
we do have SD5.1. and all the docs/libraries i do have are from our System Administrator of SSC group (HP OpenView). where do you get these libraries? i logged in to the server where the HPOV Console is through remote admin, so i did see no similar libraries there.
Have you installed web-api package from 5.1 dist or simply copied from some sd45 server(as you mentioned web-api.jar, not as in 5.1 sd-webapi.jar)? In attachement you can find a list of jars on my windows deployment in Program Files\HP OpenView\java\
wait wait,i got a little confused. there is HPOpenview Console on aother server, into where i login through remote admin. there is nothing on my own machine except docs like programmers' guide etc/libraries/examples which our admin has sent to me. i 'm trying to run Examples in Eclipse where i have put those two libraries (web-api.jar, sd-webapi.jar). so, i guess the right library is enough to run any example which are written on java. am i wrong?