lokeshj / jzebra

Automatically exported from code.google.com/p/jzebra
0 stars 0 forks source link

LiveConnect Call not allowed in JRE version 7 update 21 #126

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Update a windows 8 machine to latest java version 7 update 21
2. Open the jzebra demo page on localhost (in xampp or similar)
3. Accept the use of jzebra applet

What is the expected output? What do you see instead?
I would expect to see the list of printers populated, but I see an empty box 
where the printers would be and an error in the firebug console (or debugbar in 
IE)

What version of the product are you using? On what operating system?
This is jzebra 1.4.5 on Windows 8

Please provide any additional information below.
The error in the console reads "uncaught exception: Liveconnect call for Applet 
ID 5 is not allowed in this JVM instance", see attached for a picture

Original issue reported on code.google.com by good2beh...@gmail.com on 17 Apr 2013 at 7:06

Attachments:

GoogleCodeExporter commented 9 years ago
Issue 127 has been merged into this issue.

Original comment by tres.fin...@gmail.com on 18 Apr 2013 at 12:24

GoogleCodeExporter commented 9 years ago
Issue 125 has been merged into this issue.

Original comment by tres.fin...@gmail.com on 18 Apr 2013 at 12:25

GoogleCodeExporter commented 9 years ago
I believe LiveConnect will need to be properly implemented for jZebra to work 
with Java 7 update 21.

More about LiveConnect here:
http://www.oracle.com/technetwork/java/javase/documentation/liveconnect-docs-349
790.html

If someone would like to sponsor this feature, please contact me, 
tres.finocchiaro@gmail.com

-Tres

Original comment by tres.fin...@gmail.com on 18 Apr 2013 at 12:36

GoogleCodeExporter commented 9 years ago
I can confirm that this occurs on Windows Vista, Windows 7, and Ubuntu 12.10 
with the Java 7 update 21.

Original comment by flacmon...@gmail.com on 18 Apr 2013 at 5:17

GoogleCodeExporter commented 9 years ago
Reproduced on Windows 7 Java 7 Update 21.

I was able to work around this issue by reverting to Java 7 Update 17
http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-j
avase7-521261.html#jre-7u17-oth-JPR

Original comment by cphart...@gmail.com on 18 Apr 2013 at 5:52

GoogleCodeExporter commented 9 years ago
A temporary work-around may be to use Internet Explorer until a code change is 
made.

- Tested JRE 1.7 u21 with Chrome 26.0 and "Liveconnect" error is thrown.

However:
- Tested JRE 1.7 u21 with IE 10.0 and "findPrinter()" seems to work.

I've seemed to narrow it down to use of the <applet> tag in Chrome and other 
browsers.

Update 21 has a checkbox in the java options to allow use of <applet> in 
browsers, but the checkbox gets unchecked each time I load the control panel.

For now, I would recommend using deployJava.js or PluginDetect.js for applet 
deployment as the <applet> tag provided with the sample.html and the 
loading.html seems to be no longer supported unless you are using Internet 
Explorer.

Please post your progress.

-Tres

Original comment by tres.fin...@gmail.com on 18 Apr 2013 at 8:25

GoogleCodeExporter commented 9 years ago

Original comment by tres.fin...@gmail.com on 18 Apr 2013 at 8:25

GoogleCodeExporter commented 9 years ago
IE 9 and 10 are the browsers we tried to use and the function to list the 
printers did not work (on windows 8).  Did you try to actually print something 
in IE with JRE 1.7 u21?  Finding printers is useful, but the raw print function 
is the most critical part for us.

Which control panel are you referring to where you can allow the use of applets 
in browsers?  

Is there documentation you can point to about how to follow your 
recommendations for using deployJava or PluginDetect for applet deployment?
Thank you.

Original comment by good2beh...@gmail.com on 18 Apr 2013 at 8:48

GoogleCodeExporter commented 9 years ago
I think I figured out how to use deployJava.js.  I added this in the bottom of 
the html page inline:

<script src="https://java.com/js/deployJava.js"></script>
<script>

function jzebraReady(){
    console.log('jzebraReady');
    document.jzebra.findPrinter("");
}

var attributes = {codebase:"/jscripts/jprint/jZebra1.4.6/dist",
                      code:"jzebra.PrintApplet.class",
                      archive:"jzebra.jar",
                      name: "jzebra",
                      width:50, height:50} ;
  var parameters = {printer:"zebra"} ;
  var version = "1.6" ;
  deployJava.runApplet(attributes, parameters, version);        
</script>

Console in Win7 IE9:
SCRIPT16389: Liveconnect call for Applet ID 2 is not allowed in this JVM 
instance 

In Chrome:
Uncaught Error: Liveconnect call for Applet ID 10 is not allowed in this JVM 
instance Uncaught Error: Error calling method on NPObject.

Original comment by br...@databaseknowledge.com on 19 Apr 2013 at 12:38

GoogleCodeExporter commented 9 years ago
This setting in the Java control panel will allow jzebra to run on Java 7 u21.

http://i.imgur.com/skYZ9ZZ.png

The option is called "mixed code" security verification.  By default it's 
"enabled".  The only option that seems to fix this is "disabled", which is the 
bottom radio button.

If you are not familiar with how to get to the Java Control Panel, click Start, 
Control Panel, Programs, Java.

In Windows 8, this can be found by clicking Start, typing "java", and selecting 
"Control Panel" from the right side of the screen.

In Ubuntu running the official Oracle JVM, this can be changed by running 
"jcontrol" from the command line (unverified).

This is a temporary work-around until a permanent solution can be found.

-Tres

Original comment by tres.fin...@gmail.com on 19 Apr 2013 at 1:53

GoogleCodeExporter commented 9 years ago
Issue 113 has been merged into this issue.

Original comment by tres.fin...@gmail.com on 19 Apr 2013 at 2:12

GoogleCodeExporter commented 9 years ago
Version 1.4.7 should fix the NPObject error without making any changes to your 
computer.

https://jzebra.googlecode.com/files/jZebra_1.4.7.zip

Note:  This work-around (dealing with trusted/non-trusted code) completely 
breaks PDF printing.

-Tres

Original comment by tres.fin...@gmail.com on 19 Apr 2013 at 3:10

GoogleCodeExporter commented 9 years ago

Original comment by tres.fin...@gmail.com on 19 Apr 2013 at 3:21

GoogleCodeExporter commented 9 years ago
Confirmed working by Bahadir.

-Tres

Original comment by tres.fin...@gmail.com on 19 Apr 2013 at 3:22

GoogleCodeExporter commented 9 years ago
Hi Tres (and others),
I can confirm this version is working for me too.
- FF 20.0.1
- Chrome Version 26.0.1410.64 m
- IE8 (on purpose...)

Thanks SO MUCH for looking so quickly into it! Receipt printing is usually 
linked to money intake (my project is still in dev btw... a long one)... and 
can be scary when it stops working for some weird reason. 
So thanks a lot once again.

Baudouin

ps: I'm using this HTML code... not sure it's gonna help:
<applet style="visibility:hidden;height:0;width:0;" name="jzebra" 
code="jzebra.PrintApplet.class" archive="includes/jZebra/jzebra.jar" 
width="100" height="100"></applet>

Original comment by blamour...@gmail.com on 19 Apr 2013 at 10:45

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Confirmed that update works in IE 10 as well.

Jacob

Original comment by bocaj.bo...@gmail.com on 19 Apr 2013 at 2:18

GoogleCodeExporter commented 9 years ago
Yes it works for us on windows 8 IE 10 and latest FF/Chrome.  

Thanks Tres for the quick fix!  

I haven't tried pdf printing yet because I didn't even know that was a 
capability, but I can think of a few uses for that too, so hopefully that will 
work again in the future. :)

Original comment by good2beh...@gmail.com on 19 Apr 2013 at 5:00

GoogleCodeExporter commented 9 years ago
Issue 125 has been merged into this issue.

Original comment by tres.fin...@gmail.com on 21 Apr 2013 at 1:19

GoogleCodeExporter commented 9 years ago
Hi Tres,
Can you share how did you managed to avoid this issue in code?
Did you used accessController.doPrivileged for the java part?
If you did then where did you inserted that?

Original comment by hardikjp...@gmail.com on 22 Apr 2013 at 9:13

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
@hardikjpatel90,

TrustedLibrary=true in the MANIFEST.MF file.

In NetBeans, this setting is in the project properties under WebStart settings.

Unfortunately, this breaks the JARs on the ClassPath from performing privileged 
operations outside of the sandbox.  This is a gap for future versions, as new 
features (PDF printing, Serial RS232 i/o) break completely without bundling 
them, and bundling them inflates the size of the jar and also puts the source 
code of the project in a potentially incompatible position.

I'm not sure if a Trusted Certificate will fix this.

-Tres 

Original comment by tres.fin...@gmail.com on 22 Apr 2013 at 12:09

GoogleCodeExporter commented 9 years ago
Hi Tres

I think Trusted Certificate could fix this as if you run the application from 
browser on the server machine it is running as same as it was running with 
other java versions. This is definitely caused by much more stricter sandboxing 
in jre7u21 & jre6u45.
We are planning to do something like putting listening threads in java part for 
some events like here for printing. but I don't know for how many thing we 
could do this.

Original comment by hardikjp...@gmail.com on 23 Apr 2013 at 11:29

GoogleCodeExporter commented 9 years ago
I believe PDF functionality is now restored.

*Note:  This requires PDFRenderer-0.9.1.jar to be replaced with the signed 
version bundled with version 1.4.8.

Here's a link to the latest version:
https://jzebra.googlecode.com/files/jZebra%201.4.8.zip

The fix was to compile PDFRenderer-0.9.1.jar with the same signature used to 
sign jzebra.jar.  I'm unsure of why this wasn't working before, since a libs on 
the classpath get signed via ant/NetBeans as part of the build process.

Please test PDF support and give feedback.

Thanks for those that sponsored these fixes.

-Tres

Original comment by tres.fin...@gmail.com on 24 Apr 2013 at 2:36

GoogleCodeExporter commented 9 years ago
Hi Tres

Do you still need that TrustedLibrary = true line in manifest.mf?

hardik

Original comment by hardikjp...@gmail.com on 24 Apr 2013 at 12:20

GoogleCodeExporter commented 9 years ago
PDF print is working in version 1.4.8.  Tested in Win7: IE10, Chrome and FF.  

Safari (on windows) is saying it is unable to find a Java runtime and keeps 
redirecting me install Java. Might be a Safari setting or something.

Original comment by br...@databaseknowledge.com on 24 Apr 2013 at 12:39

GoogleCodeExporter commented 9 years ago
I am unable to get Safari to run any type of java applet, so for sure jZebra is 
fine.  Thankfully no one uses Safari on windows anyway.

Original comment by br...@databaseknowledge.com on 24 Apr 2013 at 12:48

GoogleCodeExporter commented 9 years ago
@hardik:

> Do you still need that TrustedLibrary = true line in manifest.mf?

I do not know.  I left it turned on in both jars (jzebra.jar and 
PDFRenderer-0.9.1.jar).

If I get some spare time, I'll try "TrustedOnly=true" and see if the applet 
still works.

-Tres

Original comment by tres.fin...@gmail.com on 24 Apr 2013 at 12:56

GoogleCodeExporter commented 9 years ago
awesome job Tres, confirmed working by me, and getting a secure cert still 
didnt work for jzebra 1.4.5 and 1.4.6 , been having this problem for about a 
week, and that was the first thing i tried!

1.4.8 works, still gives a warning in the Java Console, tried calling 
JavaScript jzebraDoneFinding and failed (No such method.... is that something 
related or am i just calling a deprecated function somewhere in my code?

thanks again

Original comment by alsant...@gmail.com on 25 Apr 2013 at 1:17

GoogleCodeExporter commented 9 years ago
jzebraDoneFinding is actually a newer feature that makes Ajax calls easier.

Safe to ignore.
Thanks for the feedback.
See loading.html to see the newer Ajax features.

-Tres

Original comment by tres.fin...@gmail.com on 25 Apr 2013 at 4:29

GoogleCodeExporter commented 9 years ago
Hi Tres,

Adding Trusted-Library: true Instead of Trusted-Only: true in all signed jars'
Manifest.MF file is the solution which resolved my issue. There is also a 
mention about this in jre release notes. So good job finding that one earlier.

Thanks,
Hardik

Original comment by hardikjp...@gmail.com on 25 Apr 2013 at 1:58

GoogleCodeExporter commented 9 years ago
Thanks! The new version (1.4.8) works for us too both with Java 7 update 17 and 
21. 

We had a small issue with escape characters when printing to shared Windows 
printers and the new jZebra compared to an older version we had, but that aside 
both findPrinters() and raw printing works again.  

Original comment by per.thor...@gmail.com on 30 Apr 2013 at 12:16

GoogleCodeExporter commented 9 years ago
Issue 113 has been merged into this issue.

Original comment by tres.fin...@gmail.com on 31 May 2013 at 12:40

GoogleCodeExporter commented 9 years ago
This solve my issue as well with windows 7 and Java 7 update 25.

Thanks!

Original comment by ola...@gmail.com on 27 Jun 2013 at 6:13

GoogleCodeExporter commented 9 years ago
Can someone share the workaround for printing to shared network printers. We 
had this working fine before the latest update , but now the printing fails. I 
believe we were double escaping the backslashes to get it to work. Is this 
still necessary?  Thanks

Original comment by kevinlen...@gmail.com on 1 Jul 2013 at 9:54

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
(sorry for multiple updates, typos) :) -Tres

@Kevin:

I'm unaware of any printer selection issues newly introduced with Java 7 update 
21 or update 25.

How are you selecting your printer?  Doubly escaping has helped in the past, 
however I would recommend getting the entire list and looping through them.

> var printersCSV = applet.getPrinters();
> var printers = printersCSV.split(",");
> for (p in printers) {
>    if (printers[p].indexOf("shared_printer_name") != -1) {
>       applet.setPrinter(p);
>    }
> }

Something like that.  Feel free to email me individually for further help.  
This should be added to sample.html so I need to do it anyway.

-Tres

Original comment by tres.fin...@gmail.com on 1 Jul 2013 at 10:29