Thanks for all your help. I set up my test client as you outlined so that I can invoke the capability from the client side. On running the test client, I try to start the httpd, but Tomcat 6.0 indicates that it cannot find the Capability class with the following error message displayed in the Tomcat DOS console
java.lang.RuntimeException: [ID = 'JavaClassNotFound'] The Java class specified was not found: com.example.www.http_server.MyCapability. Make sure the correct class or .jar file is in the classpath. I'm not sure why I am getting this error. My CLASSPATH contains the http_management.jar (which contains the MyCapability class) and the $TOMCAT_HOME\webapps\http-management\WEB-INF\lib also contains hte http_management.jar file My JAVA_HOME variable is set as follows: >echo %JAVA_HOME% C:\Program Files\Java\jdk1.6.0_01 Any help would be appreciated. Vinh Nguyen (vinguye2) wrote: > > I believe you are using Muse incorrectly. The capability classes are > server-side artifacts, and based on the muse.xml configuration, Muse will > automatically load them with the associated resource. > > In your case, you are attempting to manually instantiate a capability from > a client, which will not have any resources loaded with it. If you want > to invoke a server resource operation, you need to create a client proxy > to connnect to the resource. > > Taking a step back, what exactly are you trying to accomplish? If you are > trying to create a server-side capability to read the Apache httpd.conf > file: > 1) Create the custom capability and override the initialize() method to > read the file > 2) Add the capability reference to your muse.xml for your resource > 3) Deploy your server app, and let Muse load your resource and > capabilities. Muse will invoke initialize() on each capability, which > will then invoke your code. > > To invoke your capability from the client side: > 1) Generate a client-side proxy to your resource (i.e. Run wsdl2java > -proxy on your resource wsdl) > 2) Create a test program that uses your proxy, and sends the SOAP request > to the remote server resource. > > > -----Original Message----- > From: MUSEME [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 12, 2007 3:53 PM > To: [email protected] > Subject: Re: Muse Resource not initialized > > > Hi Bogdan. Here are the answers to your questions: > 1) No errors were found in the catalina.log file, just the foll. INFO > items, not sure if they mean anything > INFO: Jk running ID=0 time=0/30 config=null > INFO: The Apache Tomcat Native library which allows optimal performance > in production environments was not found on the java.library.path: > 2) Here is how I call initialize from my client: > // create EPR for test resource > URI address = > URI.create("http://localhost:8080/http-management/services/http-server"); > EndpointReference epr = new EndpointReference(address); > MyCapability http = new MyCapability(epr); > //http.setTrace(true); > try > { http.initialize();} > catch (Throwable error) > {error.printStackTrace();} > > And here is the code snippet of MyCapability > public class MyCapability extends AbstractWsResourceCapability > implements > IMyCapability { > public MyCapability (EndpointReference arg0) { > new WsResourceClient(arg0); > } > public void initialize() > throws SoapFault > { //super.initialize(); - Commented out as this does not work > // Commented out getInitializationParameter as I get the foll. > exception > // java.lang.NullPointerException at > //org.apache.muse.core.AbstractCapability.getInitializationParameter > //(AbstractCapability.java:105) > //String installDir = > getInitializationParameter("httpd-install-dir"); > String installDir = "C:\\Program Files\\Apache Software > Foundation\\Apache2.2"; > Map configParams = null; > try > { configParams = readConfigFile(installDir+"\\conf\\httpd.conf");} > catch (IOException error) > { throw new SoapFault("Error while reading httpd.conf.", error); > //throw new IOException("Error while reading httpd.conf.", > error); } > _ServerName = (String)configParams.get("ServerName"); > String portString = (String)configParams.get("Listen"); > String threadsString = (String)configParams.get("ThreadsPerChild"); > _PortNumber = Integer.valueOf(portString); > _ThreadsPerChild = Integer.valueOf(threadsString); > > // The following statement fails with > java.lang.NullPointerException > ResourceManager manager = getResource().getResourceManager(); > ..} > 3) The application is built on Axis2. > > Not sure if this is relevant but when I list "http-server" URI services > from Axis2, I see the foll: > > http-server > Service EPR : http://localhost:8080/http-management/services/http-server > Service REST epr : http://localhost:8080/http-management/rest/http-server > > I then click on the http-server hyperlink and get the foll. error: > > <error> > <description>Unable to generate WSDL for this service</description> − > <reason> > If you wish Axis2 to automatically generate the WSDL, then please use one > of the RPC message receivers for the service(s)/operation(s) in > services.xml. > If you have added a custom WSDL in the META-INF directory, then please > make sure that the name of the service in services.xml > (/serviceGroup/service/@name) is the same as in the custom wsdl's service > name (/wsdl:definitions/wsdl:service/@name). > </reason> > </error> > > > > Bogdan Solomon wrote: >> >> Can you check your server log and make sure that there are no errors >> related to the Axis2 container initialization. Also, how do you call >> initialize from your client? >> >> And is the application that you built Axis2 or OSGi based? >> >> >> MUSEME wrote: >>> >>> I've built the httpd muse interface using the sample MYCAPABILITY and >>> have started and stopped it using a test client. However I have been >>> unable to do anything that is resource related. For example, I keep >>> getting java.lang.NullPointerException when I try to access the >>> manager variable using the following code snippet: >>> ResourceManager manager = getResource().getResourceManager(); >>> BTW, the following also doesn't work: >>> ResourceManager manager = getEnvironment().getResourceManager(); >>> There is no getResourceManager method from getEnvironment(). >>> I have to call mycapability initialize() method from my client >>> because it is not loaded by Apache muse. Also the resource >>> "hhtp-server" associated with my resource context path subsequently >>> doesn't get created since the manage variable returns >>> NullPointerException. >>> Resource resource = manager.createResource("http-server"); >>> I have also tried using the SimpleResource class getEnvironment() and >>> getResourceManager() methods, both of which return null values. >>> Also the >>> String installDir = getInitializationParameter("httpd-install-dir") >>> returns null although I have the "httpd-install-dir" specified in the >>> muse.xml. I have been forced to subsequently hardcode the actual >>> value of httpd-install-dir. It is obvious that the muse environment >>> is not initialized. Any help would be appreciated. I have exhausted >>> all my options. >>> >> >> > > -- > View this message in context: > http://www.nabble.com/Muse-Resource-not-initialized-tf3907854.html#a11089049 > Sent from the Muse User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- View this message in context: http://www.nabble.com/Muse-Resource-not-initialized-tf3907854.html#a11167979 Sent from the Muse User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
