JVM not created

K

kapil

Hi everybody,
I am facing an error while running JNI COM object in ASP. I was
wondering if someone have the solution tothe problem.
Thanks in advance.
The problem is...

Steps are:

1.Created one C++ Win32 dll to call a Java code Using JNI.
In that I am Creating JVM and Destroying the JVM.

to create the JVM Code-

JavaVMOption options[2];
options[0].optionString ="-Djava.class.path=" ";
options[1].optionString = buffer;
vm_args.version = JNI_VERSION_1_4;
vm_args.options = options;
vm_args.nOptions = 2;
vm_args.ignoreUnrecognized = 1;
JNI_CreateJavaVM (&jvm, (void**)&env,&vm_args);

For destroying it Code-

jvm->DestroyJavaVM();

2.Created 1 COM wrapper in VB to call the method of Win32 dll.
when using the COM Wrapper with .NET application its working fine.
But,when using the COM with ASP ,opening the page in Browser once it is
working fine,but next time when opening it says that JVM is not
created.
When restarting the IIS server it gives the right result.
To get the correct result everytime i need to restart the IIS server
and inetinfo preocess.
Can anybody tell me what is the problem and how to resolve it.

Thanks
 
C

Chris Uppal

kapil said:
2.Created 1 COM wrapper in VB to call the method of Win32 dll.
when using the COM Wrapper with .NET application its working fine.
But,when using the COM with ASP ,opening the page in Browser once it is
working fine,but next time when opening it says that JVM is not
created.
When restarting the IIS server it gives the right result.
To get the correct result everytime i need to restart the IIS server
and inetinfo preocess.

I know nothing of ASP (and care less) and only a little about COM, so I may be
wrong, but this sounds as if the COM object is being closed between the two
pages. You can't do that -- a process has exactly one chance to create a JVM
instance, once it has created it, it cannot /ever/ create a second one. It
doesn't matter whether you close the first one cleanly, you are still not
allowed to create a second one.

As to how to fix it, I'm afraid I have no idea. You can't do it by messing
around with the JVM, you'll have to fix the way that the COM objects are
handled somehow.

-- chris
 
R

Raymond DeCampo

Chris said:
kapil wrote:




I know nothing of ASP (and care less) and only a little about COM, so I may be
wrong, but this sounds as if the COM object is being closed between the two
pages. You can't do that -- a process has exactly one chance to create a JVM
instance, once it has created it, it cannot /ever/ create a second one. It
doesn't matter whether you close the first one cleanly, you are still not
allowed to create a second one.

Chris,

That is a very interesting fact. Do you have any resources where I can
learn more?

Thanks,
Ray
As to how to fix it, I'm afraid I have no idea. You can't do it by messing
around with the JVM, you'll have to fix the way that the COM objects are
handled somehow.

The most obvious (but hacky) way would be to invoke the JVM as a
separate process.
 
C

Chris Uppal

Raymond DeCampo wrote:

[me:]
a process has exactly one
chance to create a JVM instance, once it has created it, it cannot
/ever/ create a second one. It doesn't matter whether you close the
first one cleanly, you are still not allowed to create a second one.
[...]
That is a very interesting fact. Do you have any resources where I can
learn more?

I don't, I'm afraid. It's just one of those things that's well-known to anyone
who works much with JNI to call (as opposed to be called by) Java. There's a
bug-parade entry somewhere where Sun state that they have no intention of
ever making their JVM behave as implied by (their own!) API, but you should be
able to find that as easily as I (or rather, with no greater awkward
inconvenience than I).

I'm baffled on two counts. One is /how/ do they implement the restriction ?
The other is /why/ ? Bloody irritating...

-- chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,815
Latest member
treekmostly22

Latest Threads

Top