cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
praveengaur
Level 3

Not able to execute custom code

Hello,
I have written a custom code to send HTTP get request. I am not using bundled VM, instead I am using JRE 1.7+ for both compiling the custom code as well as on target system(exactly same version). In log I am getting error class not available. Please suggest if I am missing something.

Thanks,
Praveen
Labels (1)
0 Kudos

(11) Replies
scarney
Level 5

You can do a couple of things:

[LIST=a]
  • You could bundle the JRE that you are using. There is documentation in the user guide on how to do that. See pp. 308 of the user guide on how to create a custom vm pack.
  • Pp.423 of the user guide shows you how to add the vm pack. I had to do this because we needed to carry java 1.7. It turns out that Flexera carries 1.7_10 on their website. If that is sufficient for your needs, you could download that and add it.
  • The other thing you will need to do is in the Advanced Designer, click Project -> JVM Settings and then select the Installer Settings tab. There is an Installer Valid VM List. Make that 1.7. If you don't set that to 1.7, the installer will first search on the target system for a 'valid' VM. If it is 1.6 which doesn't do what you want, you will get an error.
  • The other thing is if you are developing this using a JDK, there are extra jarfiles you may have to carry as dependencies.
  • 0 Kudos
    praveengaur
    Level 3

    Thanks a lot scarney for reply,

    Actually I already have tried the a,b,c stuffs but all in vain. Still I am getting same error. I am not sure about (d), i.e which all extra jars I need to include. Please explain this a bit.
    Even though I am not ought to bundle a VM with package, but for sake of testing I did that but could not succeed.

    Thanks,
    Praveen
    0 Kudos
    jchfeng
    Level 4

    One common root cause is that perhaps in your custom codes you import some classes provided by InstallAnywhere. In this case you need to add the required jar into dependency of your custom codes. In "Custom action" -> Properties -> Dependencies -> Add jar or zip. the jar files are located at IA_HOME\resource\services
    0 Kudos
    praveengaur
    Level 3

    Hi Jchfeng,

    I am importing
    import com.zerog.ia.api.pub.*
    in my custom code. I tried the way you suggested. First I tried adding IA_HOME\resource\services as dependency then I tried including IAClasses.zip as well, but still getting the same error. Any other case where this error is likely to occur.

    Thanks,
    Praveen
    0 Kudos
    nosrednayduj
    Level 7

    Under Project->JVM Settings, did you select "Add service support for custom code"?
    0 Kudos
    praveengaur
    Level 3

    Yes, I tried this also but still am facing the same issue
    thanks,
    Praveen
    0 Kudos
    anilsharma
    Level 4

    praveengaur wrote:
    Yes, I tried this also but still am facing the same issue
    thanks,
    Praveen


    The class not found exception clearly shows that we are missing the classes in the jar/zip which we are using. You might be requiring httpclient or httpcore jar. It will be better if you can tell the class name for which class not found exception is coming
    0 Kudos
    praveengaur
    Level 3

    anilsharma wrote:
    The class not found exception clearly shows that we are missing the classes in the jar/zip which we are using. You might be requiring httpclient or httpcore jar. It will be better if you can tell the class name for which class not found exception is coming


    Thanks Anil,
    I am getting "class com.org.HttpURLConnectionCheck unavailable". exception. It is not throwing an exception for httpcore/httpclient jar, instead not able to find that class that I have created.

    thanks,
    Praveen
    0 Kudos
    RamyaVenkatesh
    Level 7

    Hi,

    Are you sure you have specified the main classname correctly? Is it possible to share the custom code jar file?

    Thanks,
    Ramya
    0 Kudos
    anilsharma
    Level 4

    praveengaur wrote:
    Thanks Anil,
    I am getting "class com.org.HttpURLConnectionCheck unavailable". exception. It is not throwing an exception for httpcore/httpclient jar, instead not able to find that class that I have created.

    thanks,
    Praveen


    The class you mentioned is very well part of HTTPClient.jar. You need to add this jar in dependencies along with IAClasses.zip. Also make sure that the your class is a part of the resource(jar) which you have provided in the path. Check for the classname as well. It needs to be declared with package like com.xxx.installer.YourClass
    0 Kudos
    praveengaur
    Level 3

    anilsharma wrote:
    The class you mentioned is very well part of HTTPClient.jar. You need to add this jar in dependencies along with IAClasses.zip. Also make sure that the your class is a part of the resource(jar) which you have provided in the path. Check for the classname as well. It needs to be declared with package like com.xxx.installer.YourClass


    Hi Anil,
    This class is created by me. I am not importing Apache provided HTTPClient.jar. I am using import java.net.HttpURLConnection. I believe this should be provided by JRE on target system.Apart from this I tried changing the Package name as you suggested, but getting the same error.
    Custom Action: com.org.installer.HttpURLConnectionCheck
    Status: ERROR
    Additional Notes: ERROR - class com.org.installer.HttpURLConnectionCheck unavailable.
    Please correct me if doing something wrong.
    0 Kudos