Skip to main content

[Solved] Glassfish v2 with DTrace Java API under Solaris Express

5 replies [Last post]
cydrike
Offline
Joined: 2007-04-19

Hey everyone,

I've got a student project for my school using the Java DTrace API.

I've already created a web service with NetBeans 5.5 and Glassfish and it works very well.

After that, I found wsit (tango project) and I wanted to use it because of interoperability with another part of the project in C#.

But in order to use it, I need Glassfish v2 and NetBeans 5.5.1.
Now I've got some troubles with Glassfish v2. I can't run my previous web service.

The web service need a dtrace.jar file in its libraries and I had to add this library in the lib folder of the server too in order to make it work. No trouble with Glassfish v1. But with Glassfish v2 it crashes when I call my webservice :

Here's the code :

<br />
public boolean start() {<br />
        // TODO implement operation<br />
        boolean res=false;</p>
<p>        // create a LocalConsumer<br />
        Consumer consumer = new LocalConsumer();<br />
	consumer.addConsumerListener( new ConsumerAdapter() {<br />
	    public void dataReceived(DataEvent e) {<br />
                if(e.getProbeData().getEnabledProbeDescription().getProvider().compareTo("mib")==0)<br />
                {<br />
                    System.out.println(e.getProbeData().getEnabledProbeDescription());<br />
                    networkData.addLast(e.getProbeData().getEnabledProbeDescription().toString());<br />
                }<br />
	    }<br />
	});</p>
<p>    try<br />
    {<br />
        consumer.open();<br />
        consumer.compile(new File("/Documents/DTraceWSApplication/prog.d"));<br />
        consumer.enable();<br />
        consumer.go();<br />
        res=true;<br />
    }<br />
    catch(Exception e)<br />
    {<br />
        e.printStackTrace();<br />
    }</p>
<p>        return res;<br />
    }<br />

And the error when I call the start() method :

<br />
java.lang.reflect.InvocationTargetException<br />
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br />
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br />
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br />
        at java.lang.reflect.Method.invoke(Method.java:597)<br />
        at com.sun.enterprise.webservice.InvokerImpl.invoke(InvokerImpl.java:68)<br />
        at com.sun.enterprise.webservice.EjbInvokerImpl.invoke(EjbInvokerImpl.java:75)<br />
        at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:132)<br />
        at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:241)<br />
        at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:75)<br />
        at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:559)<br />
        at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:518)<br />
        at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:503)<br />
        at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:400)<br />
        at com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl.process(AbstractTubeImpl.java:70)<br />
        at com.sun.enterprise.webservice.MonitoringPipe.process(MonitoringPipe.java:133)<br />
        at com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:79)<br />
        at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:559)<br />
        at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:518)<br />
        at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:503)<br />
        at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:400)<br />
        at com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl.process(AbstractTubeImpl.java:70)<br />
        at com.sun.xml.ws.mex.server.MetadataServerPipe.process(MetadataServerPipe.java:97)<br />
        at com.sun.enterprise.webservice.CommonServerSecurityPipe.processRequest(CommonServerSecurityPipe.java:191)<br />
        at com.sun.enterprise.webservice.CommonServerSecurityPipe.process(CommonServerSecurityPipe.java:113)<br />
        at com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:79)<br />
        at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:559)<br />
        at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:518)<br />
        at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:503)<br />
        at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:400)<br />
        at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:208)<br />
        at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:374)<br />
        at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:175)<br />
        at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:134)<br />
        at com.sun.enterprise.webservice.Ejb3MessageDispatcher.handlePost(Ejb3MessageDispatcher.java:100)<br />
        at com.sun.enterprise.webservice.Ejb3MessageDispatcher.invoke(Ejb3MessageDispatcher.java:74)<br />
        at com.sun.enterprise.webservice.EjbWebServiceServlet.dispatchToEjbEndpoint(EjbWebServiceServlet.java:187)<br />
        at com.sun.enterprise.webservice.EjbWebServiceServlet.service(EjbWebServiceServlet.java:116)<br />
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)<br />
        at com.sun.enterprise.web.AdHocContextValve.invoke(AdHocContextValve.java:101)<br />
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)<br />
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:564)<br />
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:558)<br />
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:74)<br />
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:207)<br />
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)<br />
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:564)<br />
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:558)<br />
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1067)<br />
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)<br />
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)<br />
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:564)<br />
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:558)<br />
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1067)<br />
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:249)<br />
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:618)<br />
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:549)<br />
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:790)<br />
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:326)<br />
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:248)<br />
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:199)<br />
        at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:328)<br />
        at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)<br />
        at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:93)<br />
Caused by: javax.ejb.EJBException<br />
        at com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:3813)<br />
        at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3713)<br />
        at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3515)<br />
        at com.sun.ejb.containers.WebServiceInvocationHandler.invoke(WebServiceInvocationHandler.java:187)<br />
        at $Proxy65.start(Unknown Source)<br />
        ... 63 more<br />
Caused by: java.lang.UnsatisfiedLinkError: Unable to find libdtrace_jni.so.1<br />
        at org.opensolaris.os.dtrace.Utility.loadLibrary(Utility.java:54)<br />
        at org.opensolaris.os.dtrace.Utility.loadLibrary(Utility.java:80)<br />
        at org.opensolaris.os.dtrace.LocalConsumer.(LocalConsumer.java:73)<br />
        at FDLC.DTraceWS.start(DTraceWS.java:38)<br />
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br />
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br />
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br />
        at java.lang.reflect.Method.invoke(Method.java:597)<br />
        at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1051)<br />
        at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:165)<br />
        at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2846)<br />
        at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3930)<br />
        at com.sun.ejb.containers.WebServiceInvocationHandler.invoke(WebServiceInvocationHandler.java:176)<br />
        ... 64 more<br />

Okey, it can't find the ressource libdtrace_jni.so.1 ... but why ??? Glassfish v1 can find it but Glassfish v2 not! It's under /usr/lib/.

I've already tried to change the rights on th file but nothing has worked.

What must I do with Glassfish v2 to make it load this library ?

Thanks in advance

Message was edited by: cydrike

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Eduardo Pelegri-Llopart

As Kedar says.. very interesting project. Please report back so the
community can learn from it.

Thanks!
- eduard/o (theaquarium@sun.com, http://blogs.sun.com/theaquarium...)

glassfish@javadesktop.org wrote:
> Amazing this works.
>
> First I've checked LD_LIBRARY_PATH but this variable was empty, so I created it with what you said.
> Then I've added your point 1, and it worked.
> Then I've tried without the variable (I've set it to an empty string), and it still worked after a rebbot.
>
> Thanks a lot for your so quick help Kedar.
> [Message sent by forum member 'cydrike' (cydrike)]
>
> http://forums.java.net/jive/thread.jspa?messageID=213253
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

km
Offline
Joined: 2005-10-28

Man, this sounds so interesting!

Great Project indeed.

I think I know why it was working in V1 and not in V2. But let me tell you the work-around first and then convey the reason :). Before that, can you confirm that /usr/lib is available in the LD_LIBRARY_PATH system environment variable on your shell?

1- Can you please put "/usr/lib" in "native-library-path-suffix" attribute of java-config element in the domain.xml?

Regards,
Kedar

cydrike
Offline
Joined: 2007-04-19

Amazing this works.

First I've checked LD_LIBRARY_PATH but this variable was empty, so I created it with what you said.
Then I've added your point 1, and it worked.
Then I've tried without the variable (I've set it to an empty string), and it still worked after a rebbot.

Thanks a lot for your so quick help Kedar.

km
Offline
Joined: 2005-10-28

Sure thing, Cydrike.

Can you now tell us more about this interesting project? :-)

Kedar

cydrike
Offline
Joined: 2007-04-19

Yes of course,

The project title is : from DTrace to MOM.
So we need to create a webservice with a glassfish server under solaris 10, using the Java Api for DTrace.
The other part of the project need a windows server 2003 R2 with MOM runing on it and a .Net application using the Java Webservice.

That's it. We are totally free to implement this.

WSIT can interact with WCF so we're trying to use it, in order to have a reliable transfer between the webservice and the .Net application.

I hope I've answered your question

Cydrike