The Source for Java Technology Collaboration

Home » java.net Forums » GlassFish » GlassFish

Thread: JNI/CompositeApp/Glassfish

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 21 - Last Post: Jun 1, 2009 11:24 PM by: Markus Karg
Martin, Ray
JNI/CompositeApp/Glassfish
Posted: May 28, 2009 9:53 AM
  Click to reply to this thread Reply

Does anyone have a JNI application running in Glassfish?

I have a third party JNI app (Netica). It runs fine from the command
line.

i have an EJBModule and a BPEL project added to a composite app. The
composite app is deployed to Glassfish and runs fine - receiving and
responding to SOAP message.

i then add the JNI app to the EJBModule and deploy the composite app to
Glassfish.

there are two SOAP messages to the composite app - setup and activate.

i issue the setup message - the request and response occur.
i issue the activate message - the JNI app runs - all is good - the
results are stored in the database.
after the JNI app should be completed, the memory usage starts to climb.

any suggestions?
[att1.html]


chrjohn

Posts: 85
Re: JNI/CompositeApp/Glassfish
Posted: May 28, 2009 10:39 AM   in response to: Martin, Ray
  Click to reply to this thread Reply

Hi,

I suggest you try to find out what is eating your memory.
You could either create a heap dump with "jmap -dump:format=b,file=dump.hprof <pid>" and analyze it with a heap dump analyzer of your choice (e.g. VisualVM, Eclipse HeapDump Analyzer) or you could issue a "jmap -histo:live <pid>" and take a look at the class histogram.

You can find out the PID of the GlassFish process with "jps". The process is called PELaunch.

HTH,
Chris

Martin, Ray
RE: Re: JNI/CompositeApp/Glassfish
Posted: May 28, 2009 10:47 AM   in response to: chrjohn
  Click to reply to this thread Reply

Thank you - I will give those a try.

-----Original Message-----
From: glassfish@javadesktop.org [mailto:glassfish@javadesktop.org]
Sent: Thursday, May 28, 2009 1:39 PM
To: users@glassfish.dev.java.net
Subject: Re: JNI/CompositeApp/Glassfish

Hi,

I suggest you try to find out what is eating your memory.
You could either create a heap dump with "jmap
-dump:format=b,file=dump.hprof <pid>" and analyze it with a heap dump
analyzer of your choice (e.g. VisualVM, Eclipse HeapDump Analyzer) or
you could issue a "jmap -histo:live <pid>" and take a look at the class
histogram.

You can find out the PID of the GlassFish process with "jps". The
process is called PELaunch.

HTH,
Chris
[Message sent by forum member 'chrjohn' (chrjohn)]

http://forums.java.net/jive/thread.jspa?messageID=348159

---------------------------------------------------------------------
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


Martin, Ray
RE: JNI/CompositeApp/Glassfish
Posted: May 29, 2009 3:07 AM   in response to: Martin, Ray
  Click to reply to this thread Reply

Very smart people created JNI.
Very smart people created EJB.

These very smart people make sure that JNI cannot operate within EJB -
why would people do something like that?

i have fuddled for months building a system around glassfish - now it
looks like i am back to ServiceMix, where i was a year ago

________________________________

From: Martin, Ray
Sent: Thursday, May 28, 2009 12:54 PM
To: users@glassfish.dev.java.net
Subject: JNI/CompositeApp/Glassfish


Does anyone have a JNI application running in Glassfish?

I have a third party JNI app (Netica). It runs fine from the command
line.

i have an EJBModule and a BPEL project added to a composite app. The
composite app is deployed to Glassfish and runs fine - receiving and
responding to SOAP message.

i then add the JNI app to the EJBModule and deploy the composite app to
Glassfish.

there are two SOAP messages to the composite app - setup and activate.

i issue the setup message - the request and response occur.
i issue the activate message - the JNI app runs - all is good - the
results are stored in the database.
after the JNI app should be completed, the memory usage starts to climb.

any suggestions?
[att1.html]


Markus Karg
RE: RE: JNI/CompositeApp/Glassfish
Posted: May 29, 2009 3:14 AM   in response to: Martin, Ray
  Click to reply to this thread Reply

The idea of EJB is to have a portable application which runs on any
application server on any operating system on any hardware platform. JNI
works only with a particular operating system and hardware platform.
These two core ideas are absolutely not compatible. It just makes no
sense to use EJB directly with JNI. If native stuff is needed in an
enterprise application, it has to be provided in the form of a JCA 1.5
adapter. This is the official Java EE solution to bind portable
applications (EJB) to platform-specific code (JNI). What problem do you
have with that?



From: Martin, Ray [mailto:armart3@tycho.ncsc.mil]
Sent: Freitag, 29. Mai 2009 12:08
To: users@glassfish.dev.java.net
Subject: RE: JNI/CompositeApp/Glassfish



Very smart people created JNI.

Very smart people created EJB.



These very smart people make sure that JNI cannot operate within EJB -
why would people do something like that?



i have fuddled for months building a system around glassfish - now it
looks like i am back to ServiceMix, where i was a year ago



________________________________

From: Martin, Ray
Sent: Thursday, May 28, 2009 12:54 PM
To: users@glassfish.dev.java.net
Subject: JNI/CompositeApp/Glassfish

Does anyone have a JNI application running in Glassfish?



I have a third party JNI app (Netica). It runs fine from the command
line.



i have an EJBModule and a BPEL project added to a composite app. The
composite app is deployed to Glassfish and runs fine - receiving and
responding to SOAP message.



i then add the JNI app to the EJBModule and deploy the composite app to
Glassfish.



there are two SOAP messages to the composite app - setup and activate.



i issue the setup message - the request and response occur.

i issue the activate message - the JNI app runs - all is good - the
results are stored in the database.

after the JNI app should be completed, the memory usage starts to climb.



any suggestions?

[att1.html]


Martin, Ray
RE: RE: RE: JNI/CompositeApp/Glassfish
Posted: May 29, 2009 3:21 AM   in response to: Markus Karg
  Click to reply to this thread Reply

i am too dumb to know that was a solution...

________________________________

From: Markus Karg [mailto:karg@quipsy.de]
Sent: Friday, May 29, 2009 6:14 AM
To: users@glassfish.dev.java.net
Subject: RE: RE: JNI/CompositeApp/Glassfish



The idea of EJB is to have a portable application which runs on any
application server on any operating system on any hardware platform. JNI
works only with a particular operating system and hardware platform.
These two core ideas are absolutely not compatible. It just makes no
sense to use EJB directly with JNI. If native stuff is needed in an
enterprise application, it has to be provided in the form of a JCA 1.5
adapter. This is the official Java EE solution to bind portable
applications (EJB) to platform-specific code (JNI). What problem do you
have with that?



From: Martin, Ray [mailto:armart3@tycho.ncsc.mil]
Sent: Freitag, 29. Mai 2009 12:08
To: users@glassfish.dev.java.net
Subject: RE: JNI/CompositeApp/Glassfish



Very smart people created JNI.

Very smart people created EJB.



These very smart people make sure that JNI cannot operate within EJB -
why would people do something like that?



i have fuddled for months building a system around glassfish - now it
looks like i am back to ServiceMix, where i was a year ago



________________________________

From: Martin, Ray
Sent: Thursday, May 28, 2009 12:54 PM
To: users@glassfish.dev.java.net
Subject: JNI/CompositeApp/Glassfish

Does anyone have a JNI application running in Glassfish?



I have a third party JNI app (Netica). It runs fine from the command
line.



i have an EJBModule and a BPEL project added to a composite app. The
composite app is deployed to Glassfish and runs fine - receiving and
responding to SOAP message.



i then add the JNI app to the EJBModule and deploy the composite app to
Glassfish.



there are two SOAP messages to the composite app - setup and activate.



i issue the setup message - the request and response occur.

i issue the activate message - the JNI app runs - all is good - the
results are stored in the database.

after the JNI app should be completed, the memory usage starts to climb.



any suggestions?

[att1.html]


Martin, Ray
RE: RE: RE: RE: JNI/CompositeApp/Glassfish
Posted: May 29, 2009 4:38 AM   in response to: Martin, Ray
  Click to reply to this thread Reply

i am readin' and scratchin' for JCA information - WOW. What a complex
convoluted mechanism to merely call a tiny piece of code.

i have many Glassfish instances running a variety of things as SOA
nodes. One of the things that one of the Glassfish nodes must do is run
a mathematical algorithm called a bayesian net.

Why should it matter that that one instance is not portable? So, it
must run on a specific hardware platform, who cares? All that is
necessary is for the classloader to function properly to allow this
particular non-portable code to run in a nice simplistic manner.

But, no - i now am required to build my own EIS-like system to contain a
daemon process to listen for commands to run a small algorithm. Then i
need to create an adapter. Then i need to create a connector. Then i
need to ... oh boy.

And, there is something wrong with a system in which a Glassfish node
performs some specialty algorithm? Hmm - yep, i am too dumb to
understand that.

________________________________

From: Martin, Ray
Sent: Friday, May 29, 2009 6:22 AM
To: users@glassfish.dev.java.net
Subject: RE: RE: RE: JNI/CompositeApp/Glassfish


i am too dumb to know that was a solution...

________________________________

From: Markus Karg [mailto:karg@quipsy.de]
Sent: Friday, May 29, 2009 6:14 AM
To: users@glassfish.dev.java.net
Subject: RE: RE: JNI/CompositeApp/Glassfish



The idea of EJB is to have a portable application which runs on any
application server on any operating system on any hardware platform. JNI
works only with a particular operating system and hardware platform.
These two core ideas are absolutely not compatible. It just makes no
sense to use EJB directly with JNI. If native stuff is needed in an
enterprise application, it has to be provided in the form of a JCA 1.5
adapter. This is the official Java EE solution to bind portable
applications (EJB) to platform-specific code (JNI). What problem do you
have with that?



From: Martin, Ray [mailto:armart3@tycho.ncsc.mil]
Sent: Freitag, 29. Mai 2009 12:08
To: users@glassfish.dev.java.net
Subject: RE: JNI/CompositeApp/Glassfish



Very smart people created JNI.

Very smart people created EJB.



These very smart people make sure that JNI cannot operate within EJB -
why would people do something like that?



i have fuddled for months building a system around glassfish - now it
looks like i am back to ServiceMix, where i was a year ago



________________________________

From: Martin, Ray
Sent: Thursday, May 28, 2009 12:54 PM
To: users@glassfish.dev.java.net
Subject: JNI/CompositeApp/Glassfish

Does anyone have a JNI application running in Glassfish?



I have a third party JNI app (Netica). It runs fine from the command
line.



i have an EJBModule and a BPEL project added to a composite app. The
composite app is deployed to Glassfish and runs fine - receiving and
responding to SOAP message.



i then add the JNI app to the EJBModule and deploy the composite app to
Glassfish.



there are two SOAP messages to the composite app - setup and activate.



i issue the setup message - the request and response occur.

i issue the activate message - the JNI app runs - all is good - the
results are stored in the database.

after the JNI app should be completed, the memory usage starts to climb.



any suggestions?

[att1.html]


Markus Karg
RE: RE: RE: RE: RE: JNI/CompositeApp/Glassfish
Posted: May 29, 2009 5:01 AM   in response to: Martin, Ray
  Click to reply to this thread Reply

It is not about whether your particular application must be portable or
not, it is about the fact that the EJB specification ENFORCES an
application to be portable. If you do not need that, you should check
whether you need EJB at all. Not every Java server has to be an EJB
server. Java EE provides more items that you can use, besides EJB. The
complexity of the JCA and EJB specifications solely bases on
portability. If this is not an issue, you shouldn't use it.



I wouldn't say that you are dumb, but you just should understand what
EJB and JCA is good for and that you don't need BOTH in your case. Just
use RMI directly, or use JAX-WS or JAX-RS directly. No need for EJB. No
need for GlassFish at all, BTW.



See, it is like car driving. "Taking classes and doing a exam just to go
round the corner?". No, not needed at all. Just walk.



Regards

Markus



From: Martin, Ray [mailto:armart3@tycho.ncsc.mil]
Sent: Freitag, 29. Mai 2009 13:39
To: users@glassfish.dev.java.net
Subject: RE: RE: RE: RE: JNI/CompositeApp/Glassfish



i am readin' and scratchin' for JCA information - WOW. What a complex
convoluted mechanism to merely call a tiny piece of code.



i have many Glassfish instances running a variety of things as SOA
nodes. One of the things that one of the Glassfish nodes must do is run
a mathematical algorithm called a bayesian net.



Why should it matter that that one instance is not portable? So, it
must run on a specific hardware platform, who cares? All that is
necessary is for the classloader to function properly to allow this
particular non-portable code to run in a nice simplistic manner.



But, no - i now am required to build my own EIS-like system to contain a
daemon process to listen for commands to run a small algorithm. Then i
need to create an adapter. Then i need to create a connector. Then i
need to ... oh boy.



And, there is something wrong with a system in which a Glassfish node
performs some specialty algorithm? Hmm - yep, i am too dumb to
understand that.



________________________________

From: Martin, Ray
Sent: Friday, May 29, 2009 6:22 AM
To: users@glassfish.dev.java.net
Subject: RE: RE: RE: JNI/CompositeApp/Glassfish

i am too dumb to know that was a solution...



________________________________

From: Markus Karg [mailto:karg@quipsy.de]
Sent: Friday, May 29, 2009 6:14 AM
To: users@glassfish.dev.java.net
Subject: RE: RE: JNI/CompositeApp/Glassfish

The idea of EJB is to have a portable application which runs on any
application server on any operating system on any hardware platform. JNI
works only with a particular operating system and hardware platform.
These two core ideas are absolutely not compatible. It just makes no
sense to use EJB directly with JNI. If native stuff is needed in an
enterprise application, it has to be provided in the form of a JCA 1.5
adapter. This is the official Java EE solution to bind portable
applications (EJB) to platform-specific code (JNI). What problem do you
have with that?



From: Martin, Ray [mailto:armart3@tycho.ncsc.mil]
Sent: Freitag, 29. Mai 2009 12:08
To: users@glassfish.dev.java.net
Subject: RE: JNI/CompositeApp/Glassfish



Very smart people created JNI.

Very smart people created EJB.



These very smart people make sure that JNI cannot operate within EJB -
why would people do something like that?



i have fuddled for months building a system around glassfish - now it
looks like i am back to ServiceMix, where i was a year ago



________________________________

From: Martin, Ray
Sent: Thursday, May 28, 2009 12:54 PM
To: users@glassfish.dev.java.net
Subject: JNI/CompositeApp/Glassfish

Does anyone have a JNI application running in Glassfish?



I have a third party JNI app (Netica). It runs fine from the command
line.



i have an EJBModule and a BPEL project added to a composite app. The
composite app is deployed to Glassfish and runs fine - receiving and
responding to SOAP message.



i then add the JNI app to the EJBModule and deploy the composite app to
Glassfish.



there are two SOAP messages to the composite app - setup and activate.



i issue the setup message - the request and response occur.

i issue the activate message - the JNI app runs - all is good - the
results are stored in the database.

after the JNI app should be completed, the memory usage starts to climb.



any suggestions?

[att1.html]


Sahoo
Re: JNI/CompositeApp/Glassfish
Posted: May 29, 2009 5:06 AM   in response to: Martin, Ray
  Click to reply to this thread Reply

Martin,

I am confused. What's your issue? In your first posting you mentioned
that you were successful in running JNI code inside GlassFish except
that you suspected some memory leak for which Chris suggested to use
tools like hat. You were supposed to analyse the memory leak. Have you
identified the cause? If yes, then tell us and tell us if it needs a fix
in GF.

I have failed to identify if you have any other issue in this email
thread. Personally, I have not come across many use cases where a J2EE
app uses JNI. It appears that the spec discourages use of JNI. See [1]
for some discussion. So, over all, it should work with some limitations.

Thanks,
Sahoo

[1] http://www.theserverside.com/discussions/thread.tss?thread_id=14057

Martin, Ray wrote:
> i am readin' and scratchin' for JCA information - WOW. What a complex
> convoluted mechanism to merely call a tiny piece of code.
>
> i have many Glassfish instances running a variety of things as SOA
> nodes. One of the things that one of the Glassfish nodes must do is
> run a mathematical algorithm called a bayesian net.
>
> Why should it matter that that one instance is not portable? So, it
> must run on a specific hardware platform, who cares? All that is
> necessary is for the classloader to function properly to allow this
> particular non-portable code to run in a nice simplistic manner.
>
> But, no - i now am required to build my own EIS-like system to contain
> a daemon process to listen for commands to run a small algorithm.
> Then i need to create an adapter. Then i need to create a connector.
> Then i need to ... oh boy.
>
> And, there is something wrong with a system in which a Glassfish node
> performs some specialty algorithm? Hmm - yep, i am too dumb to
> understand that.
>
> ------------------------------------------------------------------------
> *From:* Martin, Ray
> *Sent:* Friday, May 29, 2009 6:22 AM
> *To:* users@glassfish.dev.java.net
> *Subject:* RE: RE: RE: JNI/CompositeApp/Glassfish
>
> i am too dumb to know that was a solution...
>
> ------------------------------------------------------------------------
> *From:* Markus Karg [mailto:karg@quipsy.de]
> *Sent:* Friday, May 29, 2009 6:14 AM
> *To:* users@glassfish.dev.java.net
> *Subject:* RE: RE: JNI/CompositeApp/Glassfish
>
> The idea of EJB is to have a portable application which runs on any
> application server on any operating system on any hardware platform.
> JNI works only with a particular operating system and hardware
> platform. These two core ideas are absolutely not compatible. It just
> makes no sense to use EJB directly with JNI. If native stuff is needed
> in an enterprise application, it has to be provided in the form of a
> JCA 1.5 adapter. This is the official Java EE solution to bind
> portable applications (EJB) to platform-specific code (JNI). What
> problem do you have with that?
>
>
>
> *From:* Martin, Ray [mailto:armart3@tycho.ncsc.mil]
> *Sent:* Freitag, 29. Mai 2009 12:08
> *To:* users@glassfish.dev.java.net
> *Subject:* RE: JNI/CompositeApp/Glassfish
>
>
>
> Very smart people created JNI.
>
> Very smart people created EJB.
>
>
>
> These very smart people make sure that JNI cannot operate within EJB -
> why would people do something like that?
>
>
>
> i have fuddled for months building a system around glassfish - now it
> looks like i am back to ServiceMix, where i was a year ago
>
>
>
> ------------------------------------------------------------------------
>
> *From:* Martin, Ray
> *Sent:* Thursday, May 28, 2009 12:54 PM
> *To:* users@glassfish.dev.java.net
> *Subject:* JNI/CompositeApp/Glassfish
>
> Does anyone have a JNI application running in Glassfish?
>
>
>
> I have a third party JNI app (Netica). It runs fine from the command
> line.
>
>
>
> i have an EJBModule and a BPEL project added to a composite app. The
> composite app is deployed to Glassfish and runs fine - receiving and
> responding to SOAP message.
>
>
>
> i then add the JNI app to the EJBModule and deploy the composite app
> to Glassfish.
>
>
>
> there are two SOAP messages to the composite app - setup and activate.
>
>
>
> i issue the setup message - the request and response occur.
>
> i issue the activate message - the JNI app runs - all is good - the
> results are stored in the database.
>
> after the JNI app should be completed, the memory usage starts to climb.
>
>
>
> any suggestions?
>

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


Martin, Ray
RE: Re: JNI/CompositeApp/Glassfish
Posted: May 29, 2009 5:21 AM   in response to: Sahoo
  Click to reply to this thread Reply

Yes, Mr. Chris suggested to use jmap and jhat to locate the leak. In my
search for how to use those tools, I found that JNI is not supposed to
work in EJB. So, I said to myself "wow, I am trying to do stuff that
you are not even supposed to be doing. It does not really matter whether
there appears to be a leak or not - the specs say don't do it." I will
spend many weeks on classloaders and jhat and jmap and... I had a
deadline to meet to show the great world of Glassfish SOA.

I do not know how to deploy a POJO app (with a BPEL 'face') in a
composite app. If I knew that, I could call the JNI from the POJO
(staying out of that EJB world) and meet my deadline and put a smile on
my superiors faces. Then later, after my superiors agree that my
selection of Glassfish is marvelous, then I can look for memory leaks or
whatever. But, right now, it's killing me.

Thanx.

-----Original Message-----
From: Sanjeeb.Sahoo@Sun.COM [mailto:Sanjeeb.Sahoo@Sun.COM] On Behalf Of
Sahoo
Sent: Friday, May 29, 2009 8:07 AM
To: users@glassfish.dev.java.net
Subject: Re: JNI/CompositeApp/Glassfish

Martin,

I am confused. What's your issue? In your first posting you mentioned
that you were successful in running JNI code inside GlassFish except
that you suspected some memory leak for which Chris suggested to use
tools like hat. You were supposed to analyse the memory leak. Have you
identified the cause? If yes, then tell us and tell us if it needs a fix
in GF.

I have failed to identify if you have any other issue in this email
thread. Personally, I have not come across many use cases where a J2EE
app uses JNI. It appears that the spec discourages use of JNI. See [1]
for some discussion. So, over all, it should work with some limitations.

Thanks,
Sahoo

[1] http://www.theserverside.com/discussions/thread.tss?thread_id=14057

Martin, Ray wrote:
> i am readin' and scratchin' for JCA information - WOW. What a complex

> convoluted mechanism to merely call a tiny piece of code.
>
> i have many Glassfish instances running a variety of things as SOA
> nodes. One of the things that one of the Glassfish nodes must do is
> run a mathematical algorithm called a bayesian net.
>
> Why should it matter that that one instance is not portable? So, it
> must run on a specific hardware platform, who cares? All that is
> necessary is for the classloader to function properly to allow this
> particular non-portable code to run in a nice simplistic manner.
>
> But, no - i now am required to build my own EIS-like system to contain

> a daemon process to listen for commands to run a small algorithm.
> Then i need to create an adapter. Then i need to create a connector.

> Then i need to ... oh boy.
>
> And, there is something wrong with a system in which a Glassfish node
> performs some specialty algorithm? Hmm - yep, i am too dumb to
> understand that.
>
> ----------------------------------------------------------------------
> --
> *From:* Martin, Ray
> *Sent:* Friday, May 29, 2009 6:22 AM
> *To:* users@glassfish.dev.java.net
> *Subject:* RE: RE: RE: JNI/CompositeApp/Glassfish
>
> i am too dumb to know that was a solution...
>
> ----------------------------------------------------------------------
> --
> *From:* Markus Karg [mailto:karg@quipsy.de]
> *Sent:* Friday, May 29, 2009 6:14 AM
> *To:* users@glassfish.dev.java.net
> *Subject:* RE: RE: JNI/CompositeApp/Glassfish
>
> The idea of EJB is to have a portable application which runs on any
> application server on any operating system on any hardware platform.
> JNI works only with a particular operating system and hardware
> platform. These two core ideas are absolutely not compatible. It just
> makes no sense to use EJB directly with JNI. If native stuff is needed

> in an enterprise application, it has to be provided in the form of a
> JCA 1.5 adapter. This is the official Java EE solution to bind
> portable applications (EJB) to platform-specific code (JNI). What
> problem do you have with that?
>
>
>
> *From:* Martin, Ray [mailto:armart3@tycho.ncsc.mil]
> *Sent:* Freitag, 29. Mai 2009 12:08
> *To:* users@glassfish.dev.java.net
> *Subject:* RE: JNI/CompositeApp/Glassfish
>
>
>
> Very smart people created JNI.
>
> Very smart people created EJB.
>
>
>
> These very smart people make sure that JNI cannot operate within EJB -

> why would people do something like that?
>
>
>
> i have fuddled for months building a system around glassfish - now it
> looks like i am back to ServiceMix, where i was a year ago
>
>
>
> ----------------------------------------------------------------------
> --
>
> *From:* Martin, Ray
> *Sent:* Thursday, May 28, 2009 12:54 PM
> *To:* users@glassfish.dev.java.net
> *Subject:* JNI/CompositeApp/Glassfish
>
> Does anyone have a JNI application running in Glassfish?
>
>
>
> I have a third party JNI app (Netica). It runs fine from the command
> line.
>
>
>
> i have an EJBModule and a BPEL project added to a composite app. The
> composite app is deployed to Glassfish and runs fine - receiving and
> responding to SOAP message.
>
>
>
> i then add the JNI app to the EJBModule and deploy the composite app
> to Glassfish.
>
>
>
> there are two SOAP messages to the composite app - setup and activate.
>
>
>
> i issue the setup message - the request and response occur.
>
> i issue the activate message - the JNI app runs - all is good - the
> results are stored in the database.
>
> after the JNI app should be completed, the memory usage starts to
climb.
>
>
>
> any suggestions?
>

---------------------------------------------------------------------
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


Sahoo
Re: JNI/CompositeApp/Glassfish
Posted: May 29, 2009 5:48 AM   in response to: Martin, Ray
  Click to reply to this thread Reply

Just because the spec says "don't do it" does not necessarily mean "it
will not work." I am not familiar with CompositeApps, so I can't comment
on that. What I understand from your problem description is your main
issue is to call JNI from an EJB. I don't understand why that will not
work. Write a simple test program and see if it works. There are certain
things that does not work when it comes to shared libraries. A shared
library can;t be confined to namespace of a classloader, so if you
deploy multiple same library multiple times, things may not work. But
then, I don't think you are trying to do that.

Secondly why do you care about memory leak if you are just showing some
feature? That can be independently addressed, no?

Sahoo

Martin, Ray wrote:
> Yes, Mr. Chris suggested to use jmap and jhat to locate the leak. In my
> search for how to use those tools, I found that JNI is not supposed to
> work in EJB. So, I said to myself "wow, I am trying to do stuff that
> you are not even supposed to be doing. It does not really matter whether
> there appears to be a leak or not - the specs say don't do it." I will
> spend many weeks on classloaders and jhat and jmap and... I had a
> deadline to meet to show the great world of Glassfish SOA.
>
> I do not know how to deploy a POJO app (with a BPEL 'face') in a
> composite app. If I knew that, I could call the JNI from the POJO
> (staying out of that EJB world) and meet my deadline and put a smile on
> my superiors faces. Then later, after my superiors agree that my
> selection of Glassfish is marvelous, then I can look for memory leaks or
> whatever. But, right now, it's killing me.
>
> Thanx.
>
> -----Original Message-----
> From: Sanjeeb.Sahoo@Sun.COM [mailto:Sanjeeb.Sahoo@Sun.COM] On Behalf Of
> Sahoo
> Sent: Friday, May 29, 2009 8:07 AM
> To: users@glassfish.dev.java.net
> Subject: Re: JNI/CompositeApp/Glassfish
>
> Martin,
>
> I am confused. What's your issue? In your first posting you mentioned
> that you were successful in running JNI code inside GlassFish except
> that you suspected some memory leak for which Chris suggested to use
> tools like hat. You were supposed to analyse the memory leak. Have you
> identified the cause? If yes, then tell us and tell us if it needs a fix
> in GF.
>
> I have failed to identify if you have any other issue in this email
> thread. Personally, I have not come across many use cases where a J2EE
> app uses JNI. It appears that the spec discourages use of JNI. See [1]
> for some discussion. So, over all, it should work with some limitations.
>
> Thanks,
> Sahoo
>
> [1] http://www.theserverside.com/discussions/thread.tss?thread_id=14057
>
> Martin, Ray wrote:
>
>> i am readin' and scratchin' for JCA information - WOW. What a complex
>>
>
>
>> convoluted mechanism to merely call a tiny piece of code.
>>
>> i have many Glassfish instances running a variety of things as SOA
>> nodes. One of the things that one of the Glassfish nodes must do is
>> run a mathematical algorithm called a bayesian net.
>>
>> Why should it matter that that one instance is not portable? So, it
>> must run on a specific hardware platform, who cares? All that is
>> necessary is for the classloader to function properly to allow this
>> particular non-portable code to run in a nice simplistic manner.
>>
>> But, no - i now am required to build my own EIS-like system to contain
>>
>
>
>> a daemon process to listen for commands to run a small algorithm.
>> Then i need to create an adapter. Then i need to create a connector.
>>
>
>
>> Then i need to ... oh boy.
>>
>> And, there is something wrong with a system in which a Glassfish node
>> performs some specialty algorithm? Hmm - yep, i am too dumb to
>> understand that.
>>
>> ----------------------------------------------------------------------
>> --
>> *From:* Martin, Ray
>> *Sent:* Friday, May 29, 2009 6:22 AM
>> *To:* users@glassfish.dev.java.net
>> *Subject:* RE: RE: RE: JNI/CompositeApp/Glassfish
>>
>> i am too dumb to know that was a solution...
>>
>> ----------------------------------------------------------------------
>> --
>> *From:* Markus Karg [mailto:karg@quipsy.de]
>> *Sent:* Friday, May 29, 2009 6:14 AM
>> *To:* users@glassfish.dev.java.net
>> *Subject:* RE: RE: JNI/CompositeApp/Glassfish
>>
>> The idea of EJB is to have a portable application which runs on any
>> application server on any operating system on any hardware platform.
>> JNI works only with a particular operating system and hardware
>> platform. These two core ideas are absolutely not compatible. It just
>> makes no sense to use EJB directly with JNI. If native stuff is needed
>>
>
>
>> in an enterprise application, it has to be provided in the form of a
>> JCA 1.5 adapter. This is the official Java EE solution to bind
>> portable applications (EJB) to platform-specific code (JNI). What
>> problem do you have with that?
>>
>>
>>
>> *From:* Martin, Ray [mailto:armart3@tycho.ncsc.mil]
>> *Sent:* Freitag, 29. Mai 2009 12:08
>> *To:* users@glassfish.dev.java.net
>> *Subject:* RE: JNI/CompositeApp/Glassfish
>>
>>
>>
>> Very smart people created JNI.
>>
>> Very smart people created EJB.
>>
>>
>>
>> These very smart people make sure that JNI cannot operate within EJB -
>>
>
>
>> why would people do something like that?
>>
>>
>>
>> i have fuddled for months building a system around glassfish - now it
>> looks like i am back to ServiceMix, where i was a year ago
>>
>>
>>
>> ----------------------------------------------------------------------
>> --
>>
>> *From:* Martin, Ray
>> *Sent:* Thursday, May 28, 2009 12:54 PM
>> *To:* users@glassfish.dev.java.net
>> *Subject:* JNI/CompositeApp/Glassfish
>>
>> Does anyone have a JNI application running in Glassfish?
>>
>>
>>
>> I have a third party JNI app (Netica). It runs fine from the command
>> line.
>>
>>
>>
>> i have an EJBModule and a BPEL project added to a composite app. The
>> composite app is deployed to Glassfish and runs fine - receiving and
>> responding to SOAP message.
>>
>>
>>
>> i then add the JNI app to the EJBModule and deploy the composite app
>> to Glassfish.
>>
>>
>>
>> there are two SOAP messages to the composite app - setup and activate.
>>
>>
>>
>> i issue the setup message - the request and response occur.
>>
>> i issue the activate message - the JNI app runs - all is good - the
>> results are stored in the database.
>>
>> after the JNI app should be completed, the memory usage starts to
>>
> climb.
>
>>
>>
>> any suggestions?
>>
>>
>
> ---------------------------------------------------------------------
> 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
>
>

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


Martin, Ray
RE: Re: JNI/CompositeApp/Glassfish
Posted: Jun 1, 2009 8:43 AM   in response to: Sahoo
  Click to reply to this thread Reply

This is just FYI:

I wanted to see if I could get "the EJB" out of my problem space. I do
not know a a way to include a Java SE project into a composite app - a
service assembly. So, I created a WebApp and copied all my code from my
EJBModule project. I removed all EJB references and created my own
EntityManager for persistence. I added the WebApp war file to the
service assembly in place of the EJBModule. NetBeans 'wired' together
the service assembly. I deployed what looks to me to be a POJO app to
Glassfish.

Making the call to the JNI causes severe memory leak. Additionally,
which I had not mentioned prior, I cannot send any SOAP messages after
calling the JNI. This inability to send follow-on SOAP messages
invalidates my Glassfish show and tell.

Anyway, this is just info. No response necessary. But, any useful
advice would be appreciated.

Thanx.

-----Original Message-----
From: Sanjeeb.Sahoo@Sun.COM [mailto:Sanjeeb.Sahoo@Sun.COM] On Behalf Of
Sahoo
Sent: Friday, May 29, 2009 8:49 AM
To: users@glassfish.dev.java.net
Subject: Re: JNI/CompositeApp/Glassfish

Just because the spec says "don't do it" does not necessarily mean "it
will not work." I am not familiar with CompositeApps, so I can't comment
on that. What I understand from your problem description is your main
issue is to call JNI from an EJB. I don't understand why that will not
work. Write a simple test program and see if it works. There are certain
things that does not work when it comes to shared libraries. A shared
library can;t be confined to namespace of a classloader, so if you
deploy multiple same library multiple times, things may not work. But
then, I don't think you are trying to do that.

Secondly why do you care about memory leak if you are just showing some
feature? That can be independently addressed, no?

Sahoo

Martin, Ray wrote:
> Yes, Mr. Chris suggested to use jmap and jhat to locate the leak. In
> my search for how to use those tools, I found that JNI is not supposed

> to work in EJB. So, I said to myself "wow, I am trying to do stuff
> that you are not even supposed to be doing. It does not really matter
> whether there appears to be a leak or not - the specs say don't do
> it." I will spend many weeks on classloaders and jhat and jmap and...

> I had a deadline to meet to show the great world of Glassfish SOA.
>
> I do not know how to deploy a POJO app (with a BPEL 'face') in a
> composite app. If I knew that, I could call the JNI from the POJO
> (staying out of that EJB world) and meet my deadline and put a smile
> on my superiors faces. Then later, after my superiors agree that my
> selection of Glassfish is marvelous, then I can look for memory leaks
> or whatever. But, right now, it's killing me.
>
> Thanx.
>
> -----Original Message-----
> From: Sanjeeb.Sahoo@Sun.COM [mailto:Sanjeeb.Sahoo@Sun.COM] On Behalf
> Of Sahoo
> Sent: Friday, May 29, 2009 8:07 AM
> To: users@glassfish.dev.java.net
> Subject: Re: JNI/CompositeApp/Glassfish
>
> Martin,
>
> I am confused. What's your issue? In your first posting you mentioned
> that you were successful in running JNI code inside GlassFish except
> that you suspected some memory leak for which Chris suggested to use
> tools like hat. You were supposed to analyse the memory leak. Have you

> identified the cause? If yes, then tell us and tell us if it needs a
> fix in GF.
>
> I have failed to identify if you have any other issue in this email
> thread. Personally, I have not come across many use cases where a J2EE

> app uses JNI. It appears that the spec discourages use of JNI. See [1]

> for some discussion. So, over all, it should work with some
limitations.
>
> Thanks,
> Sahoo
>
> [1]
> http://www.theserverside.com/discussions/thread.tss?thread_id=14057
>
> Martin, Ray wrote:
>
>> i am readin' and scratchin' for JCA information - WOW. What a
>> complex
>>
>
>
>> convoluted mechanism to merely call a tiny piece of code.
>>
>> i have many Glassfish instances running a variety of things as SOA
>> nodes. One of the things that one of the Glassfish nodes must do is
>> run a mathematical algorithm called a bayesian net.
>>
>> Why should it matter that that one instance is not portable? So, it
>> must run on a specific hardware platform, who cares? All that is
>> necessary is for the classloader to function properly to allow this
>> particular non-portable code to run in a nice simplistic manner.
>>
>> But, no - i now am required to build my own EIS-like system to
>> contain
>>
>
>
>> a daemon process to listen for commands to run a small algorithm.
>> Then i need to create an adapter. Then i need to create a connector.
>>
>
>
>> Then i need to ... oh boy.
>>
>> And, there is something wrong with a system in which a Glassfish node

>> performs some specialty algorithm? Hmm - yep, i am too dumb to
>> understand that.
>>
>> ---------------------------------------------------------------------
>> -
>> --
>> *From:* Martin, Ray
>> *Sent:* Friday, May 29, 2009 6:22 AM
>> *To:* users@glassfish.dev.java.net
>> *Subject:* RE: RE: RE: JNI/CompositeApp/Glassfish
>>
>> i am too dumb to know that was a solution...
>>
>> ---------------------------------------------------------------------
>> -
>> --
>> *From:* Markus Karg [mailto:karg@quipsy.de]
>> *Sent:* Friday, May 29, 2009 6:14 AM
>> *To:* users@glassfish.dev.java.net
>> *Subject:* RE: RE: JNI/CompositeApp/Glassfish
>>
>> The idea of EJB is to have a portable application which runs on any
>> application server on any operating system on any hardware platform.
>> JNI works only with a particular operating system and hardware
>> platform. These two core ideas are absolutely not compatible. It just

>> makes no sense to use EJB directly with JNI. If native stuff is
>> needed
>>
>
>
>> in an enterprise application, it has to be provided in the form of a
>> JCA 1.5 adapter. This is the official Java EE solution to bind
>> portable applications (EJB) to platform-specific code (JNI). What
>> problem do you have with that?
>>
>>
>>
>> *From:* Martin, Ray [mailto:armart3@tycho.ncsc.mil]
>> *Sent:* Freitag, 29. Mai 2009 12:08
>> *To:* users@glassfish.dev.java.net
>> *Subject:* RE: JNI/CompositeApp/Glassfish
>>
>>
>>
>> Very smart people created JNI.
>>
>> Very smart people created EJB.
>>
>>
>>
>> These very smart people make sure that JNI cannot operate within EJB
>> -
>>
>
>
>> why would people do something like that?
>>
>>
>>
>> i have fuddled for months building a system around glassfish - now it

>> looks like i am back to ServiceMix, where i was a year ago
>>
>>
>>
>> ---------------------------------------------------------------------
>> -
>> --
>>
>> *From:* Martin, Ray
>> *Sent:* Thursday, May 28, 2009 12:54 PM
>> *To:* users@glassfish.dev.java.net
>> *Subject:* JNI/CompositeApp/Glassfish
>>
>> Does anyone have a JNI application running in Glassfish?
>>
>>
>>
>> I have a third party JNI app (Netica). It runs fine from the command

>> line.
>>
>>
>>
>> i have an EJBModule and a BPEL project added to a composite app. The

>> composite app is deployed to Glassfish and runs fine - receiving and
>> responding to SOAP message.
>>
>>
>>
>> i then add the JNI app to the EJBModule and deploy the composite app
>> to Glassfish.
>>
>>
>>
>> there are two SOAP messages to the composite app - setup and
activate.
>>
>>
>>
>> i issue the setup message - the request and response occur.
>>
>> i issue the activate message - the JNI app runs - all is good - the
>> results are stored in the database.
>>
>> after the JNI app should be completed, the memory usage starts to
>>
> climb.
>
>>
>>
>> any suggestions?
>>
>>
>
> ---------------------------------------------------------------------
> 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
>
>

---------------------------------------------------------------------
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


Markus Karg
RE: RE: Re: JNI/CompositeApp/Glassfish
Posted: Jun 1, 2009 8:58 AM   in response to: Martin, Ray
  Click to reply to this thread Reply

I do not know what exactly your JNI codes does or what you mean with
"assembly" (this term is not found in the Java EE specification), but be
assured that JNI itself is not the cause of your SOAP or memory
problems. It might be the case that the JNI-called code itself produces
that problem, but not JNI as an interface. Maybe your VM just runs out
of native RAM or handles (what has nothing to do with JNI itself)?

Regards
Markus

> -----Original Message-----
> From: Martin, Ray [mailto:armart3@tycho.ncsc.mil]
> Sent: Montag, 1. Juni 2009 17:44
> To: users@glassfish.dev.java.net
> Subject: RE: Re: JNI/CompositeApp/Glassfish
>
> This is just FYI:
>
> I wanted to see if I could get "the EJB" out of my problem space. I
do
> not know a a way to include a Java SE project into a composite app - a
> service assembly. So, I created a WebApp and copied all my code from
> my
> EJBModule project. I removed all EJB references and created my own
> EntityManager for persistence. I added the WebApp war file to the
> service assembly in place of the EJBModule. NetBeans 'wired' together
> the service assembly. I deployed what looks to me to be a POJO app to
> Glassfish.
>
> Making the call to the JNI causes severe memory leak. Additionally,
> which I had not mentioned prior, I cannot send any SOAP messages after
> calling the JNI. This inability to send follow-on SOAP messages
> invalidates my Glassfish show and tell.
>
> Anyway, this is just info. No response necessary. But, any useful
> advice would be appreciated.
>
> Thanx.
>
> -----Original Message-----
> From: Sanjeeb.Sahoo@Sun.COM [mailto:Sanjeeb.Sahoo@Sun.COM] On Behalf
Of
> Sahoo
> Sent: Friday, May 29, 2009 8:49 AM
> To: users@glassfish.dev.java.net
> Subject: Re: JNI/CompositeApp/Glassfish
>
> Just because the spec says "don't do it" does not necessarily mean "it
> will not work." I am not familiar with CompositeApps, so I can't
> comment
> on that. What I understand from your problem description is your main
> issue is to call JNI from an EJB. I don't understand why that will not
> work. Write a simple test program and see if it works. There are
> certain
> things that does not work when it comes to shared libraries. A shared
> library can;t be confined to namespace of a classloader, so if you
> deploy multiple same library multiple times, things may not work. But
> then, I don't think you are trying to do that.
>
> Secondly why do you care about memory leak if you are just showing
some
> feature? That can be independently addressed, no?
>
> Sahoo
>
> Martin, Ray wrote:
> > Yes, Mr. Chris suggested to use jmap and jhat to locate the leak.
In
> > my search for how to use those tools, I found that JNI is not
> supposed
>
> > to work in EJB. So, I said to myself "wow, I am trying to do stuff
> > that you are not even supposed to be doing. It does not really
matter
> > whether there appears to be a leak or not - the specs say don't do
> > it." I will spend many weeks on classloaders and jhat and jmap
> and...
>
> > I had a deadline to meet to show the great world of Glassfish SOA.
> >
> > I do not know how to deploy a POJO app (with a BPEL 'face') in a
> > composite app. If I knew that, I could call the JNI from the POJO
> > (staying out of that EJB world) and meet my deadline and put a smile
> > on my superiors faces. Then later, after my superiors agree that my
> > selection of Glassfish is marvelous, then I can look for memory
leaks
> > or whatever. But, right now, it's killing me.
> >
> > Thanx.
> >
> > -----Original Message-----
> > From: Sanjeeb.Sahoo@Sun.COM [mailto:Sanjeeb.Sahoo@Sun.COM] On Behalf
> > Of Sahoo
> > Sent: Friday, May 29, 2009 8:07 AM
> > To: users@glassfish.dev.java.net
> > Subject: Re: JNI/CompositeApp/Glassfish
> >
> > Martin,
> >
> > I am confused. What's your issue? In your first posting you
mentioned
> > that you were successful in running JNI code inside GlassFish except
> > that you suspected some memory leak for which Chris suggested to use
> > tools like hat. You were supposed to analyse the memory leak. Have
> you
>
> > identified the cause? If yes, then tell us and tell us if it needs a
> > fix in GF.
> >
> > I have failed to identify if you have any other issue in this email
> > thread. Personally, I have not come across many use cases where a
> J2EE
>
> > app uses JNI. It appears that the spec discourages use of JNI. See
> [1]
>
> > for some discussion. So, over all, it should work with some
> limitations.
> >
> > Thanks,
> > Sahoo
> >
> > [1]
> > http://www.theserverside.com/discussions/thread.tss?thread_id=14057
> >
> > Martin, Ray wrote:
> >
> >> i am readin' and scratchin' for JCA information - WOW. What a
> >> complex
> >>
> >
> >
> >> convoluted mechanism to merely call a tiny piece of code.
> >>
> >> i have many Glassfish instances running a variety of things as SOA
> >> nodes. One of the things that one of the Glassfish nodes must do
is
> >> run a mathematical algorithm called a bayesian net.
> >>
> >> Why should it matter that that one instance is not portable? So,
it
> >> must run on a specific hardware platform, who cares? All that is
> >> necessary is for the classloader to function properly to allow this
> >> particular non-portable code to run in a nice simplistic manner.
> >>
> >> But, no - i now am required to build my own EIS-like system to
> >> contain
> >>
> >
> >
> >> a daemon process to listen for commands to run a small algorithm.
> >> Then i need to create an adapter. Then i need to create a
> connector.
> >>
> >
> >
> >> Then i need to ... oh boy.
> >>
> >> And, there is something wrong with a system in which a Glassfish
> node
>
> >> performs some specialty algorithm? Hmm - yep, i am too dumb to
> >> understand that.
> >>
> >>
--------------------------------------------------------------------
> -
> >> -
> >> --
> >> *From:* Martin, Ray
> >> *Sent:* Friday, May 29, 2009 6:22 AM
> >> *To:* users@glassfish.dev.java.net
> >> *Subject:* RE: RE: RE: JNI/CompositeApp/Glassfish
> >>
> >> i am too dumb to know that was a solution...
> >>
> >>
--------------------------------------------------------------------
> -
> >> -
> >> --
> >> *From:* Markus Karg [mailto:karg@quipsy.de]
> >> *Sent:* Friday, May 29, 2009 6:14 AM
> >> *To:* users@glassfish.dev.java.net
> >> *Subject:* RE: RE: JNI/CompositeApp/Glassfish
> >>
> >> The idea of EJB is to have a portable application which runs on any
> >> application server on any operating system on any hardware
platform.
> >> JNI works only with a particular operating system and hardware
> >> platform. These two core ideas are absolutely not compatible. It
> just
>
> >> makes no sense to use EJB directly with JNI. If native stuff is
> >> needed
> >>
> >
> >
> >> in an enterprise application, it has to be provided in the form of
a
> >> JCA 1.5 adapter. This is the official Java EE solution to bind
> >> portable applications (EJB) to platform-specific code (JNI). What
> >> problem do you have with that?
> >>
> >>
> >>
> >> *From:* Martin, Ray [mailto:armart3@tycho.ncsc.mil]
> >> *Sent:* Freitag, 29. Mai 2009 12:08
> >> *To:* users@glassfish.dev.java.net
> >> *Subject:* RE: JNI/CompositeApp/Glassfish
> >>
> >>
> >>
> >> Very smart people created JNI.
> >>
> >> Very smart people created EJB.
> >>
> >>
> >>
> >> These very smart people make sure that JNI cannot operate within
EJB
> >> -
> >>
> >
> >
> >> why would people do something like that?
> >>
> >>
> >>
> >> i have fuddled for months building a system around glassfish - now
> it
>
> >> looks like i am back to ServiceMix, where i was a year ago
> >>
> >>
> >>
> >>
--------------------------------------------------------------------
> -
> >> -
> >> --
> >>
> >> *From:* Martin, Ray
> >> *Sent:* Thursday, May 28, 2009 12:54 PM
> >> *To:* users@glassfish.dev.java.net
> >> *Subject:* JNI/CompositeApp/Glassfish
> >>
> >> Does anyone have a JNI application running in Glassfish?
> >>
> >>
> >>
> >> I have a third party JNI app (Netica). It runs fine from the
> command
>
> >> line.
> >>
> >>
> >>
> >> i have an EJBModule and a BPEL project added to a composite app.
> The
>
> >> composite app is deployed to Glassfish and runs fine - receiving
and
> >> responding to SOAP message.
> >>
> >>
> >>
> >> i then add the JNI app to the EJBModule and deploy the composite
app
> >> to Glassfish.
> >>
> >>
> >>
> >> there are two SOAP messages to the composite app - setup and
> activate.
> >>
> >>
> >>
> >> i issue the setup message - the request and response occur.
> >>
> >> i issue the activate message - the JNI app runs - all is good - the
> >> results are stored in the database.
> >>
> >> after the JNI app should be completed, the memory usage starts to
> >>
> > climb.
> >
> >>
> >>
> >> any suggestions?
> >>
> >>
> >
> >
---------------------------------------------------------------------
> > 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
> >
> >
>
> ---------------------------------------------------------------------
> 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


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


Peter Williams
Re: JNI/CompositeApp/Glassfish
Posted: Jun 1, 2009 9:39 PM   in response to: Martin, Ray
  Click to reply to this thread Reply

This is kind of an FYI or FWIW.

I haven't implemented JNI code in a very long time. But back when I
did, it was extremely easy to write code leaked memory if you weren't
extremely careful with allocations involving objects allocated on the
native side and objects passed across the interface (regardless of where
they were allocated) and what was done with the on the other side. IIRC
the JDK has very specific instructions on what you can and can't do and
how to handle these issues. If you know what objects are leaking, find
out where they were allocated and what is being done with them
(especially if they are java objects being passed through JNI -- you may
be doing something in the native code that is damaging the reference
counts).

-Peter

Martin, Ray wrote:
> This is just FYI:
>
> I wanted to see if I could get "the EJB" out of my problem space. I do
> not know a a way to include a Java SE project into a composite app - a
> service assembly. So, I created a WebApp and copied all my code from my
> EJBModule project. I removed all EJB references and created my own
> EntityManager for persistence. I added the WebApp war file to the
> service assembly in place of the EJBModule. NetBeans 'wired' together
> the service assembly. I deployed what looks to me to be a POJO app to
> Glassfish.
>
> Making the call to the JNI causes severe memory leak. Additionally,
> which I had not mentioned prior, I cannot send any SOAP messages after
> calling the JNI. This inability to send follow-on SOAP messages
> invalidates my Glassfish show and tell.
>
> Anyway, this is just info. No response necessary. But, any useful
> advice would be appreciated.
>
> Thanx.
>
> -----Original Message-----
> From: Sanjeeb.Sahoo@Sun.COM [mailto:Sanjeeb.Sahoo@Sun.COM] On Behalf Of
> Sahoo
> Sent: Friday, May 29, 2009 8:49 AM
> To: users@glassfish.dev.java.net
> Subject: Re: JNI/CompositeApp/Glassfish
>
> Just because the spec says "don't do it" does not necessarily mean "it
> will not work." I am not familiar with CompositeApps, so I can't comment
> on that. What I understand from your problem description is your main
> issue is to call JNI from an EJB. I don't understand why that will not
> work. Write a simple test program and see if it works. There are certain
> things that does not work when it comes to shared libraries. A shared
> library can;t be confined to namespace of a classloader, so if you
> deploy multiple same library multiple times, things may not work. But
> then, I don't think you are trying to do that.
>
> Secondly why do you care about memory leak if you are just showing some
> feature? That can be independently addressed, no?
>
> Sahoo
>
> Martin, Ray wrote:
>
>> Yes, Mr. Chris suggested to use jmap and jhat to locate the leak. In
>> my search for how to use those tools, I found that JNI is not supposed
>>
>
>
>> to work in EJB. So, I said to myself "wow, I am trying to do stuff
>> that you are not even supposed to be doing. It does not really matter
>> whether there appears to be a leak or not - the specs say don't do
>> it." I will spend many weeks on classloaders and jhat and jmap and...
>>
>
>
>> I had a deadline to meet to show the great world of Glassfish SOA.
>>
>> I do not know how to deploy a POJO app (with a BPEL 'face') in a
>> composite app. If I knew that, I could call the JNI from the POJO
>> (staying out of that EJB world) and meet my deadline and put a smile
>> on my superiors faces. Then later, after my superiors agree that my
>> selection of Glassfish is marvelous, then I can look for memory leaks
>> or whatever. But, right now, it's killing me.
>>
>> Thanx.
>>
>> -----Original Message-----
>> From: Sanjeeb.Sahoo@Sun.COM [mailto:Sanjeeb.Sahoo@Sun.COM] On Behalf
>> Of Sahoo
>> Sent: Friday, May 29, 2009 8:07 AM
>> To: users@glassfish.dev.java.net
>> Subject: Re: JNI/CompositeApp/Glassfish
>>
>> Martin,
>>
>> I am confused. What's your issue? In your first posting you mentioned
>> that you were successful in running JNI code inside GlassFish except
>> that you suspected some memory leak for which Chris suggested to use
>> tools like hat. You were supposed to analyse the memory leak. Have you
>>
>
>
>> identified the cause? If yes, then tell us and tell us if it needs a
>> fix in GF.
>>
>> I have failed to identify if you have any other issue in this email
>> thread. Personally, I have not come across many use cases where a J2EE
>>
>
>
>> app uses JNI. It appears that the spec discourages use of JNI. See [1]
>>
>
>
>> for some discussion. So, over all, it should work with some
>>
> limitations.
>
>> Thanks,
>> Sahoo
>>
>> [1]
>> http://www.theserverside.com/discussions/thread.tss?thread_id=14057
>>
>> Martin, Ray wrote:
>>
>>
>>> i am readin' and scratchin' for JCA information - WOW. What a
>>> complex
>>>
>>>
>>
>>
>>> convoluted mechanism to merely call a tiny piece of code.
>>>
>>> i have many Glassfish instances running a variety of things as SOA
>>> nodes. One of the things that one of the Glassfish nodes must do is
>>> run a mathematical algorithm called a bayesian net.
>>>
>>> Why should it matter that that one instance is not portable? So, it
>>> must run on a specific hardware platform, who cares? All that is
>>> necessary is for the classloader to function properly to allow this
>>> particular non-portable code to run in a nice simplistic manner.
>>>
>>> But, no - i now am required to build my own EIS-like system to
>>> contain
>>>
>>>
>>
>>
>>> a daemon process to listen for commands to run a small algorithm.
>>> Then i need to create an adapter. Then i need to create a connector.
>>>
>>>
>>
>>
>>> Then i need to ... oh boy.
>>>
>>> And, there is something wrong with a system in which a Glassfish node
>>>
>
>
>>> performs some specialty algorithm? Hmm - yep, i am too dumb to
>>> understand that.
>>>
>>> ---------------------------------------------------------------------
>>> -
>>> --
>>> *From:* Martin, Ray
>>> *Sent:* Friday, May 29, 2009 6:22 AM
>>> *To:* users@glassfish.dev.java.net
>>> *Subject:* RE: RE: RE: JNI/CompositeApp/Glassfish
>>>
>>> i am too dumb to know that was a solution...
>>>
>>> ---------------------------------------------------------------------
>>> -
>>> --
>>> *From:* Markus Karg [mailto:karg@quipsy.de]
>>> *Sent:* Friday, May 29, 2009 6:14 AM
>>> *To:* users@glassfish.dev.java.net
>>> *Subject:* RE: RE: JNI/CompositeApp/Glassfish
>>>
>>> The idea of EJB is to have a portable application which runs on any
>>> application server on any operating system on any hardware platform.
>>> JNI works only with a particular operating system and hardware
>>> platform. These two core ideas are absolutely not compatible. It just
>>>
>
>
>>> makes no sense to use EJB directly with JNI. If native stuff is
>>> needed
>>>
>>>
>>
>>
>>> in an enterprise application, it has to be provided in the form of a
>>> JCA 1.5 adapter. This is the official Java EE solution to bind
>>> portable applications (EJB) to platform-specific code (JNI). What
>>> problem do you have with that?
>>>
>>>
>>>
>>> *From:* Martin, Ray [mailto:armart3@tycho.ncsc.mil]
>>> *Sent:* Freitag, 29. Mai 2009 12:08
>>> *To:* users@glassfish.dev.java.net
>>> *Subject:* RE: JNI/CompositeApp/Glassfish
>>>
>>>
>>>
>>> Very smart people created JNI.
>>>
>>> Very smart people created EJB.
>>>
>>>
>>>
>>> These very smart people make sure that JNI cannot operate within EJB
>>> -
>>>
>>>
>>
>>
>>> why would people do something like that?
>>>
>>>
>>>
>>> i have fuddled for months building a system around glassfish - now it
>>>
>
>
>>> looks like i am back to ServiceMix, where i was a year ago
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> -
>>> --
>>>
>>> *From:* Martin, Ray
>>> *Sent:* Thursday, May 28, 2009 12:54 PM
>>> *To:* users@glassfish.dev.java.net
>>> *Subject:* JNI/CompositeApp/Glassfish
>>>
>>> Does anyone have a JNI application running in Glassfish?
>>>
>>>
>>>
>>> I have a third party JNI app (Netica). It runs fine from the command
>>>
>
>
>>> line.
>>>
>>>
>>>
>>> i have an EJBModule and a BPEL project added to a composite app. The
>>>
>
>
>>> composite app is deployed to Glassfish and runs fine - receiving and
>>> responding to SOAP message.
>>>
>>>
>>>
>>> i then add the JNI app to the EJBModule and deploy the composite app
>>> to Glassfish.
>>>
>>>
>>>
>>> there are two SOAP messages to the composite app - setup and
>>>
> activate.
>
>>>
>>>
>>> i issue the setup message - the request and response occur.
>>>
>>> i issue the activate message - the JNI app runs - all is good - the
>>> results are stored in the database.
>>>
>>> after the JNI app should be completed, the memory usage starts to
>>>
>>>
>> climb.
>>
>>
>>>
>>>
>>> any suggestions?
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>> 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
>>
>>
>>
>
> ---------------------------------------------------------------------
> 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
>
>


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


Markus Karg
RE: Re: JNI/CompositeApp/Glassfish
Posted: Jun 1, 2009 11:24 PM   in response to: Peter Williams
  Click to reply to this thread Reply

Just what I said: It is not JNI's or GlassFish's fault, but it is the
fult of the JNI programmer that implemented that stuff. So the question
is not GlassFish related.

Regards
Markus

> -----Original Message-----
> From: Pete.Williams@Sun.COM [mailto:Pete.Williams@Sun.COM]
> Sent: Dienstag, 2. Juni 2009 06:39
> To: users@glassfish.dev.java.net
> Subject: Re: JNI/CompositeApp/Glassfish
>
> This is kind of an FYI or FWIW.
>
> I haven't implemented JNI code in a very long time. But back when I
> did, it was extremely easy to write code leaked memory if you weren't
> extremely careful with allocations involving objects allocated on the
> native side and objects passed across the interface (regardless of
> where
> they were allocated) and what was done with the on the other side.
> IIRC
> the JDK has very specific instructions on what you can and can't do
and
> how to handle these issues. If you know what objects are leaking,
find
> out where they were allocated and what is being done with them
> (especially if they are java objects being passed through JNI -- you
> may
> be doing something in the native code that is damaging the reference
> counts).
>
> -Peter
>
> Martin, Ray wrote:
> > This is just FYI:
> >
> > I wanted to see if I could get "the EJB" out of my problem space. I
> do
> > not know a a way to include a Java SE project into a composite app -
> a
> > service assembly. So, I created a WebApp and copied all my code
from
> my
> > EJBModule project. I removed all EJB references and created my own
> > EntityManager for persistence. I added the WebApp war file to the
> > service assembly in place of the EJBModule. NetBeans 'wired'
> together
> > the service assembly. I deployed what looks to me to be a POJO app
> to
> > Glassfish.
> >
> > Making the call to the JNI causes severe memory leak. Additionally,
> > which I had not mentioned prior, I cannot send any SOAP messages
> after
> > calling the JNI. This inability to send follow-on SOAP messages
> > invalidates my Glassfish show and tell.
> >
> > Anyway, this is just info. No response necessary. But, any useful
> > advice would be appreciated.
> >
> > Thanx.
> >
> > -----Original Message-----
> > From: Sanjeeb.Sahoo@Sun.COM [mailto:Sanjeeb.Sahoo@Sun.COM] On Behalf
> Of
> > Sahoo
> > Sent: Friday, May 29, 2009 8:49 AM
> > To: users@glassfish.dev.java.net
> > Subject: Re: JNI/CompositeApp/Glassfish
> >
> > Just because the spec says "don't do it" does not necessarily mean
> "it
> > will not work." I am not familiar with CompositeApps, so I can't
> comment
> > on that. What I understand from your problem description is your
main
> > issue is to call JNI from an EJB. I don't understand why that will
> not
> > work. Write a simple test program and see if it works. There are
> certain
> > things that does not work when it comes to shared libraries. A
shared
> > library can;t be confined to namespace of a classloader, so if you
> > deploy multiple same library multiple times, things may not work.
But
> > then, I don't think you are trying to do that.
> >
> > Secondly why do you care about memory leak if you are just showing
> some
> > feature? That can be independently addressed, no?
> >
> > Sahoo
> >
> > Martin, Ray wrote:
> >
> >> Yes, Mr. Chris suggested to use jmap and jhat to locate the leak.
> In
> >> my search for how to use those tools, I found that JNI is not
> supposed
> >>
> >
> >
> >> to work in EJB. So, I said to myself "wow, I am trying to do stuff
> >> that you are not even supposed to be doing. It does not really
> matter
> >> whether there appears to be a leak or not - the specs say don't do
> >> it." I will spend many weeks on classloaders and jhat and jmap
> and...
> >>
> >
> >
> >> I had a deadline to meet to show the great world of Glassfish SOA.
> >>
> >> I do not know how to deploy a POJO app (with a BPEL 'face') in a
> >> composite app. If I knew that, I could call the JNI from the POJO
> >> (staying out of that EJB world) and meet my deadline and put a
smile
> >> on my superiors faces. Then later, after my superiors agree that
my
> >> selection of Glassfish is marvelous, then I can look for memory
> leaks
> >> or whatever. But, right now, it's killing me.
> >>
> >> Thanx.
> >>
> >> -----Original Message-----
> >> From: Sanjeeb.Sahoo@Sun.COM [mailto:Sanjeeb.Sahoo@Sun.COM] On
Behalf
> >> Of Sahoo
> >> Sent: Friday, May 29, 2009 8:07 AM
> >> To: users@glassfish.dev.java.net
> >> Subject: Re: JNI/CompositeApp/Glassfish
> >>
> >> Martin,
> >>
> >> I am confused. What's your issue? In your first posting you
> mentioned
> >> that you were successful in running JNI code inside GlassFish
except
> >> that you suspected some memory leak for which Chris suggested to
use
> >> tools like hat. You were supposed to analyse the memory leak. Have
> you
> >>
> >
> >
> >> identified the cause? If yes, then tell us and tell us if it needs
a
> >> fix in GF.
> >>
> >> I have failed to identify if you have any other issue in this email
> >> thread. Personally, I have not come across many use cases where a
> J2EE
> >>
> >
> >
> >> app uses JNI. It appears that the spec discourages use of JNI. See
> [1]
> >>
> >
> >
> >> for some discussion. So, over all, it should work with some
> >>
> > limitations.
> >
> >> Thanks,
> >> Sahoo
> >>
> >> [1]
> >> http://www.theserverside.com/discussions/thread.tss?thread_id=14057
> >>
> >> Martin, Ray wrote:
> >>
> >>
> >>> i am readin' and scratchin' for JCA information - WOW. What a
> >>> complex
> >>>
> >>>
> >>
> >>
> >>> convoluted mechanism to merely call a tiny piece of code.
> >>>
> >>> i have many Glassfish instances running a variety of things as SOA
> >>> nodes. One of the things that one of the Glassfish nodes must do
> is
> >>> run a mathematical algorithm called a bayesian net.
> >>>
> >>> Why should it matter that that one instance is not portable? So,
> it
> >>> must run on a specific hardware platform, who cares? All that is
> >>> necessary is for the classloader to function properly to allow
this
> >>> particular non-portable code to run in a nice simplistic manner.
> >>>
> >>> But, no - i now am required to build my own EIS-like system to
> >>> contain
> >>>
> >>>
> >>
> >>
> >>> a daemon process to listen for commands to run a small algorithm.
> >>> Then i need to create an adapter. Then i need to create a
> connector.
> >>>
> >>>
> >>
> >>
> >>> Then i need to ... oh boy.
> >>>
> >>> And, there is something wrong with a system in which a Glassfish
> node
> >>>
> >
> >
> >>> performs some specialty algorithm? Hmm - yep, i am too dumb to
> >>> understand that.
> >>>
> >>>
-------------------------------------------------------------------
> --
> >>> -
> >>> --
> >>> *From:* Martin, Ray
> >>> *Sent:* Friday, May 29, 2009 6:22 AM
> >>> *To:* users@glassfish.dev.java.net
> >>> *Subject:* RE: RE: RE: JNI/CompositeApp/Glassfish
> >>>
> >>> i am too dumb to know that was a solution...
> >>>
> >>>
-------------------------------------------------------------------
> --
> >>> -
> >>> --
> >>> *From:* Markus Karg [mailto:karg@quipsy.de]
> >>> *Sent:* Friday, May 29, 2009 6:14 AM
> >>> *To:* users@glassfish.dev.java.net
> >>> *Subject:* RE: RE: JNI/CompositeApp/Glassfish
> >>>
> >>> The idea of EJB is to have a portable application which runs on
any
> >>> application server on any operating system on any hardware
> platform.
> >>> JNI works only with a particular operating system and hardware
> >>> platform. These two core ideas are absolutely not compatible. It
> just
> >>>
> >
> >
> >>> makes no sense to use EJB directly with JNI. If native stuff is
> >>> needed
> >>>
> >>>
> >>
> >>
> >>> in an enterprise application, it has to be provided in the form of
> a
> >>> JCA 1.5 adapter. This is the official Java EE solution to bind
> >>> portable applications (EJB) to platform-specific code (JNI). What
> >>> problem do you have with that?
> >>>
> >>>
> >>>
> >>> *From:* Martin, Ray [mailto:armart3@tycho.ncsc.mil]
> >>> *Sent:* Freitag, 29. Mai 2009 12:08
> >>> *To:* users@glassfish.dev.java.net
> >>> *Subject:* RE: JNI/CompositeApp/Glassfish
> >>>
> >>>
> >>>
> >>> Very smart people created JNI.
> >>>
> >>> Very smart people created EJB.
> >>>
> >>>
> >>>
> >>> These very smart people make sure that JNI cannot operate within
> EJB
> >>> -
> >>>
> >>>
> >>
> >>
> >>> why would people do something like that?
> >>>
> >>>
> >>>
> >>> i have fuddled for months building a system around glassfish - now
> it
> >>>
> >
> >
> >>> looks like i am back to ServiceMix, where i was a year ago
> >>>
> >>>
> >>>
> >>>
-------------------------------------------------------------------
> --
> >>> -
> >>> --
> >>>
> >>> *From:* Martin, Ray
> >>> *Sent:* Thursday, May 28, 2009 12:54 PM
> >>> *To:* users@glassfish.dev.java.net
> >>> *Subject:* JNI/CompositeApp/Glassfish
> >>>
> >>> Does anyone have a JNI application running in Glassfish?
> >>>
> >>>
> >>>
> >>> I have a third party JNI app (Netica). It runs fine from the
> command
> >>>
> >
> >
> >>> line.
> >>>
> >>>
> >>>
> >>> i have an EJBModule and a BPEL project added to a composite app.
> The
> >>>
> >
> >
> >>> composite app is deployed to Glassfish and runs fine - receiving
> and
> >>> responding to SOAP message.
> >>>
> >>>
> >>>
> >>> i then add the JNI app to the EJBModule and deploy the composite
> app
> >>> to Glassfish.
> >>>
> >>>
> >>>
> >>> there are two SOAP messages to the composite app - setup and
> >>>
> > activate.
> >
> >>>
> >>>
> >>> i issue the setup message - the request and response occur.
> >>>
> >>> i issue the activate message - the JNI app runs - all is good -
the
> >>> results are stored in the database.
> >>>
> >>> after the JNI app should be completed, the memory usage starts to
> >>>
> >>>
> >> climb.
> >>
> >>
> >>>
> >>>
> >>> any suggestions?
> >>>
> >>>
> >>>
> >>
--------------------------------------------------------------------
> -
> >> 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
> >>
> >>
> >>
> >
> >
---------------------------------------------------------------------
> > 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
> >
> >
>
>
> ---------------------------------------------------------------------
> 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


Markus Karg
RE: RE: Re: JNI/CompositeApp/Glassfish
Posted: May 29, 2009 6:17 AM   in response to: Martin, Ray
  Click to reply to this thread Reply

If all you need is to run a BPEL wrapper around a JNI call then you
should have a look at JAX-WS, included in Java SE 6. No need for any
enterprise stuff at all.

> -----Original Message-----
> From: Martin, Ray [mailto:armart3@tycho.ncsc.mil]
> Sent: Freitag, 29. Mai 2009 14:22
> To: users@glassfish.dev.java.net
> Subject: RE: Re: JNI/CompositeApp/Glassfish
>
> Yes, Mr. Chris suggested to use jmap and jhat to locate the leak. In
> my
> search for how to use those tools, I found that JNI is not supposed to
> work in EJB. So, I said to myself "wow, I am trying to do stuff that
> you are not even supposed to be doing. It does not really matter
> whether
> there appears to be a leak or not - the specs say don't do it." I
will
> spend many weeks on classloaders and jhat and jmap and... I had a
> deadline to meet to show the great world of Glassfish SOA.
>
> I do not know how to deploy a POJO app (with a BPEL 'face') in a
> composite app. If I knew that, I could call the JNI from the POJO
> (staying out of that EJB world) and meet my deadline and put a smile
on
> my superiors faces. Then later, after my superiors agree that my
> selection of Glassfish is marvelous, then I can look for memory leaks
> or
> whatever. But, right now, it's killing me.
>
> Thanx.
>
> -----Original Message-----
> From: Sanjeeb.Sahoo@Sun.COM [mailto:Sanjeeb.Sahoo@Sun.COM] On Behalf
Of
> Sahoo
> Sent: Friday, May 29, 2009 8:07 AM
> To: users@glassfish.dev.java.net
> Subject: Re: JNI/CompositeApp/Glassfish
>
> Martin,
>
> I am confused. What's your issue? In your first posting you mentioned
> that you were successful in running JNI code inside GlassFish except
> that you suspected some memory leak for which Chris suggested to use
> tools like hat. You were supposed to analyse the memory leak. Have you
> identified the cause? If yes, then tell us and tell us if it needs a
> fix
> in GF.
>
> I have failed to identify if you have any other issue in this email
> thread. Personally, I have not come across many use cases where a J2EE
> app uses JNI. It appears that the spec discourages use of JNI. See [1]
> for some discussion. So, over all, it should work with some
> limitations.
>
> Thanks,
> Sahoo
>
> [1]
http://www.theserverside.com/discussions/thread.tss?thread_id=14057
>
> Martin, Ray wrote:
> > i am readin' and scratchin' for JCA information - WOW. What a
> complex
>
> > convoluted mechanism to merely call a tiny piece of code.
> >
> > i have many Glassfish instances running a variety of things as SOA
> > nodes. One of the things that one of the Glassfish nodes must do is
> > run a mathematical algorithm called a bayesian net.
> >
> > Why should it matter that that one instance is not portable? So, it
> > must run on a specific hardware platform, who cares? All that is
> > necessary is for the classloader to function properly to allow this
> > particular non-portable code to run in a nice simplistic manner.
> >
> > But, no - i now am required to build my own EIS-like system to
> contain
>
> > a daemon process to listen for commands to run a small algorithm.
> > Then i need to create an adapter. Then i need to create a
connector.
>
> > Then i need to ... oh boy.
> >
> > And, there is something wrong with a system in which a Glassfish
node
> > performs some specialty algorithm? Hmm - yep, i am too dumb to
> > understand that.
> >
> >
---------------------------------------------------------------------
> -
> > --
> > *From:* Martin, Ray
> > *Sent:* Friday, May 29, 2009 6:22 AM
> > *To:* users@glassfish.dev.java.net
> > *Subject:* RE: RE: RE: JNI/CompositeApp/Glassfish
> >
> > i am too dumb to know that was a solution...
> >
> >
---------------------------------------------------------------------
> -
> > --
> > *From:* Markus Karg [mailto:karg@quipsy.de]
> > *Sent:* Friday, May 29, 2009 6:14 AM
> > *To:* users@glassfish.dev.java.net
> > *Subject:* RE: RE: JNI/CompositeApp/Glassfish
> >
> > The idea of EJB is to have a portable application which runs on any
> > application server on any operating system on any hardware platform.
> > JNI works only with a particular operating system and hardware
> > platform. These two core ideas are absolutely not compatible. It
just
> > makes no sense to use EJB directly with JNI. If native stuff is
> needed
>
> > in an enterprise application, it has to be provided in the form of a
> > JCA 1.5 adapter. This is the official Java EE solution to bind
> > portable applications (EJB) to platform-specific code (JNI). What
> > problem do you have with that?
> >
> >
> >
> > *From:* Martin, Ray [mailto:armart3@tycho.ncsc.mil]
> > *Sent:* Freitag, 29. Mai 2009 12:08
> > *To:* users@glassfish.dev.java.net
> > *Subject:* RE: JNI/CompositeApp/Glassfish
> >
> >
> >
> > Very smart people created JNI.
> >
> > Very smart people created EJB.
> >
> >
> >
> > These very smart people make sure that JNI cannot operate within EJB
> -
>
> > why would people do something like that?
> >
> >
> >
> > i have fuddled for months building a system around glassfish - now
it
> > looks like i am back to ServiceMix, where i was a year ago
> >
> >
> >
> >
---------------------------------------------------------------------
> -
> > --
> >
> > *From:* Martin, Ray
> > *Sent:* Thursday, May 28, 2009 12:54 PM
> > *To:* users@glassfish.dev.java.net
> > *Subject:* JNI/CompositeApp/Glassfish
> >
> > Does anyone have a JNI application running in Glassfish?
> >
> >
> >
> > I have a third party JNI app (Netica). It runs fine from the
command
> > line.
> >
> >
> >
> > i have an EJBModule and a BPEL project added to a composite app.
The
> > composite app is deployed to Glassfish and runs fine - receiving and
> > responding to SOAP message.
> >
> >
> >
> > i then add the JNI app to the EJBModule and deploy the composite app
> > to Glassfish.
> >
> >
> >
> > there are two SOAP messages to the composite app - setup and
> activate.
> >
> >
> >
> > i issue the setup message - the request and response occur.
> >
> > i issue the activate message - the JNI app runs - all is good - the
> > results are stored in the database.
> >
> > after the JNI app should be completed, the memory usage starts to
> climb.
> >
> >
> >
> > any suggestions?
> >
>
> ---------------------------------------------------------------------
> 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


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


Martin, Ray
RE: RE: RE: Re: JNI/CompositeApp/Glassfish
Posted: May 29, 2009 7:14 AM   in response to: Markus Karg
  Click to reply to this thread Reply

Yea - I hear you. I am running around in circles right now trying to
find a temporary solution.

I was, in times past, of the opinion to steer clear of Glassfish. But,
I have since drank the cool-aid - I now want ALL my SOA nodes to be
Glassfish. Glassfish means a lot of different things. At one moment in
time, Glassfish means one thing, in another moment in time Glassfish has
another meaning. But, for me, all cases have the meaning of a grid of
SOA nodes. SOA nodes? Yes, Sir. How else but JAX-WS? So, for me, ALL
my Glassfish instances hava a 'JAX-WS port' (some have several).

So, people, far smarter than I, have built a container with SOA 'faces'.
They have tested. They have reduced the footprint. They have systemic
qualities. They have flexibility that allows for different uses -
sometimes running J2EE stacks, sometimes running EJBModules, sometimes
running IEP, sometimes BPEL - but, no matter, for me, all have 'JAX-WS
ports'. It is called Glassfish. And, in the face of all of that, someone
suggests "just go make your own container" - a simple container, but a
container none-the-less. Not being your brightest boy - this just blows
my mind.

When the system starts up, dozens (today - hundreds to thousands,
tomorrow)of Glassfish nodes light up. The nodes are instructed to load
their behavior. Processing begins - as needs change, bottle necks are
located, the system is further tuned - nodes are added and behavior is
loaded at the node. To enable this type of system, we are always
looking for commonality - reduction in variability while maintaining
flexibility. Selecting a common container is important. I hung my hat
on Glassfish. Can I run off and create my own container - yea - might
do that. But, first, I look for that common factor. If it is not
attainable, then I look for options. Several options have been provided
- and, I appreciate all assistance that has been provided. JCA, JAX-WS
has been suggested. Of course, there are sockets. And there is JMS.
All require a container (minimally, a listener) at the endpoint - too
bad that container cannot be a Glassfish. I know that that container
can be a ServiceMix, but I had my heels dug in, not wanting to go that
direction. I will use a container before I write my own.

So, if my superiors do not give me a pink ticket for not meeting my
deadline, I will have multiple of these "JNI nodes" in my SOA grid. Now
Glassfish has JMX for monitoring. There is a DAS if you cluster. There
is Shoal coming along. But, my little decrepit JNI nodes that I create
will not allow for system awareness. They are warts on my system that
will plague me forever. Thus, the reason why I want all processing
nodes to live within Glassfish.

So, I am between a rock and a hard place.

I appreciate the assistance - you may have saved my job (if I can get
one of the options working before time runs out). Thanx.


-----Original Message-----
From: Markus Karg [mailto:karg@quipsy.de]
Sent: Friday, May 29, 2009 9:18 AM
To: users@glassfish.dev.java.net
Subject: RE: RE: Re: JNI/CompositeApp/Glassfish

If all you need is to run a BPEL wrapper around a JNI call then you
should have a look at JAX-WS, included in Java SE 6. No need for any
enterprise stuff at all.

> -----Original Message-----
> From: Martin, Ray [mailto:armart3@tycho.ncsc.mil]
> Sent: Freitag, 29. Mai 2009 14:22
> To: users@glassfish.dev.java.net
> Subject: RE: Re: JNI/CompositeApp/Glassfish
>
> Yes, Mr. Chris suggested to use jmap and jhat to locate the leak. In
> my search for how to use those tools, I found that JNI is not supposed

> to work in EJB. So, I said to myself "wow, I am trying to do stuff
> that you are not even supposed to be doing. It does not really matter
> whether there appears to be a leak or not - the specs say don't do
> it." I
will
> spend many weeks on classloaders and jhat and jmap and... I had a
> deadline to meet to show the great world of Glassfish SOA.
>
> I do not know how to deploy a POJO app (with a BPEL 'face') in a
> composite app. If I knew that, I could call the JNI from the POJO
> (staying out of that EJB world) and meet my deadline and put a smile
on
> my superiors faces. Then later, after my superiors agree that my
> selection of Glassfish is marvelous, then I can look for memory leaks
> or whatever. But, right now, it's killing me.
>
> Thanx.
>
> -----Original Message-----
> From: Sanjeeb.Sahoo@Sun.COM [mailto:Sanjeeb.Sahoo@Sun.COM] On Behalf
Of
> Sahoo
> Sent: Friday, May 29, 2009 8:07 AM
> To: users@glassfish.dev.java.net
> Subject: Re: JNI/CompositeApp/Glassfish
>
> Martin,
>
> I am confused. What's your issue? In your first posting you mentioned
> that you were successful in running JNI code inside GlassFish except
> that you suspected some memory leak for which Chris suggested to use
> tools like hat. You were supposed to analyse the memory leak. Have you

> identified the cause? If yes, then tell us and tell us if it needs a
> fix in GF.
>
> I have failed to identify if you have any other issue in this email
> thread. Personally, I have not come across many use cases where a J2EE

> app uses JNI. It appears that the spec discourages use of JNI. See [1]

> for some discussion. So, over all, it should work with some
> limitations.
>
> Thanks,
> Sahoo
>
> [1]
http://www.theserverside.com/discussions/thread.tss?thread_id=14057
>
> Martin, Ray wrote:
> > i am readin' and scratchin' for JCA information - WOW. What a
> complex
>
> > convoluted mechanism to merely call a tiny piece of code.
> >
> > i have many Glassfish instances running a variety of things as SOA
> > nodes. One of the things that one of the Glassfish nodes must do is

> > run a mathematical algorithm called a bayesian net.
> >
> > Why should it matter that that one instance is not portable? So, it

> > must run on a specific hardware platform, who cares? All that is
> > necessary is for the classloader to function properly to allow this
> > particular non-portable code to run in a nice simplistic manner.
> >
> > But, no - i now am required to build my own EIS-like system to
> contain
>
> > a daemon process to listen for commands to run a small algorithm.
> > Then i need to create an adapter. Then i need to create a
connector.
>
> > Then i need to ... oh boy.
> >
> > And, there is something wrong with a system in which a Glassfish
node
> > performs some specialty algorithm? Hmm - yep, i am too dumb to
> > understand that.
> >
> >
---------------------------------------------------------------------
> -
> > --
> > *From:* Martin, Ray
> > *Sent:* Friday, May 29, 2009 6:22 AM
> > *To:* users@glassfish.dev.java.net
> > *Subject:* RE: RE: RE: JNI/CompositeApp/Glassfish
> >
> > i am too dumb to know that was a solution...
> >
> >
---------------------------------------------------------------------
> -
> > --
> > *From:* Markus Karg [mailto:karg@quipsy.de]
> > *Sent:* Friday, May 29, 2009 6:14 AM
> > *To:* users@glassfish.dev.java.net
> > *Subject:* RE: RE: JNI/CompositeApp/Glassfish
> >
> > The idea of EJB is to have a portable application which runs on any
> > application server on any operating system on any hardware platform.
> > JNI works only with a particular operating system and hardware
> > platform. These two core ideas are absolutely not compatible. It
just
> > makes no sense to use EJB directly with JNI. If native stuff is
> needed
>
> > in an enterprise application, it has to be provided in the form of a

> > JCA 1.5 adapter. This is the official Java EE solution to bind
> > portable applications (EJB) to platform-specific code (JNI). What
> > problem do you have with that?
> >
> >
> >
> > *From:* Martin, Ray [mailto:armart3@tycho.ncsc.mil]
> > *Sent:* Freitag, 29. Mai 2009 12:08
> > *To:* users@glassfish.dev.java.net
> > *Subject:* RE: JNI/CompositeApp/Glassfish
> >
> >
> >
> > Very smart people created JNI.
> >
> > Very smart people created EJB.
> >
> >
> >
> > These very smart people make sure that JNI cannot operate within EJB
> -
>
> > why would people do something like that?
> >
> >
> >
> > i have fuddled for months building a system around glassfish - now
it
> > looks like i am back to ServiceMix, where i was a year ago
> >
> >
> >
> >
---------------------------------------------------------------------
> -
> > --
> >
> > *From:* Martin, Ray
> > *Sent:* Thursday, May 28, 2009 12:54 PM
> > *To:* users@glassfish.dev.java.net
> > *Subject:* JNI/CompositeApp/Glassfish
> >
> > Does anyone have a JNI application running in Glassfish?
> >
> >
> >
> > I have a third party JNI app (Netica). It runs fine from the
command
> > line.
> >
> >
> >
> > i have an EJBModule and a BPEL project added to a composite app.
The
> > composite app is deployed to Glassfish and runs fine - receiving and

> > responding to SOAP message.
> >
> >
> >
> > i then add the JNI app to the EJBModule and deploy the composite app

> > to Glassfish.
> >
> >
> >
> > there are two SOAP messages to the composite app - setup and
> activate.
> >
> >
> >
> > i issue the setup message - the request and response occur.
> >
> > i issue the activate message - the JNI app runs - all is good - the
> > results are stored in the database.
> >
> > after the JNI app should be completed, the memory usage starts to
> climb.
> >
> >
> >
> > any suggestions?
> >
>
> ---------------------------------------------------------------------
> 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


---------------------------------------------------------------------
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


Markus Karg
RE: RE: RE: RE: Re: JNI/CompositeApp/Glassfish
Posted: May 29, 2009 10:56 AM   in response to: Martin, Ray
  Click to reply to this thread Reply

Well, if time is scarce then you might should abstain from writing
novels like this and concentrate on the technological issues. If you
want use GlassFish this does not mean that you must use EJB. If EJB
forbids JNI this does not mean that it is impossible to use it in
GlassFish. The question is: What do you want to get?

If you want a portable solution, you must wrap JNI using JCA, just like
Java EE specifies it. JCA is not as complex as you might think and you
can use ready to use building bricks, like RAFC
(http://sourceforge.net/projects/rafc). Using RAFC is simple and it
provides 90% of the boilderplate code.

If you do not need a portable solution, just hack your JNI calls into
your server side (EJBs or whatever). If there is a bug, ask your
questions here and the community will help.

If you don't essentially need GlassFish and you just want to have a
stable platform, use JAX-WS contained in Java SE 6. Believe mit, that is
thoroughly tested, too.

Independent of what your decision is, please DECIDE ON YOUR OWN, but DO
DECIDE. We try to help you, but we just do not understand what your
actual, TECHNICAL problem is.

Regards
Markus

> -----Original Message-----
> From: Martin, Ray [mailto:armart3@tycho.ncsc.mil]
> Sent: Freitag, 29. Mai 2009 16:14
> To: users@glassfish.dev.java.net
> Subject: RE: RE: RE: Re: JNI/CompositeApp/Glassfish
>
> Yea - I hear you. I am running around in circles right now trying to
> find a temporary solution.
>
> I was, in times past, of the opinion to steer clear of Glassfish.
But,
> I have since drank the cool-aid - I now want ALL my SOA nodes to be
> Glassfish. Glassfish means a lot of different things. At one moment
> in
> time, Glassfish means one thing, in another moment in time Glassfish
> has
> another meaning. But, for me, all cases have the meaning of a grid of
> SOA nodes. SOA nodes? Yes, Sir. How else but JAX-WS? So, for me, ALL
> my Glassfish instances hava a 'JAX-WS port' (some have several).
>
> So, people, far smarter than I, have built a container with SOA
> 'faces'.
> They have tested. They have reduced the footprint. They have
systemic
> qualities. They have flexibility that allows for different uses -
> sometimes running J2EE stacks, sometimes running EJBModules, sometimes
> running IEP, sometimes BPEL - but, no matter, for me, all have 'JAX-WS
> ports'. It is called Glassfish. And, in the face of all of that,
> someone
> suggests "just go make your own container" - a simple container, but a
> container none-the-less. Not being your brightest boy - this just
> blows
> my mind.
>
> When the system starts up, dozens (today - hundreds to thousands,
> tomorrow)of Glassfish nodes light up. The nodes are instructed to
load
> their behavior. Processing begins - as needs change, bottle necks are
> located, the system is further tuned - nodes are added and behavior is
> loaded at the node. To enable this type of system, we are always
> looking for commonality - reduction in variability while maintaining
> flexibility. Selecting a common container is important. I hung my hat
> on Glassfish. Can I run off and create my own container - yea - might
> do that. But, first, I look for that common factor. If it is not
> attainable, then I look for options. Several options have been
> provided
> - and, I appreciate all assistance that has been provided. JCA,
JAX-WS
> has been suggested. Of course, there are sockets. And there is JMS.
> All require a container (minimally, a listener) at the endpoint - too
> bad that container cannot be a Glassfish. I know that that container
> can be a ServiceMix, but I had my heels dug in, not wanting to go that
> direction. I will use a container before I write my own.
>
> So, if my superiors do not give me a pink ticket for not meeting my
> deadline, I will have multiple of these "JNI nodes" in my SOA grid.
> Now
> Glassfish has JMX for monitoring. There is a DAS if you cluster.
> There
> is Shoal coming along. But, my little decrepit JNI nodes that I
create
> will not allow for system awareness. They are warts on my system that
> will plague me forever. Thus, the reason why I want all processing
> nodes to live within Glassfish.
>
> So, I am between a rock and a hard place.
>
> I appreciate the assistance - you may have saved my job (if I can get
> one of the options working before time runs out). Thanx.
>
>
> -----Original Message-----
> From: Markus Karg [mailto:karg@quipsy.de]
> Sent: Friday, May 29, 2009 9:18 AM
> To: users@glassfish.dev.java.net
> Subject: RE: RE: Re: JNI/CompositeApp/Glassfish
>
> If all you need is to run a BPEL wrapper around a JNI call then you
> should have a look at JAX-WS, included in Java SE 6. No need for any
> enterprise stuff at all.
>
> > -----Original Message-----
> > From: Martin, Ray [mailto:armart3@tycho.ncsc.mil]
> > Sent: Freitag, 29. Mai 2009 14:22
> > To: users@glassfish.dev.java.net
> > Subject: RE: Re: JNI/CompositeApp/Glassfish
> >
> > Yes, Mr. Chris suggested to use jmap and jhat to locate the leak.
In
> > my search for how to use those tools, I found that JNI is not
> supposed
>
> > to work in EJB. So, I said to myself "wow, I am trying to do stuff
> > that you are not even supposed to be doing. It does not really
matter
> > whether there appears to be a leak or not - the specs say don't do
> > it." I
> will
> > spend many weeks on classloaders and jhat and jmap and... I had a
> > deadline to meet to show the great world of Glassfish SOA.
> >
> > I do not know how to deploy a POJO app (with a BPEL 'face') in a
> > composite app. If I knew that, I could call the JNI from the POJO
> > (staying out of that EJB world) and meet my deadline and put a smile
> on
> > my superiors faces. Then later, after my superiors agree that my
> > selection of Glassfish is marvelous, then I can look for memory
leaks
> > or whatever. But, right now, it's killing me.
> >
> > Thanx.
> >
> > -----Original Message-----
> > From: Sanjeeb.Sahoo@Sun.COM [mailto:Sanjeeb.Sahoo@Sun.COM] On Behalf
> Of
> > Sahoo
> > Sent: Friday, May 29, 2009 8:07 AM
> > To: users@glassfish.dev.java.net
> > Subject: Re: JNI/CompositeApp/Glassfish
> >
> > Martin,
> >
> > I am confused. What's your issue? In your first posting you
mentioned
> > that you were successful in running JNI code inside GlassFish except
> > that you suspected some memory leak for which Chris suggested to use
> > tools like hat. You were supposed to analyse the memory leak. Have
> you
>
> > identified the cause? If yes, then tell us and tell us if it needs a
> > fix in GF.
> >
> > I have failed to identify if you have any other issue in this email
> > thread. Personally, I have not come across many use cases where a
> J2EE
>
> > app uses JNI. It appears that the spec discourages use of JNI. See
> [1]
>
> > for some discussion. So, over all, it should work with some
> > limitations.
> >
> > Thanks,
> > Sahoo
> >
> > [1]
> http://www.theserverside.com/discussions/thread.tss?thread_id=14057
> >
> > Martin, Ray wrote:
> > > i am readin' and scratchin' for JCA information - WOW. What a
> > complex
> >
> > > convoluted mechanism to merely call a tiny piece of code.
> > >
> > > i have many Glassfish instances running a variety of things as SOA
> > > nodes. One of the things that one of the Glassfish nodes must do
> is
>
> > > run a mathematical algorithm called a bayesian net.
> > >
> > > Why should it matter that that one instance is not portable? So,
> it
>
> > > must run on a specific hardware platform, who cares? All that is
> > > necessary is for the classloader to function properly to allow
this
> > > particular non-portable code to run in a nice simplistic manner.
> > >
> > > But, no - i now am required to build my own EIS-like system to
> > contain
> >
> > > a daemon process to listen for commands to run a small algorithm.
> > > Then i need to create an adapter. Then i need to create a
> connector.
> >
> > > Then i need to ... oh boy.
> > >
> > > And, there is something wrong with a system in which a Glassfish
> node
> > > performs some specialty algorithm? Hmm - yep, i am too dumb to
> > > understand that.
> > >
> > >
> ---------------------------------------------------------------------
> > -
> > > --
> > > *From:* Martin, Ray
> > > *Sent:* Friday, May 29, 2009 6:22 AM
> > > *To:* users@glassfish.dev.java.net
> > > *Subject:* RE: RE: RE: JNI/CompositeApp/Glassfish
> > >
> > > i am too dumb to know that was a solution...
> > >
> > >
> ---------------------------------------------------------------------
> > -
> > > --
> > > *From:* Markus Karg [mailto:karg@quipsy.de]
> > > *Sent:* Friday, May 29, 2009 6:14 AM
> > > *To:* users@glassfish.dev.java.net
> > > *Subject:* RE: RE: JNI/CompositeApp/Glassfish
> > >
> > > The idea of EJB is to have a portable application which runs on
any
> > > application server on any operating system on any hardware
> platform.
> > > JNI works only with a particular operating system and hardware
> > > platform. These two core ideas are absolutely not compatible. It
> just
> > > makes no sense to use EJB directly with JNI. If native stuff is
> > needed
> >
> > > in an enterprise application, it has to be provided in the form of
> a
>
> > > JCA 1.5 adapter. This is the official Java EE solution to bind
> > > portable applications (EJB) to platform-specific code (JNI). What
> > > problem do you have with that?
> > >
> > >
> > >
> > > *From:* Martin, Ray [mailto:armart3@tycho.ncsc.mil]
> > > *Sent:* Freitag, 29. Mai 2009 12:08
> > > *To:* users@glassfish.dev.java.net
> > > *Subject:* RE: JNI/CompositeApp/Glassfish
> > >
> > >
> > >
> > > Very smart people created JNI.
> > >
> > > Very smart people created EJB.
> > >
> > >
> > >
> > > These very smart people make sure that JNI cannot operate within
> EJB
> > -
> >
> > > why would people do something like that?
> > >
> > >
> > >
> > > i have fuddled for months building a system around glassfish - now
> it
> > > looks like i am back to ServiceMix, where i was a year ago
> > >
> > >
> > >
> > >
> ---------------------------------------------------------------------
> > -
> > > --
> > >
> > > *From:* Martin, Ray
> > > *Sent:* Thursday, May 28, 2009 12:54 PM
> > > *To:* users@glassfish.dev.java.net
> > > *Subject:* JNI/CompositeApp/Glassfish
> > >
> > > Does anyone have a JNI application running in Glassfish?
> > >
> > >
> > >
> > > I have a third party JNI app (Netica). It runs fine from the
> command
> > > line.
> > >
> > >
> > >
> > > i have an EJBModule and a BPEL project added to a composite app.
> The
> > > composite app is deployed to Glassfish and runs fine - receiving
> and
>
> > > responding to SOAP message.
> > >
> > >
> > >
> > > i then add the JNI app to the EJBModule and deploy the composite
> app
>
> > > to Glassfish.
> > >
> > >
> > >
> > > there are two SOAP messages to the composite app - setup and
> > activate.
> > >
> > >
> > >
> > > i issue the setup message - the request and response occur.
> > >
> > > i issue the activate message - the JNI app runs - all is good -
the
> > > results are stored in the database.
> > >
> > > after the JNI app should be completed, the memory usage starts to
> > climb.
> > >
> > >
> > >
> > > any suggestions?
> > >
> >
> >
---------------------------------------------------------------------
> > 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
>
>
> ---------------------------------------------------------------------
> 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


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


Martin, Ray
RE: RE: RE: RE: RE: Re: JNI/CompositeApp/Glassfish
Posted: May 29, 2009 12:19 PM   in response to: Markus Karg
  Click to reply to this thread Reply

You are saying that you did not understand my question?

My very first question, I asked "does anyone have a JNI app in
Glassfish?"

And that is really all I wanted to know. Of course, those that have the
experience, I would be interested in how it was accomplished.

Thanx.


-----Original Message-----
From: Markus Karg [mailto:karg@quipsy.de]
Sent: Friday, May 29, 2009 1:57 PM
To: users@glassfish.dev.java.net
Subject: RE: RE: RE: RE: Re: JNI/CompositeApp/Glassfish

Well, if time is scarce then you might should abstain from writing
novels like this and concentrate on the technological issues. If you
want use GlassFish this does not mean that you must use EJB. If EJB
forbids JNI this does not mean that it is impossible to use it in
GlassFish. The question is: What do you want to get?

If you want a portable solution, you must wrap JNI using JCA, just like
Java EE specifies it. JCA is not as complex as you might think and you
can use ready to use building bricks, like RAFC
(http://sourceforge.net/projects/rafc). Using RAFC is simple and it
provides 90% of the boilderplate code.

If you do not need a portable solution, just hack your JNI calls into
your server side (EJBs or whatever). If there is a bug, ask your
questions here and the community will help.

If you don't essentially need GlassFish and you just want to have a
stable platform, use JAX-WS contained in Java SE 6. Believe mit, that is
thoroughly tested, too.

Independent of what your decision is, please DECIDE ON YOUR OWN, but DO
DECIDE. We try to help you, but we just do not understand what your
actual, TECHNICAL problem is.

Regards
Markus

> -----Original Message-----
> From: Martin, Ray [mailto:armart3@tycho.ncsc.mil]
> Sent: Freitag, 29. Mai 2009 16:14
> To: users@glassfish.dev.java.net
> Subject: RE: RE: RE: Re: JNI/CompositeApp/Glassfish
>
> Yea - I hear you. I am running around in circles right now trying to
> find a temporary solution.
>
> I was, in times past, of the opinion to steer clear of Glassfish.
But,
> I have since drank the cool-aid - I now want ALL my SOA nodes to be
> Glassfish. Glassfish means a lot of different things. At one moment
> in time, Glassfish means one thing, in another moment in time
> Glassfish has another meaning. But, for me, all cases have the
> meaning of a grid of SOA nodes. SOA nodes? Yes, Sir. How else but
> JAX-WS? So, for me, ALL my Glassfish instances hava a 'JAX-WS port'
> (some have several).
>
> So, people, far smarter than I, have built a container with SOA
> 'faces'.
> They have tested. They have reduced the footprint. They have
systemic
> qualities. They have flexibility that allows for different uses -
> sometimes running J2EE stacks, sometimes running EJBModules, sometimes

> running IEP, sometimes BPEL - but, no matter, for me, all have 'JAX-WS

> ports'. It is called Glassfish. And, in the face of all of that,
> someone suggests "just go make your own container" - a simple
> container, but a container none-the-less. Not being your brightest
> boy - this just blows my mind.
>
> When the system starts up, dozens (today - hundreds to thousands,
> tomorrow)of Glassfish nodes light up. The nodes are instructed to
load
> their behavior. Processing begins - as needs change, bottle necks are

> located, the system is further tuned - nodes are added and behavior is

> loaded at the node. To enable this type of system, we are always
> looking for commonality - reduction in variability while maintaining
> flexibility. Selecting a common container is important. I hung my hat

> on Glassfish. Can I run off and create my own container - yea - might

> do that. But, first, I look for that common factor. If it is not
> attainable, then I look for options. Several options have been
> provided
> - and, I appreciate all assistance that has been provided. JCA,
JAX-WS
> has been suggested. Of course, there are sockets. And there is JMS.
> All require a container (minimally, a listener) at the endpoint - too
> bad that container cannot be a Glassfish. I know that that container
> can be a ServiceMix, but I had my heels dug in, not wanting to go that

> direction. I will use a container before I write my own.
>
> So, if my superiors do not give me a pink ticket for not meeting my
> deadline, I will have multiple of these "JNI nodes" in my SOA grid.
> Now
> Glassfish has JMX for monitoring. There is a DAS if you cluster.
> There
> is Shoal coming along. But, my little decrepit JNI nodes that I
create
> will not allow for system awareness. They are warts on my system that

> will plague me forever. Thus, the reason why I want all processing
> nodes to live within Glassfish.
>
> So, I am between a rock and a hard place.
>
> I appreciate the assistance - you may have saved my job (if I can get
> one of the options working before time runs out). Thanx.
>
>
> -----Original Message-----
> From: Markus Karg [mailto:karg@quipsy.de]
> Sent: Friday, May 29, 2009 9:18 AM
> To: users@glassfish.dev.java.net
> Subject: RE: RE: Re: JNI/CompositeApp/Glassfish
>
> If all you need is to run a BPEL wrapper around a JNI call then you
> should have a look at JAX-WS, included in Java SE 6. No need for any
> enterprise stuff at all.
>
> > -----Original Message-----
> > From: Martin, Ray [mailto:armart3@tycho.ncsc.mil]
> > Sent: Freitag, 29. Mai 2009 14:22
> > To: users@glassfish.dev.java.net
> > Subject: RE: Re: JNI/CompositeApp/Glassfish
> >
> > Yes, Mr. Chris suggested to use jmap and jhat to locate the leak.
In
> > my search for how to use those tools, I found that JNI is not
> supposed
>
> > to work in EJB. So, I said to myself "wow, I am trying to do stuff
> > that you are not even supposed to be doing. It does not really
matter
> > whether there appears to be a leak or not - the specs say don't do
> > it." I
> will
> > spend many weeks on classloaders and jhat and jmap and... I had a
> > deadline to meet to show the great world of Glassfish SOA.
> >
> > I do not know how to deploy a POJO app (with a BPEL 'face') in a
> > composite app. If I knew that, I could call the JNI from the POJO
> > (staying out of that EJB world) and meet my deadline and put a smile
> on
> > my superiors faces. Then later, after my superiors agree that my
> > selection of Glassfish is marvelous, then I can look for memory
leaks
> > or whatever. But, right now, it's killing me.
> >
> > Thanx.
> >
> > -----Original Message-----
> > From: Sanjeeb.Sahoo@Sun.COM [mailto:Sanjeeb.Sahoo@Sun.COM] On Behalf
> Of
> > Sahoo
> > Sent: Friday, May 29, 2009 8:07 AM
> > To: users@glassfish.dev.java.net
> > Subject: Re: JNI/CompositeApp/Glassfish
> >
> > Martin,
> >
> > I am confused. What's your issue? In your first posting you
mentioned
> > that you were successful in running JNI code inside GlassFish except

> > that you suspected some memory leak for which Chris suggested to use

> > tools like hat. You were supposed to analyse the memory leak. Have
> you
>
> > identified the cause? If yes, then tell us and tell us if it needs a

> > fix in GF.
> >
> > I have failed to identify if you have any other issue in this email
> > thread. Personally, I have not come across many use cases where a
> J2EE
>
> > app uses JNI. It appears that the spec discourages use of JNI. See
> [1]
>
> > for some discussion. So, over all, it should work with some
> > limitations.
> >
> > Thanks,
> > Sahoo
> >
> > [1]
> http://www.theserverside.com/discussions/thread.tss?thread_id=14057
> >
> > Martin, Ray wrote:
> > > i am readin' and scratchin' for JCA information - WOW. What a
> > complex
> >
> > > convoluted mechanism to merely call a tiny piece of code.
> > >
> > > i have many Glassfish instances running a variety of things as SOA

> > > nodes. One of the things that one of the Glassfish nodes must do
> is
>
> > > run a mathematical algorithm called a bayesian net.
> > >
> > > Why should it matter that that one instance is not portable? So,
> it
>
> > > must run on a specific hardware platform, who cares? All that is
> > > necessary is for the classloader to function properly to allow
this
> > > particular non-portable code to run in a nice simplistic manner.
> > >
> > > But, no - i now am required to build my own EIS-like system to
> > contain
> >
> > > a daemon process to listen for commands to run a small algorithm.
> > > Then i need to create an adapter. Then i need to create a
> connector.
> >
> > > Then i need to ... oh boy.
> > >
> > > And, there is something wrong with a system in which a Glassfish
> node
> > > performs some specialty algorithm? Hmm - yep, i am too dumb to
> > > understand that.
> > >
> > >
> ---------------------------------------------------------------------
> > -
> > > --
> > > *From:* Martin, Ray
> > > *Sent:* Friday, May 29, 2009 6:22 AM
> > > *To:* users@glassfish.dev.java.net
> > > *Subject:* RE: RE: RE: JNI/CompositeApp/Glassfish
> > >
> > > i am too dumb to know that was a solution...
> > >
> > >
> ---------------------------------------------------------------------
> > -
> > > --
> > > *From:* Markus Karg [mailto:karg@quipsy.de]
> > > *Sent:* Friday, May 29, 2009 6:14 AM
> > > *To:* users@glassfish.dev.java.net
> > > *Subject:* RE: RE: JNI/CompositeApp/Glassfish
> > >
> > > The idea of EJB is to have a portable application which runs on
any
> > > application server on any operating system on any hardware
> platform.
> > > JNI works only with a particular operating system and hardware
> > > platform. These two core ideas are absolutely not compatible. It
> just
> > > makes no sense to use EJB directly with JNI. If native stuff is
> > needed
> >
> > > in an enterprise application, it has to be provided in the form of
> a
>
> > > JCA 1.5 adapter. This is the official Java EE solution to bind
> > > portable applications (EJB) to platform-specific code (JNI). What
> > > problem do you have with that?
> > >
> > >
> > >
> > > *From:* Martin, Ray [mailto:armart3@tycho.ncsc.mil]
> > > *Sent:* Freitag, 29. Mai 2009 12:08
> > > *To:* users@glassfish.dev.java.net
> > > *Subject:* RE: JNI/CompositeApp/Glassfish
> > >
> > >
> > >
> > > Very smart people created JNI.
> > >
> > > Very smart people created EJB.
> > >
> > >
> > >
> > > These very smart people make sure that JNI cannot operate within
> EJB
> > -
> >
> > > why would people do something like that?
> > >
> > >
> > >
> > > i have fuddled for months building a system around glassfish - now
> it
> > > looks like i am back to ServiceMix, where i was a year ago
> > >
> > >
> > >
> > >
> ---------------------------------------------------------------------
> > -
> > > --
> > >
> > > *From:* Martin, Ray
> > > *Sent:* Thursday, May 28, 2009 12:54 PM
> > > *To:* users@glassfish.dev.java.net
> > > *Subject:* JNI/CompositeApp/Glassfish
> > >
> > > Does anyone have a JNI application running in Glassfish?
> > >
> > >
> > >
> > > I have a third party JNI app (Netica). It runs fine from the
> command
> > > line.
> > >
> > >
> > >
> > > i have an EJBModule and a BPEL project added to a composite app.
> The
> > > composite app is deployed to Glassfish and runs fine - receiving
> and
>
> > > responding to SOAP message.
> > >
> > >
> > >
> > > i then add the JNI app to the EJBModule and deploy the composite
> app
>
> > > to Glassfish.
> > >
> > >
> > >
> > > there are two SOAP messages to the composite app - setup and
> > activate.
> > >
> > >
> > >
> > > i issue the setup message - the request and response occur.
> > >
> > > i issue the activate message - the JNI app runs - all is good -
the
> > > results are stored in the database.
> > >
> > > after the JNI app should be completed, the memory usage starts to
> > climb.
> > >
> > >
> > >
> > > any suggestions?
> > >
> >
> >
---------------------------------------------------------------------
> > 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
>
>
> ---------------------------------------------------------------------
> 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


---------------------------------------------------------------------
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


Markus Karg
RE: RE: RE: RE: RE: RE: Re: JNI/CompositeApp/Glassfish
Posted: Jun 1, 2009 6:36 AM   in response to: Martin, Ray
  Click to reply to this thread Reply

GlassFish does not intentionally restrict JNI. Actually, it doesn't care
whether your code is pure Java or implemented using JNI. So it shouldn't
be a problem to use JNI. If it does not work, it shouldn't be caused by
JNI. I am using JNI in GlassFish's ACC (The JDIC Library) and it works
without any problem. Have not used JNI on the server side, but should
work, too.

Does that answer your question?

Regards
Markus

> -----Original Message-----
> From: Martin, Ray [mailto:armart3@tycho.ncsc.mil]
> Sent: Freitag, 29. Mai 2009 21:19
> To: users@glassfish.dev.java.net
> Subject: RE: RE: RE: RE: RE: Re: JNI/CompositeApp/Glassfish
>
> You are saying that you did not understand my question?
>
> My very first question, I asked "does anyone have a JNI app in
> Glassfish?"
>
> And that is really all I wanted to know. Of course, those that have
> the
> experience, I would be interested in how it was accomplished.
>
> Thanx.
>
>
> -----Original Message-----
> From: Markus Karg [mailto:karg@quipsy.de]
> Sent: Friday, May 29, 2009 1:57 PM
> To: users@glassfish.dev.java.net
> Subject: RE: RE: RE: RE: Re: JNI/CompositeApp/Glassfish
>
> Well, if time is scarce then you might should abstain from writing
> novels like this and concentrate on the technological issues. If you
> want use GlassFish this does not mean that you must use EJB. If EJB
> forbids JNI this does not mean that it is impossible to use it in
> GlassFish. The question is: What do you want to get?
>
> If you want a portable solution, you must wrap JNI using JCA, just
like
> Java EE specifies it. JCA is not as complex as you might think and you
> can use ready to use building bricks, like RAFC
> (http://sourceforge.net/projects/rafc). Using RAFC is simple and it
> provides 90% of the boilderplate code.
>
> If you do not need a portable solution, just hack your JNI calls into
> your server side (EJBs or whatever). If there is a bug, ask your
> questions here and the community will help.
>
> If you don't essentially need GlassFish and you just want to have a
> stable platform, use JAX-WS contained in Java SE 6. Believe mit, that
> is
> thoroughly tested, too.
>
> Independent of what your decision is, please DECIDE ON YOUR OWN, but
DO
> DECIDE. We try to help you, but we just do not understand what your
> actual, TECHNICAL problem is.
>
> Regards
> Markus
>
> > -----Original Message-----
> > From: Martin, Ray [mailto:armart3@tycho.ncsc.mil]
> > Sent: Freitag, 29. Mai 2009 16:14
> > To: users@glassfish.dev.java.net
> > Subject: RE: RE: RE: Re: JNI/CompositeApp/Glassfish
> >
> > Yea - I hear you. I am running around in circles right now trying
to
> > find a temporary solution.
> >
> > I was, in times past, of the opinion to steer clear of Glassfish.
> But,
> > I have since drank the cool-aid - I now want ALL my SOA nodes to be
> > Glassfish. Glassfish means a lot of different things. At one
moment
> > in time, Glassfish means one thing, in another moment in time
> > Glassfish has another meaning. But, for me, all cases have the
> > meaning of a grid of SOA nodes. SOA nodes? Yes, Sir. How else but
> > JAX-WS? So, for me, ALL my Glassfish instances hava a 'JAX-WS port'
> > (some have several).
> >
> > So, people, far smarter than I, have built a container with SOA
> > 'faces'.
> > They have tested. They have reduced the footprint. They have
> systemic
> > qualities. They have flexibility that allows for different uses -
> > sometimes running J2EE stacks, sometimes running EJBModules,
> sometimes
>
> > running IEP, sometimes BPEL - but, no matter, for me, all have 'JAX-
> WS
>
> > ports'. It is called Glassfish. And, in the face of all of that,
> > someone suggests "just go make your own container" - a simple
> > container, but a container none-the-less. Not being your brightest
> > boy - this just blows my mind.
> >
> > When the system starts up, dozens (today - hundreds to thousands,
> > tomorrow)of Glassfish nodes light up. The nodes are instructed to
> load
> > their behavior. Processing begins - as needs change, bottle necks
> are
>
> > located, the system is further tuned - nodes are added and behavior
> is
>
> > loaded at the node. To enable this type of system, we are always
> > looking for commonality - reduction in variability while maintaining
> > flexibility. Selecting a common container is important. I hung my
> hat
>
> > on Glassfish. Can I run off and create my own container - yea -
> might
>
> > do that. But, first, I look for that common factor. If it is not
> > attainable, then I look for options. Several options have been
> > provided
> > - and, I appreciate all assistance that has been provided. JCA,
> JAX-WS
> > has been suggested. Of course, there are sockets. And there is
JMS.
> > All require a container (minimally, a listener) at the endpoint -
too
> > bad that container cannot be a Glassfish. I know that that
container
> > can be a ServiceMix, but I had my heels dug in, not wanting to go
> that
>
> > direction. I will use a container before I write my own.
> >
> > So, if my superiors do not give me a pink ticket for not meeting my
> > deadline, I will have multiple of these "JNI nodes" in my SOA grid.
> > Now
> > Glassfish has JMX for monitoring. There is a DAS if you cluster.
> > There
> > is Shoal coming along. But, my little decrepit JNI nodes that I
> create
> > will not allow for system awareness. They are warts on my system
> that
>
> > will plague me forever. Thus, the reason why I want all processing
> > nodes to live within Glassfish.
> >
> > So, I am between a rock and a hard place.
> >
> > I appreciate the assistance - you may have saved my job (if I can
get
> > one of the options working before time runs out). Thanx.
> >
> >
> > -----Original Message-----
> > From: Markus Karg [mailto:karg@quipsy.de]
> > Sent: Friday, May 29, 2009 9:18 AM
> > To: users@glassfish.dev.java.net
> > Subject: RE: RE: Re: JNI/CompositeApp/Glassfish
> >
> > If all you need is to run a BPEL wrapper around a JNI call then you
> > should have a look at JAX-WS, included in Java SE 6. No need for any
> > enterprise stuff at all.
> >
> > > -----Original Message-----
> > > From: Martin, Ray [mailto:armart3@tycho.ncsc.mil]
> > > Sent: Freitag, 29. Mai 2009 14:22
> > > To: users@glassfish.dev.java.net
> > > Subject: RE: Re: JNI/CompositeApp/Glassfish
> > >
> > > Yes, Mr. Chris suggested to use jmap and jhat to locate the leak.
> In
> > > my search for how to use those tools, I found that JNI is not
> > supposed
> >
> > > to work in EJB. So, I said to myself "wow, I am trying to do
stuff
> > > that you are not even supposed to be doing. It does not really
> matter
> > > whether there appears to be a leak or not - the specs say don't do
> > > it." I
> > will
> > > spend many weeks on classloaders and jhat and jmap and... I had a
> > > deadline to meet to show the great world of Glassfish SOA.
> > >
> > > I do not know how to deploy a POJO app (with a BPEL 'face') in a
> > > composite app. If I knew that, I could call the JNI from the POJO
> > > (staying out of that EJB world) and meet my deadline and put a
> smile
> > on
> > > my superiors faces. Then later, after my superiors agree that my
> > > selection of Glassfish is marvelous, then I can look for memory
> leaks
> > > or whatever. But, right now, it's killing me.
> > >
> > > Thanx.
> > >
> > > -----Original Message-----
> > > From: Sanjeeb.Sahoo@Sun.COM [mailto:Sanjeeb.Sahoo@Sun.COM] On
> Behalf
> > Of
> > > Sahoo
> > > Sent: Friday, May 29, 2009 8:07 AM
> > > To: users@glassfish.dev.java.net
> > > Subject: Re: JNI/CompositeApp/Glassfish
> > >
> > > Martin,
> > >
> > > I am confused. What's your issue? In your first posting you
> mentioned
> > > that you were successful in running JNI code inside GlassFish
> except
>
> > > that you suspected some memory leak for which Chris suggested to
> use
>
> > > tools like hat. You were supposed to analyse the memory leak. Have
> > you
> >
> > > identified the cause? If yes, then tell us and tell us if it needs
> a
>
> > > fix in GF.
> > >
> > > I have failed to identify if you have any other issue in this
email
> > > thread. Personally, I have not come across many use cases where a
> > J2EE
> >
> > > app uses JNI. It appears that the spec discourages use of JNI. See
> > [1]
> >
> > > for some discussion. So, over all, it should work with some
> > > limitations.
> > >
> > > Thanks,
> > > Sahoo
> > >
> > > [1]
> > http://www.theserverside.com/discussions/thread.tss?thread_id=14057
> > >
> > > Martin, Ray wrote:
> > > > i am readin' and scratchin' for JCA information - WOW. What a
> > > complex
> > >
> > > > convoluted mechanism to merely call a tiny piece of code.
> > > >
> > > > i have many Glassfish instances running a variety of things as
> SOA
>
> > > > nodes. One of the things that one of the Glassfish nodes must
do
> > is
> >
> > > > run a mathematical algorithm called a bayesian net.
> > > >
> > > > Why should it matter that that one instance is not portable?
So,
> > it
> >
> > > > must run on a specific hardware platform, who cares? All that
is
> > > > necessary is for the classloader to function properly to allow
> this
> > > > particular non-portable code to run in a nice simplistic manner.
> > > >
> > > > But, no - i now am required to build my own EIS-like system to
> > > contain
> > >
> > > > a daemon process to listen for commands to run a small
algorithm.
> > > > Then i need to create an adapter. Then i need to create a
> > connector.
> > >
> > > > Then i need to ... oh boy.
> > > >
> > > > And, there is something wrong with a system in which a Glassfish
> > node
> > > > performs some specialty algorithm? Hmm - yep, i am too dumb to
> > > > understand that.
> > > >
> > > >
> >
---------------------------------------------------------------------
> > > -
> > > > --
> > > > *From:* Martin, Ray
> > > > *Sent:* Friday, May 29, 2009 6:22 AM
> > > > *To:* users@glassfish.dev.java.net
> > > > *Subject:* RE: RE: RE: JNI/CompositeApp/Glassfish
> > > >
> > > > i am too dumb to know that was a solution...
> > > >
> > > >
> >
---------------------------------------------------------------------
> > > -
> > > > --
> > > > *From:* Markus Karg [mailto:karg@quipsy.de]
> > > > *Sent:* Friday, May 29, 2009 6:14 AM
> > > > *To:* users@glassfish.dev.java.net
> > > > *Subject:* RE: RE: JNI/CompositeApp/Glassfish
> > > >
> > > > The idea of EJB is to have a portable application which runs on
> any
> > > > application server on any operating system on any hardware
> > platform.
> > > > JNI works only with a particular operating system and hardware
> > > > platform. These two core ideas are absolutely not compatible. It
> > just
> > > > makes no sense to use EJB directly with JNI. If native stuff is
> > > needed
> > >
> > > > in an enterprise application, it has to be provided in the form
> of
> > a
> >
> > > > JCA 1.5 adapter. This is the official Java EE solution to bind
> > > > portable applications (EJB) to platform-specific code (JNI).
What
> > > > problem do you have with that?
> > > >
> > > >
> > > >
> > > > *From:* Martin, Ray [mailto:armart3@tycho.ncsc.mil]
> > > > *Sent:* Freitag, 29. Mai 2009 12:08
> > > > *To:* users@glassfish.dev.java.net
> > > > *Subject:* RE: JNI/CompositeApp/Glassfish
> > > >
> > > >
> > > >
> > > > Very smart people created JNI.
> > > >
> > > > Very smart people created EJB.
> > > >
> > > >
> > > >
> > > > These very smart people make sure that JNI cannot operate within
> > EJB
> > > -
> > >
> > > > why would people do something like that?
> > > >
> > > >
> > > >
> > > > i have fuddled for months building a system around glassfish -
> now
> > it
> > > > looks like i am back to ServiceMix, where i was a year ago
> > > >
> > > >
> > > >
> > > >
> >
---------------------------------------------------------------------
> > > -
> > > > --
> > > >
> > > > *From:* Martin, Ray
> > > > *Sent:* Thursday, May 28, 2009 12:54 PM
> > > > *To:* users@glassfish.dev.java.net
> > > > *Subject:* JNI/CompositeApp/Glassfish
> > > >
> > > > Does anyone have a JNI application running in Glassfish?
> > > >
> > > >
> > > >
> > > > I have a third party JNI app (Netica). It runs fine from the
> > command
> > > > line.
> > > >
> > > >
> > > >
> > > > i have an EJBModule and a BPEL project added to a composite app.
> > The
> > > > composite app is deployed to Glassfish and runs fine - receiving
> > and
> >
> > > > responding to SOAP message.
> > > >
> > > >
> > > >
> > > > i then add the JNI app to the EJBModule and deploy the composite
> > app
> >
> > > > to Glassfish.
> > > >
> > > >
> > > >
> > > > there are two SOAP messages to the composite app - setup and
> > > activate.
> > > >
> > > >
> > > >
> > > > i issue the setup message - the request and response occur.
> > > >
> > > > i issue the activate message - the JNI app runs - all is good -
> the
> > > > results are stored in the database.
> > > >
> > > > after the JNI app should be completed, the memory usage starts
to
> > > climb.
> > > >
> > > >
> > > >
> > > > any suggestions?
> > > >
> > >
> > >
> ---------------------------------------------------------------------
> > > 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
> >
> >
> >
---------------------------------------------------------------------
> > 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
>
>
> ---------------------------------------------------------------------
> 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


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


Martin Gainty
RE: JNI/CompositeApp/Glassfish
Posted: Jun 1, 2009 8:33 AM   in response to: Markus Karg
  Click to reply to this thread Reply


Ray/Markus

JNI specifies the library LD_LIBRARY_PATH should be used to locate the library in Unix/Linux environments

creation of .so
Unix or Linux:
LD_LIBRARY_PATH=`pwd`
export LD_LIBRARY_PATH

creation of .dll
Windows NT/2000/95:
set PATH=%path%;.
i have seen issues popup with use of LD_LIBRARY_PATH
but that has to be resolved by OS

fairly comprehensive tutorial available at
http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jniexamp.html

out of curiosity what OS are you running on?
Martin Gainty
______________________________________________
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> Date: Mon, 1 Jun 2009 15:36:42 +0200
> From: karg@quipsy.de
> To: users@glassfish.dev.java.net
> Subject: RE: RE: RE: RE: RE: RE: Re: JNI/CompositeApp/Glassfish
>
> GlassFish does not intentionally restrict JNI. Actually, it doesn't care
> whether your code is pure Java or implemented using JNI. So it shouldn't
> be a problem to use JNI. If it does not work, it shouldn't be caused by
> JNI. I am using JNI in GlassFish's ACC (The JDIC Library) and it works
> without any problem. Have not used JNI on the server side, but should
> work, too.
>
> Does that answer your question?
>
> Regards
> Markus
>
> > -----Original Message-----
> > From: Martin, Ray [mailto:armart3@tycho.ncsc.mil]
> > Sent: Freitag, 29. Mai 2009 21:19
> > To: users@glassfish.dev.java.net
> > Subject: RE: RE: RE: RE: RE: Re: JNI/CompositeApp/Glassfish
> >
> > You are saying that you did not understand my question?
> >
> > My very first question, I asked "does anyone have a JNI app in
> > Glassfish?"
> >
> > And that is really all I wanted to know. Of course, those that have
> > the
> > experience, I would be interested in how it was accomplished.
> >
> > Thanx.
> >
> >
> > -----Original Message-----
> > From: Markus Karg [mailto:karg@quipsy.de]
> > Sent: Friday, May 29, 2009 1:57 PM
> > To: users@glassfish.dev.java.net
> > Subject: RE: RE: RE: RE: Re: JNI/CompositeApp/Glassfish
> >
> > Well, if time is scarce then you might should abstain from writing
> > novels like this and concentrate on the technological issues. If you
> > want use GlassFish this does not mean that you must use EJB. If EJB
> > forbids JNI this does not mean that it is impossible to use it in
> > GlassFish. The question is: What do you want to get?
> >
> > If you want a portable solution, you must wrap JNI using JCA, just
> like
> > Java EE specifies it. JCA is not as complex as you might think and you
> > can use ready to use building bricks, like RAFC
> > (http://sourceforge.net/projects/rafc). Using RAFC is simple and it
> > provides 90% of the boilderplate code.
> >
> > If you do not need a portable solution, just hack your JNI calls into
> > your server side (EJBs or whatever). If there is a bug, ask your
> > questions here and the community will help.
> >
> > If you don't essentially need GlassFish and you just want to have a
> > stable platform, use JAX-WS contained in Java SE 6. Believe mit, that
> > is
> > thoroughly tested, too.
> >
> > Independent of what your decision is, please DECIDE ON YOUR OWN, but
> DO
> > DECIDE. We try to help you, but we just do not understand what your
> > actual, TECHNICAL problem is.
> >
> > Regards
> > Markus
> >
> > > -----Original Message-----
> > > From: Martin, Ray [mailto:armart3@tycho.ncsc.mil]
> > > Sent: Freitag, 29. Mai 2009 16:14
> > > To: users@glassfish.dev.java.net
> > > Subject: RE: RE: RE: Re: JNI/CompositeApp/Glassfish
> > >
> > > Yea - I hear you. I am running around in circles right now trying
> to
> > > find a temporary solution.
> > >
> > > I was, in times past, of the opinion to steer clear of Glassfish.
> > But,
> > > I have since drank the cool-aid - I now want ALL my SOA nodes to be
> > > Glassfish. Glassfish means a lot of different things. At one
> moment
> > > in time, Glassfish means one thing, in another moment in time
> > > Glassfish has another meaning. But, for me, all cases have the
> > > meaning of a grid of SOA nodes. SOA nodes? Yes, Sir. How else but
> > > JAX-WS? So, for me, ALL my Glassfish instances hava a 'JAX-WS port'
> > > (some have several).
> > >
> > > So, people, far smarter than I, have built a container with SOA
> > > 'faces'.
> > > They have tested. They have reduced the footprint. They have
> > systemic
> > > qualities. They have flexibility that allows for different uses -
> > > sometimes running J2EE stacks, sometimes running EJBModules,
> > sometimes
> >
> > > running IEP, sometimes BPEL - but, no matter, for me, all have 'JAX-
> > WS
> >
> > > ports'. It is called Glassfish. And, in the face of all of that,
> > > someone suggests "just go make your own container" - a simple
> > > container, but a container none-the-less. Not being your brightest
> > > boy - this just blows my mind.
> > >
> > > When the system starts up, dozens (today - hundreds to thousands,
> > > tomorrow)of Glassfish nodes light up. The nodes are instructed to
> > load
> > > their behavior. Processing begins - as needs change, bottle necks
> > are
> >
> > > located, the system is further tuned - nodes are added and behavior
> > is
> >
> > > loaded at the node. To enable this type of system, we are always
> > > looking for commonality - reduction in variability while maintaining
> > > flexibility. Selecting a common container is important. I hung my
> > hat
> >
> > > on Glassfish. Can I run off and create my own container - yea -
> > might
> >
> > > do that. But, first, I look for that common factor. If it is not
> > > attainable, then I look for options. Several options have been
> > > provided
> > > - and, I appreciate all assistance that has been provided. JCA,
> > JAX-WS
> > > has been suggested. Of course, there are sockets. And there is
> JMS.
> > > All require a container (minimally, a listener) at the endpoint -
> too
> > > bad that container cannot be a Glassfish. I know that that
> container
> > > can be a ServiceMix, but I had my heels dug in, not wanting to go
> > that
> >
> > > direction. I will use a container before I write my own.
> > >
> > > So, if my superiors do not give me a pink ticket for not meeting my
> > > deadline, I will have multiple of these "JNI nodes" in my SOA grid.
> > > Now
> > > Glassfish has JMX for monitoring. There is a DAS if you cluster.
> > > There
> > > is Shoal coming along. But, my little decrepit JNI nodes that I
> > create
> > > will not allow for system awareness. They are warts on my system
> > that
> >
> > > will plague me forever. Thus, the reason why I want all processing
> > > nodes to live within Glassfish.
> > >
> > > So, I am between a rock and a hard place.
> > >
> > > I appreciate the assistance - you may have saved my job (if I can
> get
> > > one of the options working before time runs out). Thanx.
> > >
> > >
> > > -----Original Message-----
> > > From: Markus Karg [mailto:karg@quipsy.de]
> > > Sent: Friday, May 29, 2009 9:18 AM
> > > To: users@glassfish.dev.java.net
> > > Subject: RE: RE: Re: JNI/CompositeApp/Glassfish
> > >
> > > If all you need is to run a BPEL wrapper around a JNI call then you
> > > should have a look at JAX-WS, included in Java SE 6. No need for any
> > > enterprise stuff at all.
> > >
> > > > -----Original Message-----
> > > > From: Martin, Ray [mailto:armart3@tycho.ncsc.mil]
> > > > Sent: Freitag, 29. Mai 2009 14:22
> > > > To: users@glassfish.dev.java.net
> > > > Subject: RE: Re: JNI/CompositeApp/Glassfish
> > > >
> > > > Yes, Mr. Chris suggested to use jmap and jhat to locate the leak.
> > In
> > > > my search for how to use those tools, I found that JNI is not
> > > supposed
> > >
> > > > to work in EJB. So, I said to myself "wow, I am trying to do
> stuff
> > > > that you are not even supposed to be doing. It does not really
> > matter
> > > > whether there appears to be a leak or not - the specs say don't do
> > > > it." I
> > > will
> > > > spend many weeks on classloaders and jhat and jmap and... I had a
> > > > deadline to meet to show the great world of Glassfish SOA.
> > > >
> > > > I do not know how to deploy a POJO app (with a BPEL 'face') in a
> > > > composite app. If I knew that, I could call the JNI from the POJO
> > > > (staying out of that EJB world) and meet my deadline and put a
> > smile
> > > on
> > > > my superiors faces. Then later, after my superiors agree that my
> > > > selection of Glassfish is marvelous, then I can look for memory
> > leaks
> > > > or whatever. But, right now, it's killing me.
> > > >
> > > > Thanx.
> > > >
> > > > -----Original Message-----
> > > > From: Sanjeeb.Sahoo@Sun.COM [mailto:Sanjeeb.Sahoo@Sun.COM] On
> > Behalf
> > > Of
> > > > Sahoo
> > > > Sent: Friday, May 29, 2009 8:07 AM
> > > > To: users@glassfish.dev.java.net
> > > > Subject: Re: JNI/CompositeApp/Glassfish
> > > >
> > > > Martin,
> > > >
> > > > I am confused. What's your issue? In your first posting you
> > mentioned
> > > > that you were successful in running JNI code inside GlassFish
> > except
> >
> > > > that you suspected some memory leak for which Chris suggested to
> > use
> >
> > > > tools like hat. You were supposed to analyse the memory leak. Have
> > > you
> > >
> > > > identified the cause? If yes, then tell us and tell us if it needs
> > a
> >
> > > > fix in GF.
> > > >
> > > > I have failed to identify if you have any other issue in this
> email
> > > > thread. Personally, I have not come across many use cases where a
> > > J2EE
> > >
> > > > app uses JNI. It appears that the spec discourages use of JNI. See
> > > [1]
> > >
> > > > for some discussion. So, over all, it should work with some
> > > > limitations.
> > > >
> > > > Thanks,
> > > > Sahoo
> > > >
> > > > [1]
> > > http://www.theserverside.com/discussions/thread.tss?thread_id=14057
> > > >
> > > > Martin, Ray wrote:
> > > > > i am readin' and scratchin' for JCA information - WOW. What a
> > > > complex
> > > >
> > > > > convoluted mechanism to merely call a tiny piece of code.
> > > > >
> > > > > i have many Glassfish instances running a variety of things as
> > SOA
> >
> > > > > nodes. One of the things that one of the Glassfish nodes must
> do
> > > is
> > >
> > > > > run a mathematical algorithm called a bayesian net.
> > > > >
> > > > > Why should it matter that that one instance is not portable?
> So,
> > > it
> > >
> > > > > must run on a specific hardware platform, who cares? All that
> is
> > > > > necessary is for the classloader to function properly to allow
> > this
> > > > > particular non-portable code to run in a nice simplistic manner.
> > > > >
> > > > > But, no - i now am required to build my own EIS-like system to
> > > > contain
> > > >
> > > > > a daemon process to listen for commands to run a small
> algorithm.
> > > > > Then i need to create an adapter. Then i need to create a
> > > connector.
> > > >
> > > > > Then i need to ... oh boy.
> > > > >
> > > > > And, there is something wrong with a system in which a Glassfish
> > > node
> > > > > performs some specialty algorithm? Hmm - yep, i am too dumb to
> > > > > understand that.
> > > > >
> > > > >
> > >
> ---------------------------------------------------------------------
> > > > -
> > > > > --
> > > > > *From:* Martin, Ray
> > > > > *Sent:* Friday, May 29, 2009 6:22 AM
> > > > > *To:* users@glassfish.dev.java.net
> > > > > *Subject:* RE: RE: RE: JNI/CompositeApp/Glassfish
> > > > >
> > > > > i am too dumb to know that was a solution...
> > > > >
> > > > >
> > >
> ---------------------------------------------------------------------
> > > > -
> > > > > --
> > > > > *From:* Markus Karg [mailto:karg@quipsy.de]
> > > > > *Sent:* Friday, May 29, 2009 6:14 AM
> > > > > *To:* users@glassfish.dev.java.net
> > > > > *Subject:* RE: RE: JNI/CompositeApp/Glassfish
> > > > >
> > > > > The idea of EJB is to have a portable application which runs on
> > any
> > > > > application server on any operating system on any hardware
> > > platform.
> > > > > JNI works only with a particular operating system and hardware
> > > > > platform. These two core ideas are absolutely not compatible. It
> > > just
> > > > > makes no sense to use EJB directly with JNI. If native stuff is
> > > > needed
> > > >
> > > > > in an enterprise application, it has to be provided in the form
> > of
> > > a
> > >
> > > > > JCA 1.5 adapter. This is the official Java EE solution to bind
> > > > > portable applications (EJB) to platform-specific code (JNI).
> What
> > > > > problem do you have with that?
> > > > >
> > > > >
> > > > >
> > > > > *From:* Martin, Ray [mailto:armart3@tycho.ncsc.mil]
> > > > > *Sent:* Freitag, 29. Mai 2009 12:08
> > > > > *To:* users@glassfish.dev.java.net
> > > > > *Subject:* RE: JNI/CompositeApp/Glassfish
> > > > >
> > > > >
> > > > >
> > > > > Very smart people created JNI.
> > > > >
> > > > > Very smart people created EJB.
> > > > >
> > > > >
> > > > >
> > > > > These very smart people make sure that JNI cannot operate within
> > > EJB
> > > > -
> > > >
> > > > > why would people do something like that?
> > > > >
> > > > >
> > > > >
> > > > > i have fuddled for months building a system around glassfish -
> > now
> > > it
> > > > > looks like i am back to ServiceMix, where i was a year ago
> > > > >
> > > > >
> > > > >
> > > > >
> > >
> ---------------------------------------------------------------------
> > > > -
> > > > > --
> > > > >
> > > > > *From:* Martin, Ray
> > > > > *Sent:* Thursday, May 28, 2009 12:54 PM
> > > > > *To:* users@glassfish.dev.java.net
> > > > > *Subject:* JNI/CompositeApp/Glassfish
> > > > >
> > > > > Does anyone have a JNI application running in Glassfish?
> > > > >
> > > > >
> > > > >
> > > > > I have a third party JNI app (Netica). It runs fine from the
> > > command
> > > > > line.
> > > > >
> > > > >
> > > > >
> > > > > i have an EJBModule and a BPEL project added to a composite app.
> > > The
> > > > > composite app is deployed to Glassfish and runs fine - receiving
> > > and
> > >
> > > > > responding to SOAP message.
> > > > >
> > > > >
> > > > >
> > > > > i then add the JNI app to the EJBModule and deploy the composite
> > > app
> > >
> > > > > to Glassfish.
> > > > >
> > > > >
> > > > >
> > > > > there are two SOAP messages to the composite app - setup and
> > > > activate.
> > > > >
> > > > >
> > > > >
> > > > > i issue the setup message - the request and response occur.
> > > > >
> > > > > i issue the activate message - the JNI app runs - all is good -
> > the
> > > > > results are stored in the database.
> > > > >
> > > > > after the JNI app should be completed, the memory usage starts
> to
> > > > climb.
> > > > >
> > > > >
> > > > >
> > > > > any suggestions?
> > > > >
> > > >
> > > >
> > ---------------------------------------------------------------------
> > > > 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
> > >
> > >
> > >
> ---------------------------------------------------------------------
> > > 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
> >
> >
> > ---------------------------------------------------------------------
> > 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
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>

_________________________________________________________________
Hotmail® goes with you.
http://windowslive.com/Tutorial/Hotmail/Mobile?ocid=TXT_TAGLM_WL_HM_Tutorial_Mobile1_052009
[att1.html]


Martin, Ray
RE: RE: JNI/CompositeApp/Glassfish
Posted: Jun 1, 2009 8:47 AM   in response to: Martin Gainty
  Click to reply to this thread Reply

yes, my LD_LIBRARY_PATH is set to <GLASSFISH_HOME>/lib where the .so file is located.

-Djava.library.path also points to <GLASSFISH_HOME>/lib

thank you for the tutorial - i will read it in a moment.

I am testing on Redhat5.

________________________________

From: Martin Gainty [mailto:mgainty@hotmail.com]
Sent: Monday, June 01, 2009 11:34 AM
To: Users GlassFish.dev.java.net
Subject: RE: JNI/CompositeApp/Glassfish


Ray/Markus

JNI specifies the library LD_LIBRARY_PATH should be used to locate the library in Unix/Linux environments

creation of .so

Unix or Linux:
LD_LIBRARY_PATH=`pwd`
export LD_LIBRARY_PATH

creation of .dll
Windows NT/2000/95:
set PATH=%path%;.
i have seen issues popup with use of LD_LIBRARY_PATH
but that has to be resolved by OS

fairly comprehensive tutorial available at
http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jniexamp.html

out of curiosity what OS are you running on?
Martin Gainty
______________________________________________
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.





> Date: Mon, 1 Jun 2009 15:36:42 +0200
> From: karg@quipsy.de
> To: users@glassfish.dev.java.net
> Subject: RE: RE: RE: RE: RE: RE: Re: JNI/CompositeApp/Glassfish
>
> GlassFish does not intentionally restrict JNI. Actually, it doesn't care
> whether your code is pure Java or implemented using JNI. So it shouldn't
> be a problem to use JNI. If it does not work, it shouldn't be caused by
> JNI. I am using JNI in GlassFish's ACC (The JDIC Library) and it works
> without any problem. Have not used JNI on the server side, but should
> work, too.
>
> Does that answer your question?
>
> Regards
> Markus
>
> > -----Original Message-----
> > From: Martin, Ray [mailto:armart3@tycho.ncsc.mil]
> > Sent: Freitag, 29. Mai 2009 21:19
> > To: users@glassfish.dev.java.net
> > Subject: RE: RE: RE: RE: RE: Re: JNI/CompositeApp/Glassfish
> >
> > You are saying that you did not understand my question?
> >
> > My very first question, I asked "does anyone have a JNI app in
> > Glassfish?"
> >
> > And that is really all I wanted to know. Of course, those that have
> > the
> > experience, I would be interested in how it was accomplished.
> >
> > Thanx.
> >
> >
> > -----Original Message-----
> > From: Markus Karg [mailto:karg@quipsy.de]
> > Sent: Friday, May 29, 2009 1:57 PM
> > To: users@glassfish.dev.java.net
> > Subject: RE: RE: RE: RE: Re: JNI/CompositeApp/Glassfish
> >
> > Well, if time is scarce then you might should abstain from writing
> > novels like this and concentrate on the technological issues. If you
> > want use GlassFish this does not mean that you must use EJB. If EJB
> > forbids JNI this does not mean that it is impossible to use it in
> > GlassFish. The question is: What do you want to get?
> >
> > If you want a portable solution, you must wrap JNI using JCA, just
> like
> > Java EE specifies it. JCA is not as complex as you might think and you
> > can use ready to use building bricks, like RAFC
> > (http://sourceforge.net/projects/rafc). Using RAFC is simple and it
> > provides 90% of the boilderplate code.
> >
> > If you do not need a portable solution, just hack your JNI calls into
> > your server side (EJBs or whatever). If there is a bug, ask your
> > questions here and the community will help.
> >
> > If you don't essentially need GlassFish and you just want to have a
> > stable platform, use JAX-WS contained in Java SE 6. Believe mit, that
> > is
> > thoroughly tested, too.
> >
> > Independent of what your decision is, please DECIDE ON YOUR OWN, but
> DO
> > DECIDE. We try to help you, but we just do not understand what your
> > actual, TECHNICAL problem is.
> >
> > Regards
> > Markus
> >
> > > -----Original Message-----
> > > From: Martin, Ray [mailto:armart3@tycho.ncsc.mil]
> > > Sent: Freitag, 29. Mai 2009 16:14
> > > To: users@glassfish.dev.java.net
> > > Subject: RE: RE: RE: Re: JNI/CompositeApp/Glassfish
> > >
> > > Yea - I hear you. I am running around in circles right now trying
> to
> > > find a temporary solution.
> > >
> > > I was, in times past, of the opinion to steer clear of Glassfish.
> > But,
> > > I have since drank the cool-aid - I now want ALL my SOA nodes to be
> > > Glassfish. Glassfish means a lot of different things. At one
> moment
> > > in time, Glassfish means one thing, in another moment in time
> > > Glassfish has another meaning. But, for me, all cases have the
> > > meaning of a grid of SOA nodes. SOA nodes? Yes, Sir. How else but
> > > JAX-WS? So, for me, ALL my Glassfish instances hava a 'JAX-WS port'
> > > (some have several).
> > >
> > > So, people, far smarter than I, have built a container with SOA
> > > 'faces'.
> > > They have tested. They have reduced the footprint. They have
> > systemic
> > > qualities. They have flexibility that allows for different uses -
> > > sometimes running J2EE stacks, sometimes running EJBModules,
> > sometimes
> >
> > > running IEP, sometimes BPEL - but, no matter, for me, all have 'JAX-
> > WS
> >
> > > ports'. It is called Glassfish. And, in the face of all of that,
> > > someone suggests "just go make your own container" - a simple
> > > container, but a container none-the-less. Not being your brightest
> > > boy - this just blows my mind.
> > >
> > > When the system starts up, dozens (today - hundreds to thousands,
> > > tomorrow)of Glassfish nodes light up. The nodes are instructed to
> > load
> > > their behavior. Processing begins - as needs change, bottle necks
> > are
> >
> > > located, the system is further tuned - nodes are added and behavior
> > is
> >
> > > loaded at the node. To enable this type of system, we are always
> > > looking for commonality - reduction in variability while maintaining
> > > flexibility. Selecting a common container is important. I hung my
> > hat
> >
> > > on Glassfish. Can I run off and create my own container - yea -
> > might
> >
> > > do that. But, first, I look for that common factor. If it is not
> > > attainable, then I look for options. Several options have been
> > > provided
> > > - and, I appreciate all assistance that has been provided. JCA,
> > JAX-WS
> > > has been suggested. Of course, there are sockets. And there is
> JMS.
> > > All require a container (minimally, a listener) at the endpoint -
> too
> > > bad that container cannot be a Glassfish. I know that that
> container
> > > can be a ServiceMix, but I had my heels dug in, not wanting to go
> > that
> >
> > > direction. I will use a container before I write my own.
> > >
> > > So, if my superiors do not give me a pink ticket for not meeting my
> > > deadline, I will have multiple of these "JNI nodes" in my SOA grid.
> > > Now
> > > Glassfish has JMX for monitoring. There is a DAS if you cluster.
> > > There
> > > is Shoal coming along. But, my little decrepit JNI nodes that I
> > create
> > > will not allow for system awareness. They are warts on my system
> > that
> >
> > > will plague me forever. Thus, the reason why I want all processing
> > > nodes to live within Glassfish.
> > >
> > > So, I am between a rock and a hard place.
> > >
> > > I appreciate the assistance - you may have saved my job (if I can
> get
> > > one of the options working before time runs out). Thanx.
> > >
> > >
> > > -----Original Message-----
> > > From: Markus Karg [mailto:karg@quipsy.de]
> > > Sent: Friday, May 29, 2009 9:18 AM
> > > To: users@glassfish.dev.java.net
> > > Subject: RE: RE: Re: JNI/CompositeApp/Glassfish
> > >
> > > If all you need is to run a BPEL wrapper around a JNI call then you
> > > should have a look at JAX-WS, included in Java SE 6. No need for any
> > > enterprise stuff at all.
> > >
> > > > -----Original Message-----
> > > > From: Martin, Ray [mailto:armart3@tycho.ncsc.mil]
> > > > Sent: Freitag, 29. Mai 2009 14:22
> > > > To: users@glassfish.dev.java.net
> > > > Subject: RE: Re: JNI/CompositeApp/Glassfish
> > > >
> > > > Yes, Mr. Chris suggested to use jmap and jhat to locate the leak.
> > In
> > > > my search for how to use those tools, I found that JNI is not
> > > supposed
> > >
> > > > to work in EJB. So, I said to myself "wow, I am trying to do
> stuff
> > > > that you are not even supposed to be doing. It does not really
> > matter
> > > > whether there appears to be a leak or not - the specs say don't do
> > > > it." I
> > > will
> > > > spend many weeks on classloaders and jhat and jmap and... I had a
> > > > deadline to meet to show the great world of Glassfish SOA.
> > > >
> > > > I do not know how to deploy a POJO app (with a BPEL 'face') in a
> > > > composite app. If I knew that, I could call the JNI from the POJO
> > > > (staying out of that EJB world) and meet my deadline and put a
> > smile
> > > on
> > > > my superiors faces. Then later, after my superiors agree that my
> > > > selection of Glassfish is marvelous, then I can look for memory
> > leaks
> > > > or whatever. But, right now, it's killing me.
> > > >
> > > > Thanx.
> > > >
> > > > -----Original Message-----
> > > > From: Sanjeeb.Sahoo@Sun.COM [mailto:Sanjeeb.Sahoo@Sun.COM] On
> > Behalf
> > > Of
> > > > Sahoo
> > > > Sent: Friday, May 29, 2009 8:07 AM
> > > > To: users@glassfish.dev.java.net
> > > > Subject: Re: JNI/CompositeApp/Glassfish
> > > >
> > > > Martin,
> > > >
> > > > I am confused. What's your issue? In your first posting you
> > mentioned
> > > > that you were successful in running JNI code inside GlassFish
> > except
> >
> > > > that you suspected some memory leak for which Chris suggested to
> > use
> >
> > > > tools like hat. You were supposed to analyse the memory leak. Have
> > > you
> > >
> > > > identified the cause? If yes, then tell us and tell us if it needs
> > a
> >
> > > > fix in GF.
> > > >
> > > > I have failed to identify if you have any other issue in this
> email
> > > > thread. Personally, I have not come across many use cases where a
> > > J2EE
> > >
> > > > app uses JNI. It appears that the spec discourages use of JNI. See
> > > [1]
> > >
> > > > for some discussion. So, over all, it should work with some
> > > > limitations.
> > > >
> > > > Thanks,
> > > > Sahoo
> > > >
> > > > [1]
> > > http://www.theserverside.com/discussions/thread.tss?thread_id=14057
> > > >
> > > > Martin, Ray wrote:
> > > > > i am readin' and scratchin' for JCA information - WOW. What a
> > > > complex
> > > >
> > > > > convoluted mechanism to merely call a tiny piece of code.
> > > > >
> > > > > i have many Glassfish instances running a variety of things as
> > SOA
> >
> > > > > nodes. One of the things that one of the Glassfish nodes must
> do
> > > is
> > >
> > > > > run a mathematical algorithm called a bayesian net.
> > > > >
> > > > > Why should it matter that that one instance is not portable?
> So,
> > > it
> > >
> > > > > must run on a specific hardware platform, who cares? All that
> is
> > > > > necessary is for the classloader to function properly to allow
> > this
> > > > > particular non-portable code to run in a nice simplistic manner.
> > > > >
> > > > > But, no - i now am required to build my own EIS-like system to
> > > > contain
> > > >
> > > > > a daemon process to listen for commands to run a small
> algorithm.
> > > > > Then i need to create an adapter. Then i need to create a
> > > connector.
> > > >
> > > > > Then i need to ... oh boy.
> > > > >
> > > > > And, there is something wrong with a system in which a Glassfish
> > > node
> > > > > performs some specialty algorithm? Hmm - yep, i am too dumb to
> > > > > understand that.
> > > > >
> > > > >
> > >
> ---------------------------------------------------------------------
> > > > -
> > > > > --
> > > > > *From:* Martin, Ray
> > > > > *Sent:* Friday, May 29, 2009 6:22 AM
> > > > > *To:* users@glassfish.dev.java.net
> > > > > *Subject:* RE: RE: RE: JNI/CompositeApp/Glassfish
> > > > >
> > > > > i am too dumb to know that was a solution...
> > > > >
> > > > >
> > >
> ---------------------------------------------------------------------
> > > > -
> > > > > --
> > > > > *From:* Markus Karg [mailto:karg@quipsy.de]
> > > > > *Sent:* Friday, May 29, 2009 6:14 AM
> > > > > *To:* users@glassfish.dev.java.net
> > > > > *Subject:* RE: RE: JNI/CompositeApp/Glassfish
> > > > >
> > > > > The idea of EJB is to have a portable application which runs on
> > any
> > > > > application server on any operating system on any hardware
> > > platform.
> > > > > JNI works only with a particular operating system and hardware
> > > > > platform. These two core ideas are absolutely not compatible. It
> > > just
> > > > > makes no sense to use EJB directly with JNI. If native stuff is
> > > > needed
> > > >
> > > > > in an enterprise application, it has to be provided in the form
> > of
> > > a
> > >
> > > > > JCA 1.5 adapter. This is the official Java EE solution to bind
> > > > > portable applications (EJB) to platform-specific code (JNI).
> What
> > > > > problem do you have with that?
> > > > >
> > > > >
> > > > >
> > > > > *From:* Martin, Ray [mailto:armart3@tycho.ncsc.mil]
> > > > > *Sent:* Freitag, 29. Mai 2009 12:08
> > > > > *To:* users@glassfish.dev.java.net
> > > > > *Subject:* RE: JNI/CompositeApp/Glassfish
> > > > >
> > > > >
> > > > >
> > > > > Very smart people created JNI.
> > > > >
> > > > > Very smart people created EJB.
> > > > >
> > > > >
> > > > >
> > > > > These very smart people make sure that JNI cannot operate within
> > > EJB
> > > > -
> > > >
> > > > > why would people do something like that?
> > > > >
> > > > >
> > > > >
> > > > > i have fuddled for months building a system around glassfish -
> > now
> > > it
> > > > > looks like i am back to ServiceMix, where i was a year ago
> > > > >
> > > > >
> > > > >
> > > > >
> > >
> ---------------------------------------------------------------------
> > > > -
> > > > > --
> > > > >
> > > > > *From:* Martin, Ray
> > > > > *Sent:* Thursday, May 28, 2009 12:54 PM
> > > > > *To:* users@glassfish.dev.java.net
> > > > > *Subject:* JNI/CompositeApp/Glassfish
> > > > >
> > > > > Does anyone have a JNI application running in Glassfish?
> > > > >
> > > > >
> > > > >
> > > > > I have a third party JNI app (Netica). It runs fine from the
> > > command
> > > > > line.
> > > > >
> > > > >
> > > > >
> > > > > i have an EJBModule and a BPEL project added to a composite app.
> > > The
> > > > > composite app is deployed to Glassfish and runs fine - receiving
> > > and
> > >
> > > > > responding to SOAP message.
> > > > >
> > > > >
> > > > >
> > > > > i then add the JNI app to the EJBModule and deploy the composite
> > > app
> > >
> > > > > to Glassfish.
> > > > >
> > > > >
> > > > >
> > > > > there are two SOAP messages to the composite app - setup and
> > > > activate.
> > > > >
> > > > >
> > > > >
> > > > > i issue the setup message - the request and response occur.
> > > > >
> > > > > i issue the activate message - the JNI app runs - all is good -
> > the
> > > > > results are stored in the database.
> > > > >
> > > > > after the JNI app should be completed, the memory usage starts
> to
> > > > climb.
> > > > >
> > > > >
> > > > >
> > > > > any suggestions?
> > > > >
> > > >
> > > >
> > ---------------------------------------------------------------------
> > > > 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
> > >
> > >
> > >
> ---------------------------------------------------------------------
> > > 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
> >
> >
> > ---------------------------------------------------------------------
> > 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
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>


________________________________

Hotmail® goes with you. Get it on your BlackBerry or iPhone. <http://
[att1.html]





 XML java.net RSS