Link to home
Start Free TrialLog in
Avatar of quicksystem
quicksystem

asked on

Why with Borland Jbuilder 2005 i can detect all the printers (local and network printers) but when i run it with stand alone tomcat 5.5 dont?

The problem i have is the followin: I use the APPI Borland Jbuilder 2005 to write and compile the JAVA code. As you know the JBuilder have their own enviromet ( you link the tomcat and the JDK) but still have its independenci. I have a pice of code who search all the printers network and local printers. When i compile and run the application through  the Jbuilder apps its works perfectly. But when i shutdown the Jbuilder and rise up the tomcat 5.5 (same version as Jbuilder and the JDK too) i run the application and only detects the local printers why?.

This is a kind of weird all is the same (naturally not the same jejeje ) enviroment but its working diferent. I think is somthing that the jbuilder is rising up, maby the compilation but im trying everything and it doesnt work.

Hope you can help me

Regards Mark
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Check the Tomcat log files - it's conceivable there is some native code, the running of which it doesn't permit
Avatar of quicksystem
quicksystem

ASKER

in the tomcat log stdout.log doesnt show any error, in fact i send a System.out.println with the list of the printers and it show all ok (well ok meaning no error).
thats strange, check if tomcat is running with a security manager enabled.

>>in fact i send a System.out.println with the list of the printers

I'm getting confused. I thought it was only showing *local* printers in Tomcat?
Objects:  the tomcat is the version 5.5.7 and i don't have installed the admin manager. Just the Tomcat bin (default) and the JDK 1.5.6 and nothing else. I think i dont have any security manager running, do i have to check in some part in special?

CEHJ: Let me expres myself clearly ... when i'm using the jbuilder enviroment i run the web server (tomcat 5.5.7) from the same Jbuilder ( first the Jbuilder makes the compilation then it turn un the tomcat , for example if you put any break point for debuging the program stops line per line if you want to).

So whats happening lets follow the next example:
Server
  LOCAL PRINTER 1
  LOCAL PRINTER 2
  REMOTE PRINTER (MAPED FROM 192.168.1.5)

So when i run the PrintServieLookUp in the Jbuilder Find ALL THE PRINTERS 1,2 AND THE REMOTE (MAPED PRINTER). But if i run the same function out of the JBuilder meaning: I close the JBuiler, turn on the tomcat, open the browser IE6 the PrintServiceLookUp only found the printer 1 and 2. NOT THE REMOTE PRINTER (MAPED PRINTER).

NOTE: BOTH ARE RUNNING IN IE6.

And i tryed to find the diferences between both enviroments and i find no one.

Regards Mark

Pd.- Sorry for the late response.

 
I send you experts a print screen of the Jbulder log and the tomcat log. I hope this can help to clarify my problem.
JbuilderVSTomcat.jpg
That's not the Tomcat log i don't think. The Tomcat log is normally

$CATALINA_HOME/logs/catalina.out
The img shows all the systems.out wich has the application, every try catch and system lines for debuguin. The catalina.out doesnt show any error. An other important thing we just make a test in other IDE "JCreator" with the followin lines (see the code) and in the IDE shows the printers (all of thems) but when we run it from a  JSP dont.(the code is below)

This test discards 100% per sure the IDE.

I will attach the JAVA code and the JSP code. Remember the printers that are not showing are the networ printers ( maped printer).

We think that this problem maybe is some permisions or something like that.


public class prueba{
    public static void main(String arr[]){
        try{
            PrintService[] services1 = PrintServiceLookup.lookupPrintServices(null, null);
            for (int l = 0; l < services1.length; l++) {
                System.out.println("Impresora " + l + ": " +
                                   services1[l].getName());
            }
        }catch (Exception e){
            e.printStackTrace();
 
 
 
///////////////////////JSP CODE/////////////////
 
<%@ page import= "java.util.*, javax.print.PrintService,javax.print.PrintServiceLookup" %>
<%
try{
            PrintService[] services1 = PrintServiceLookup.lookupPrintServices(null, null);
            for (int l = 0; l < services1.length; l++) {
                out.println("Impresora " + l + ": " +
                                   services1[l].getName());
            }
        }catch (Exception e){
            e.printStackTrace();
        }
%>
 
        }
    }
}

Open in new window

>>We think that this problem maybe is some permisions or something like that.

Yes, i mentioned that in my first comment, but it doesn't normally fail silently
Yes is a weird problem can you help me?, with a more explicit answere cause i'm not an expert in the permition of the tomcat. Like i say in one of my past comments. I'm trying to give you all the wepons to solve this problem but with the short lines you give me it is a little complicated for me because i in the start of all this conversation. meaning with the same problem and no way to go.

Remember i´m not an expert like you,

Regards
Here is an other img with my problem. Im using the Jcreator execute file and in the cmd windows shows all the printers, in the jsp are only the local ones.
JCreatorVSIE6.jpg
On the Tomcat box, can you see those network printers through Windows Explorer
Ok, lest explain again... IN THE ONLY PLACE I SEE ALL THE PRINTERS ( THE LOCAL AND THE NETWORK) is in:

A) Jcreator -> build -> excecute file ... heres open the cmd window (past img)
B)Jbuilder: When i run the JAVA server from the Jbuilder and i run the JSP "prueba.jsp" i SEE ALL THE PRINTERS

BUT in other case NO i DONT see any thing, if you see carefully the past img i print the screen the result of the jsp and the result of the Jcreator excecute file.

I sendt that img cause you can SEE the problem.
Here is a printscreen of my installed printers. AND IN JAVA JSP THE SELECTED PRINTER do not appear
printers.jpg
I'm not interested in what you can see from any IDE. I'm asking what you can see through the OS, i.e. through Windows Explorer on the real web server
i already send you the img of the network printers and the local printers (Windows Explorer  server) hope can helps
Tomcat will not be able to see what Windows Explorer can't see. You need to look at the network configuration
Well i think that Windows Explorer can see all the printers, i attach again the print screen. The nework i think is fine.
printers.jpg
>  I think i dont have any security manager running, do i have to check in some part in special?

Its not a separate thing to run, it is enabled/disabled in the tomcat config

how do i disable the security?
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
is not, just startup