Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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?

Posted on 2008-06-20
22
511 Views
Last Modified: 2013-12-14
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
0
Comment
Question by:quicksystem
  • 12
  • 7
  • 3
22 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 21834872
Check the Tomcat log files - it's conceivable there is some native code, the running of which it doesn't permit
0
 

Author Comment

by:quicksystem
ID: 21834949
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).
0
 
LVL 92

Expert Comment

by:objects
ID: 21835040
thats strange, check if tomcat is running with a security manager enabled.

0
Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 
LVL 86

Expert Comment

by:CEHJ
ID: 21835098
>>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?
0
 

Author Comment

by:quicksystem
ID: 21843461
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.

 
0
 

Author Comment

by:quicksystem
ID: 21847467
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
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 21847672
That's not the Tomcat log i don't think. The Tomcat log is normally

$CATALINA_HOME/logs/catalina.out
0
 

Author Comment

by:quicksystem
ID: 21850238
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

0
 
LVL 86

Expert Comment

by:CEHJ
ID: 21850299
>>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
0
 

Author Comment

by:quicksystem
ID: 21850509
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
0
 

Author Comment

by:quicksystem
ID: 21850573
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
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 21850619
On the Tomcat box, can you see those network printers through Windows Explorer
0
 

Author Comment

by:quicksystem
ID: 21850814
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.
0
 

Author Comment

by:quicksystem
ID: 21850871
Here is a printscreen of my installed printers. AND IN JAVA JSP THE SELECTED PRINTER do not appear
printers.jpg
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 21850899
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
0
 

Author Comment

by:quicksystem
ID: 21850910
i already send you the img of the network printers and the local printers (Windows Explorer  server) hope can helps
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 21850976
Tomcat will not be able to see what Windows Explorer can't see. You need to look at the network configuration
0
 

Author Comment

by:quicksystem
ID: 21850998
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
0
 
LVL 92

Expert Comment

by:objects
ID: 21851243
>  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

0
 

Author Comment

by:quicksystem
ID: 21852823
how do i disable the security?
0
 
LVL 92

Accepted Solution

by:
objects earned 350 total points
ID: 21852848
make sure the startup script is not using -security option

0
 

Author Comment

by:quicksystem
ID: 21852874
is not, just startup
0

Featured Post

Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
javap bin 2 40
mysql jsp example issue 32 48
Fast way to search item into Java Array (Rhino compatible) 2 31
Java Eclipse Loop 3 20
Upgrading Tomcat – There are a couple of methods to upgrade Tomcat is to use The Apache Installer is to download and unzip and run the services.bat remove|install Tomcat6 Because of the App that we are working with, we can only use Tomcat 6.…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question