Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2006

Tip: Looking for answers? Try searching our database.

JVM not created

Thread view: 
kapil - 29 Dec 2005 20:09 GMT
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
Chris Uppal - 03 Jan 2006 10:50 GMT
> 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.
[quoted text clipped - 4 lines]
> 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
Raymond DeCampo - 03 Jan 2006 14:36 GMT
>>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.
[quoted text clipped - 11 lines]
> 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.

Signature

XML is the programmer's duct tape.

Chris Uppal - 04 Jan 2006 12:05 GMT
[me:]
> >  a process has exactly one
> > chance to create a JVM instance, once it has created it, it cannot
[quoted text clipped - 3 lines]
> 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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.