profesorfalken / jPowerShell

Simple Java API to interact with PowerShell console
Apache License 2.0
218 stars 84 forks source link

ClassNotFoundException and NoClassDefFoundError #19

Closed paulhage closed 7 years ago

paulhage commented 7 years ago

Greetings Professor Falken, I am designing a web application that is run on a tomcat server allowing users to remotely execute a power shell command, via the click of an html style button, on a virtual machine that hosts the server. I have used your library (thank you) and am running into an HTTP 500 error. The library seems to work fine when implemented and run in a basic java environment, however when I attempt to integrate it into the web application it is unsuccessful. I have followed your listed documentation to the T, and have taken this final route to contact you personally for assistance. I greatly appreciate any feedback and guidance you may offer. Bellow I have attached some screenshots for reference. All jars have been added to my build path. project explorer code error

profesorfalken commented 7 years ago

Hello,

That happens because, even when the library exists at compilation time, when the application is running in the server, the library is not available at runtime. How do you deploy the application? In Tomcat the libraries should be deployed into the WEB-INF/lib directory. Have you checked it? Do you notice that the icons of Powershell library are a little bit different than the others in your Eclipse? I guess you have not imported/configured them properly. Also you are supposed to have only one version of the library. 1.8 version is ok.

Instead, if you do not know how to deploy it, you can set it manually in the tomcats lib directory.

Best regards

paulhage commented 7 years ago

Thank you greatly for such a timely and helpful response! Seems as though the 500 error has been resolved after I moved the jar file to my tomcats lib folder on the VM. According to my console output, the command is successfully being executed as I wish.

I appreciate your time and guidance.

Regards