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
486 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
Comment Utility
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
Comment Utility
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
Comment Utility
thats strange, check if tomcat is running with a security manager enabled.

0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
>>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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
>>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
Comment Utility
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
Comment Utility
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 86

Expert Comment

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

Author Comment

by:quicksystem
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
>  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
Comment Utility
how do i disable the security?
0
 
LVL 92

Accepted Solution

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

0
 

Author Comment

by:quicksystem
Comment Utility
is not, just startup
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

743 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now