13 Replies Latest reply on Aug 6, 2012 3:12 AM by max wallace

    lookupPrintServices return an empty array with jboss 7

    max wallace Newbie

      Hello,

      I migrate an application from jboss 4 to jboss 7.1.

      There is 1 thing that I can't resolve with the lookupPrintServices method.

       

      This method return an array with all printers installed on the server. It works fine with Jboss 4, 5 or 6 but not with Jboss 7.

      After research on that problem, I see that the security is activated by default with Jboss 7.

       

      So I use the secutityManager with a server.policy file containing only :

      grant{ permission java.security.AllPermission;};

      But the method return an empty array.

       

      Do you know if there is an other thing to do to allow again this method to access the printers ?

       

      Here is a simplified code of jsp with the problem :

       

       

      <%@ page language="java" import="java.util.*,javax.print.*,java.awt.print.*,java.io.*"

      %>

      <html>

      <body>

      <%

      try {

          SecurityManager security = System.getSecurityManager();

          security.checkPrintJobAccess();

         

          PrintService[] services = PrinterJob.lookupPrintServices();

          System.out.println("defaultPrinter " + defaultPrinter);

         

          System.out.println("===> " + services.length);   //return 0 ???

      } catch(Exception ex) {

          ex.printStackTrace();

      }

      </body>

      </html>

        • 1. Re: lookupPrintServices return an empty array with jboss 7
          pgracio Newbie

          Hello Max,

           

          at the moment I'm struggling with the same problem, if you find a solution please keep us updated.

           

          Regards,

          Paulo Grácio

          • 2. Re: lookupPrintServices return an empty array with jboss 7
            Darran Lofthouse Master

            From the description here I believe your problem could be class loading related - can you enable verbose classloading in the stand alone client to identify what classes are actually loaded when it works.

            1 of 1 people found this helpful
            • 3. Re: lookupPrintServices return an empty array with jboss 7
              pgracio Newbie

              {code}

              public class PrintService {

                  public static void main(String[] args){

                      javax.print.PrintService[] services = PrinterJob.lookupPrintServices();

                      System.out.println(services.length);

                  }

              }

              {code}

               

               

              Executing java -verbose:class PrintService this is the output:

               

               

              [Loaded java.lang.Object from shared objects file]

              [Loaded java.io.Serializable from shared objects file]

              [Loaded java.lang.Comparable from shared objects file]

              [Loaded java.lang.CharSequence from shared objects file]

              [Loaded java.lang.String from shared objects file]

              [Loaded java.lang.reflect.GenericDeclaration from shared objects file]

              [Loaded java.lang.reflect.Type from shared objects file]

              [Loaded java.lang.reflect.AnnotatedElement from shared objects file]

              [Loaded java.lang.Class from shared objects file]

              [Loaded java.lang.Cloneable from shared objects file]

              [Loaded java.lang.ClassLoader from shared objects file]

              [Loaded java.lang.System from shared objects file]

              [Loaded java.lang.Throwable from shared objects file]

              [Loaded java.lang.Error from shared objects file]

              [Loaded java.lang.ThreadDeath from shared objects file]

              [Loaded java.lang.Exception from shared objects file]

              [Loaded java.lang.RuntimeException from shared objects file]

              [Loaded java.security.ProtectionDomain from shared objects file]

              [Loaded java.security.AccessControlContext from shared objects file]

              [Loaded java.lang.ClassNotFoundException from shared objects file]

              [Loaded java.lang.LinkageError from shared objects file]

              [Loaded java.lang.NoClassDefFoundError from shared objects file]

              [Loaded java.lang.ClassCastException from shared objects file]

              [Loaded java.lang.ArrayStoreException from shared objects file]

              [Loaded java.lang.VirtualMachineError from shared objects file]

              [Loaded java.lang.OutOfMemoryError from shared objects file]

              [Loaded java.lang.StackOverflowError from shared objects file]

              [Loaded java.lang.IllegalMonitorStateException from shared objects file]

              [Loaded java.lang.ref.Reference from shared objects file]

              [Loaded java.lang.ref.SoftReference from shared objects file]

              [Loaded java.lang.ref.WeakReference from shared objects file]

              [Loaded java.lang.ref.FinalReference from shared objects file]

              [Loaded java.lang.ref.PhantomReference from shared objects file]

              [Loaded java.lang.ref.Finalizer from shared objects file]

              [Loaded java.lang.Runnable from shared objects file]

              [Loaded java.lang.Thread from shared objects file]

              [Loaded java.lang.Thread$UncaughtExceptionHandler from shared objects file]

              [Loaded java.lang.ThreadGroup from shared objects file]

              [Loaded java.util.Dictionary from shared objects file]

              [Loaded java.util.Map from shared objects file]

              [Loaded java.util.Hashtable from shared objects file]

              [Loaded java.util.Properties from shared objects file]

              [Loaded java.lang.reflect.AccessibleObject from shared objects file]

              [Loaded java.lang.reflect.Member from shared objects file]

              [Loaded java.lang.reflect.Field from shared objects file]

              [Loaded java.lang.reflect.Method from shared objects file]

              [Loaded java.lang.reflect.Constructor from shared objects file]

              [Loaded sun.reflect.MagicAccessorImpl from shared objects file]

              [Loaded sun.reflect.MethodAccessor from shared objects file]

              [Loaded sun.reflect.MethodAccessorImpl from shared objects file]

              [Loaded sun.reflect.ConstructorAccessor from shared objects file]

              [Loaded sun.reflect.ConstructorAccessorImpl from shared objects file]

              [Loaded sun.reflect.DelegatingClassLoader from shared objects file]

              [Loaded sun.reflect.ConstantPool from shared objects file]

              [Loaded sun.reflect.FieldAccessor from shared objects file]

              [Loaded sun.reflect.FieldAccessorImpl from shared objects file]

              [Loaded sun.reflect.UnsafeFieldAccessorImpl from shared objects file]

              [Loaded sun.reflect.UnsafeStaticFieldAccessorImpl from shared objects file]

              [Loaded java.lang.Appendable from shared objects file]

              [Loaded java.lang.AbstractStringBuilder from shared objects file]

              [Loaded java.lang.StringBuffer from shared objects file]

              [Loaded java.lang.StringBuilder from shared objects file]

              [Loaded java.lang.StackTraceElement from shared objects file]

              [Loaded java.nio.Buffer from shared objects file]

              [Loaded sun.misc.AtomicLong from shared objects file]

              [Loaded sun.misc.AtomicLongCSImpl from shared objects file]

              [Loaded sun.misc.PostVMInitHook from shared objects file]

              [Loaded java.lang.Boolean from shared objects file]

              [Loaded java.lang.Character from shared objects file]

              [Loaded java.lang.Number from shared objects file]

              [Loaded java.lang.Float from shared objects file]

              [Loaded java.lang.Double from shared objects file]

              [Loaded java.lang.Byte from shared objects file]

              [Loaded java.lang.Short from shared objects file]

              [Loaded java.lang.Integer from shared objects file]

              [Loaded java.lang.Long from shared objects file]

              [Loaded java.io.ObjectStreamField from shared objects file]

              [Loaded java.util.Comparator from shared objects file]

              [Loaded java.lang.String$CaseInsensitiveComparator from shared objects file]

              [Loaded java.security.Guard from shared objects file]

              [Loaded java.security.Permission from shared objects file]

              [Loaded java.security.BasicPermission from shared objects file]

              [Loaded java.lang.RuntimePermission from shared objects file]

              [Loaded java.util.AbstractMap from shared objects file]

              [Loaded sun.misc.SoftCache from shared objects file]

              [Loaded java.lang.ref.ReferenceQueue from shared objects file]

              [Loaded java.lang.ref.ReferenceQueue$Null from shared objects file]

              [Loaded java.lang.ref.ReferenceQueue$Lock from shared objects file]

              [Loaded java.util.HashMap from shared objects file]

              [Loaded java.util.Map$Entry from shared objects file]

              [Loaded java.util.HashMap$Entry from shared objects file]

              [Loaded java.security.AccessController from shared objects file]

              [Opened C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded sun.misc.JavaSecurityAccess from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded java.security.AccessControlContext$1 from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded sun.misc.SharedSecrets from shared objects file]

              [Loaded sun.misc.Unsafe from shared objects file]

              [Loaded java.lang.IncompatibleClassChangeError from shared objects file]

              [Loaded java.lang.NoSuchMethodError from shared objects file]

              [Loaded sun.reflect.Reflection from shared objects file]

              [Loaded java.util.Collections from shared objects file]

              [Loaded java.lang.Iterable from shared objects file]

              [Loaded java.util.Collection from shared objects file]

              [Loaded java.util.AbstractCollection from shared objects file]

              [Loaded java.util.Set from shared objects file]

              [Loaded java.util.AbstractSet from shared objects file]

              [Loaded java.util.Collections$EmptySet from shared objects file]

              [Loaded java.util.List from shared objects file]

              [Loaded java.util.AbstractList from shared objects file]

              [Loaded java.util.RandomAccess from shared objects file]

              [Loaded java.util.Collections$EmptyList from shared objects file]

              [Loaded java.util.Collections$EmptyMap from shared objects file]

              [Loaded java.util.Collections$ReverseComparator from shared objects file]

              [Loaded java.util.Collections$SynchronizedMap from shared objects file]

              [Loaded java.lang.reflect.ReflectPermission from shared objects file]

              [Loaded java.security.PrivilegedAction from shared objects file]

              [Loaded sun.reflect.ReflectionFactory$GetReflectionFactoryAction from shared objects file]

              [Loaded java.util.Vector from shared objects file]

              [Loaded java.util.Stack from shared objects file]

              [Loaded sun.reflect.ReflectionFactory from shared objects file]

              [Loaded java.lang.ref.Reference$Lock from shared objects file]

              [Loaded java.lang.ref.Reference$ReferenceHandler from shared objects file]

              [Loaded java.lang.ref.Finalizer$FinalizerThread from shared objects file]

              [Loaded java.util.Enumeration from shared objects file]

              [Loaded java.util.Hashtable$EmptyEnumerator from shared objects file]

              [Loaded java.util.Iterator from shared objects file]

              [Loaded java.util.Hashtable$EmptyIterator from shared objects file]

              [Loaded java.util.Hashtable$Entry from shared objects file]

              [Loaded sun.misc.Version from shared objects file]

              [Loaded sun.misc.JavaLangAccess from shared objects file]

              [Loaded java.lang.System$2 from shared objects file]

              [Loaded sun.misc.VM from shared objects file]

              [Loaded java.lang.Runtime from shared objects file]

              [Loaded java.io.File from shared objects file]

              [Loaded java.io.FileSystem from shared objects file]

              [Loaded java.io.Win32FileSystem from shared objects file]

              [Loaded java.io.WinNTFileSystem from shared objects file]

              [Loaded java.io.ExpiringCache from shared objects file]

              [Loaded java.util.LinkedHashMap from shared objects file]

              [Loaded java.io.ExpiringCache$1 from shared objects file]

              [Loaded java.util.LinkedHashMap$Entry from shared objects file]

              [Loaded sun.security.action.GetPropertyAction from shared objects file]

              [Loaded java.util.Arrays from shared objects file]

              [Loaded java.lang.Math from shared objects file]

              [Loaded sun.jkernel.DownloadManager from shared objects file]

              [Loaded java.lang.ThreadLocal from shared objects file]

              [Loaded sun.jkernel.DownloadManager$1 from shared objects file]

              [Loaded java.util.concurrent.atomic.AtomicInteger from shared objects file]

              [Loaded java.lang.Class$3 from shared objects file]

              [Loaded java.lang.reflect.Modifier from shared objects file]

              [Loaded sun.reflect.LangReflectAccess from shared objects file]

              [Loaded java.lang.reflect.ReflectAccess from shared objects file]

              [Loaded sun.jkernel.DownloadManager$2 from shared objects file]

              [Loaded java.lang.StringValue from shared objects file]

              [Loaded java.lang.ClassLoader$3 from shared objects file]

              [Loaded java.io.ExpiringCache$Entry from shared objects file]

              [Loaded java.lang.ClassLoader$NativeLibrary from shared objects file]

              [Loaded java.io.Closeable from shared objects file]

              [Loaded java.io.InputStream from shared objects file]

              [Loaded java.io.FileInputStream from shared objects file]

              [Loaded java.io.FileDescriptor from shared objects file]

              [Loaded java.io.Flushable from shared objects file]

              [Loaded java.io.OutputStream from shared objects file]

              [Loaded java.io.FileOutputStream from shared objects file]

              [Loaded java.io.FilterInputStream from shared objects file]

              [Loaded java.io.BufferedInputStream from shared objects file]

              [Loaded java.util.concurrent.atomic.AtomicReferenceFieldUpdater from shared objects file]

              [Loaded java.util.concurrent.atomic.AtomicReferenceFieldUpdater$AtomicReferenceFieldUpdaterImpl from shared objects file]

              [Loaded sun.reflect.misc.ReflectUtil from shared objects file]

              [Loaded java.io.FilterOutputStream from shared objects file]

              [Loaded java.io.PrintStream from shared objects file]

              [Loaded java.io.BufferedOutputStream from shared objects file]

              [Loaded java.io.Writer from shared objects file]

              [Loaded java.io.OutputStreamWriter from shared objects file]

              [Loaded sun.nio.cs.StreamEncoder from shared objects file]

              [Loaded java.nio.charset.Charset from shared objects file]

              [Loaded java.nio.charset.spi.CharsetProvider from shared objects file]

              [Loaded sun.nio.cs.FastCharsetProvider from shared objects file]

              [Loaded sun.nio.cs.StandardCharsets from shared objects file]

              [Loaded sun.util.PreHashedMap from shared objects file]

              [Loaded sun.nio.cs.StandardCharsets$Aliases from shared objects file]

              [Loaded sun.nio.cs.StandardCharsets$Classes from shared objects file]

              [Loaded sun.nio.cs.StandardCharsets$Cache from shared objects file]

              [Loaded sun.nio.cs.HistoricallyNamedCharset from shared objects file]

              [Loaded sun.nio.cs.Unicode from shared objects file]

              [Loaded sun.nio.cs.UTF_8 from shared objects file]

              [Loaded java.lang.Class$1 from shared objects file]

              [Loaded sun.reflect.ReflectionFactory$1 from shared objects file]

              [Loaded sun.reflect.NativeConstructorAccessorImpl from shared objects file]

              [Loaded sun.reflect.DelegatingConstructorAccessorImpl from shared objects file]

              [Loaded java.nio.charset.CharsetEncoder from shared objects file]

              [Loaded sun.nio.cs.UTF_8$Encoder from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded java.nio.charset.CodingErrorAction from shared objects file]

              [Loaded java.nio.ByteBuffer from shared objects file]

              [Loaded java.nio.HeapByteBuffer from shared objects file]

              [Loaded java.nio.Bits from shared objects file]

              [Loaded java.nio.ByteOrder from shared objects file]

              [Loaded java.io.BufferedWriter from shared objects file]

              [Loaded java.lang.Terminator from shared objects file]

              [Loaded sun.misc.SignalHandler from shared objects file]

              [Loaded java.lang.Terminator$1 from shared objects file]

              [Loaded sun.misc.Signal from shared objects file]

              [Loaded sun.misc.NativeSignalHandler from shared objects file]

              [Loaded sun.misc.OSEnvironment from shared objects file]

              [Loaded sun.io.Win32ErrorMode from shared objects file]

              [Loaded java.lang.NullPointerException from shared objects file]

              [Loaded java.lang.ArithmeticException from shared objects file]

              [Loaded java.lang.Compiler from shared objects file]

              [Loaded java.lang.Compiler$1 from shared objects file]

              [Loaded sun.misc.Launcher from shared objects file]

              [Loaded java.net.URLStreamHandlerFactory from shared objects file]

              [Loaded sun.misc.Launcher$Factory from shared objects file]

              [Loaded java.security.SecureClassLoader from shared objects file]

              [Loaded java.net.URLClassLoader from shared objects file]

              [Loaded sun.misc.Launcher$ExtClassLoader from shared objects file]

              [Loaded sun.security.util.Debug from shared objects file]

              [Loaded java.lang.Package from shared objects file]

              [Loaded java.net.URL from shared objects file]

              [Loaded java.security.CodeSource from shared objects file]

              [Loaded java.lang.Void from shared objects file]

              [Loaded java.security.cert.Certificate from shared objects file]

              [Loaded java.lang.ClassFormatError from shared objects file]

              [Loaded java.lang.IllegalArgumentException from shared objects file]

              [Loaded java.io.IOException from shared objects file]

              [Loaded sun.misc.URLClassPath from shared objects file]

              [Loaded java.lang.AssertionStatusDirectives from shared objects file]

              [Loaded sun.misc.JavaNetAccess from shared objects file]

              [Loaded java.net.URLClassLoader$7 from shared objects file]

              [Loaded java.security.PermissionCollection from shared objects file]

              [Loaded java.util.StringTokenizer from shared objects file]

              [Loaded java.security.PrivilegedExceptionAction from shared objects file]

              [Loaded sun.misc.Launcher$ExtClassLoader$1 from shared objects file]

              [Loaded sun.misc.MetaIndex from shared objects file]

              [Loaded java.lang.Readable from shared objects file]

              [Loaded java.io.Reader from shared objects file]

              [Loaded java.io.BufferedReader from shared objects file]

              [Loaded java.io.InputStreamReader from shared objects file]

              [Loaded java.io.FileReader from shared objects file]

              [Loaded sun.nio.cs.StreamDecoder from shared objects file]

              [Loaded java.nio.charset.CharsetDecoder from shared objects file]

              [Loaded sun.nio.cs.UTF_8$Decoder from shared objects file]

              [Loaded java.util.ArrayList from shared objects file]

              [Loaded java.nio.CharBuffer from shared objects file]

              [Loaded java.nio.HeapCharBuffer from shared objects file]

              [Loaded java.nio.charset.CoderResult from shared objects file]

              [Loaded java.nio.charset.CoderResult$Cache from shared objects file]

              [Loaded java.nio.charset.CoderResult$1 from shared objects file]

              [Loaded java.nio.charset.CoderResult$2 from shared objects file]

              [Loaded java.lang.reflect.Array from shared objects file]

              [Loaded java.util.Locale from shared objects file]

              [Loaded java.util.concurrent.ConcurrentMap from shared objects file]

              [Loaded java.util.concurrent.ConcurrentHashMap from shared objects file]

              [Loaded java.util.concurrent.locks.Lock from shared objects file]

              [Loaded java.util.concurrent.locks.ReentrantLock from shared objects file]

              [Loaded java.util.concurrent.ConcurrentHashMap$Segment from shared objects file]

              [Loaded java.util.concurrent.locks.AbstractOwnableSynchronizer from shared objects file]

              [Loaded java.util.concurrent.locks.AbstractQueuedSynchronizer from shared objects file]

              [Loaded java.util.concurrent.locks.ReentrantLock$Sync from shared objects file]

              [Loaded java.util.concurrent.locks.ReentrantLock$NonfairSync from shared objects file]

              [Loaded java.util.concurrent.locks.AbstractQueuedSynchronizer$Node from shared objects file]

              [Loaded java.util.concurrent.ConcurrentHashMap$HashEntry from shared objects file]

              [Loaded java.lang.CharacterDataLatin1 from shared objects file]

              [Loaded java.io.ObjectStreamClass from shared objects file]

              [Loaded sun.net.www.ParseUtil from shared objects file]

              [Loaded java.util.BitSet from shared objects file]

              [Loaded java.net.Parts from shared objects file]

              [Loaded java.net.URLStreamHandler from shared objects file]

              [Loaded sun.net.www.protocol.file.Handler from shared objects file]

              [Loaded java.util.HashSet from shared objects file]

              [Loaded sun.net.www.protocol.jar.Handler from shared objects file]

              [Loaded sun.misc.Launcher$AppClassLoader from shared objects file]

              [Loaded sun.misc.Launcher$AppClassLoader$1 from shared objects file]

              [Loaded java.lang.SystemClassLoaderAction from shared objects file]

              [Loaded sun.nio.cs.MS1252 from shared objects file]

              [Loaded java.lang.StringCoding from shared objects file]

              [Loaded java.lang.ThreadLocal$ThreadLocalMap from shared objects file]

              [Loaded java.lang.ThreadLocal$ThreadLocalMap$Entry from shared objects file]

              [Loaded java.lang.StringCoding$StringDecoder from shared objects file]

              [Loaded sun.nio.cs.SingleByteDecoder from shared objects file]

              [Loaded sun.nio.cs.MS1252$Decoder from shared objects file]

              [Loaded java.net.URLClassLoader$1 from shared objects file]

              [Loaded sun.net.util.URLUtil from shared objects file]

              [Loaded sun.misc.URLClassPath$3 from shared objects file]

              [Loaded sun.misc.URLClassPath$Loader from shared objects file]

              [Loaded sun.misc.URLClassPath$JarLoader from shared objects file]

              [Loaded java.security.PrivilegedActionException from shared objects file]

              [Loaded sun.misc.URLClassPath$JarLoader$1 from shared objects file]

              [Loaded sun.misc.FileURLMapper from shared objects file]

              [Loaded java.util.zip.ZipConstants from shared objects file]

              [Loaded java.util.zip.ZipFile from shared objects file]

              [Loaded java.util.jar.JarFile from shared objects file]

              [Loaded sun.misc.JavaUtilJarAccess from shared objects file]

              [Loaded java.util.jar.JavaUtilJarAccessImpl from shared objects file]

              [Loaded sun.misc.JarIndex from shared objects file]

              [Loaded sun.misc.ExtensionDependency from shared objects file]

              [Loaded java.util.zip.ZipEntry from shared objects file]

              [Loaded java.util.jar.JarEntry from shared objects file]

              [Loaded java.util.jar.JarFile$JarFileEntry from shared objects file]

              [Loaded java.io.DataInput from shared objects file]

              [Loaded java.io.DataInputStream from shared objects file]

              [Loaded java.util.zip.ZipFile$ZipFileInputStream from shared objects file]

              [Loaded java.util.zip.InflaterInputStream from shared objects file]

              [Loaded java.util.zip.ZipFile$1 from shared objects file]

              [Loaded java.util.zip.Inflater from shared objects file]

              [Loaded java.util.zip.ZStreamRef from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded sun.misc.URLClassPath$FileLoader from shared objects file]

              [Loaded sun.misc.Resource from shared objects file]

              [Loaded sun.misc.URLClassPath$JarLoader$2 from shared objects file]

              [Loaded java.util.jar.Manifest from shared objects file]

              [Loaded java.io.ByteArrayInputStream from shared objects file]

              [Loaded java.util.jar.Attributes from shared objects file]

              [Loaded java.util.jar.Manifest$FastInputStream from shared objects file]

              [Loaded java.util.jar.Attributes$Name from shared objects file]

              [Loaded sun.misc.ASCIICaseInsensitiveComparator from shared objects file]

              [Loaded java.util.jar.JarVerifier from shared objects file]

              [Loaded java.security.CodeSigner from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded java.util.jar.JarVerifier$3 from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded java.io.ByteArrayOutputStream from shared objects file]

              [Loaded sun.security.util.ManifestEntryVerifier from shared objects file]

              [Loaded sun.misc.CharacterDecoder from shared objects file]

              [Loaded sun.misc.BASE64Decoder from shared objects file]

              [Loaded sun.security.util.SignatureFileVerifier from shared objects file]

              [Loaded sun.nio.ByteBuffered from shared objects file]

              [Loaded java.security.Permissions from shared objects file]

              [Loaded java.net.URLConnection from shared objects file]

              [Loaded sun.net.www.URLConnection from shared objects file]

              [Loaded sun.net.www.protocol.file.FileURLConnection from shared objects file]

              [Loaded java.net.ContentHandler from shared objects file]

              [Loaded java.net.UnknownContentHandler from shared objects file]

              [Loaded sun.net.www.MessageHeader from shared objects file]

              [Loaded java.io.FilePermission from shared objects file]

              [Loaded java.io.FilePermission$1 from shared objects file]

              [Loaded java.security.Policy from shared objects file]

              [Loaded sun.security.provider.PolicyFile from shared objects file]

              [Loaded java.security.Policy$UnsupportedEmptyCollection from shared objects file]

              [Loaded java.io.FilePermissionCollection from shared objects file]

              [Loaded java.security.AllPermission from shared objects file]

              [Loaded java.security.UnresolvedPermission from shared objects file]

              [Loaded java.security.BasicPermissionCollection from shared objects file]

              [Loaded sun.misc.JavaSecurityProtectionDomainAccess from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded java.security.ProtectionDomain$2 from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded java.security.ProtectionDomain$Key from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded java.security.Principal from shared objects file]

              [Loaded com.intellij.rt.execution.application.AppMain from file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2011.0.1/lib/idea_rt.jar]

              [Loaded java.lang.reflect.InvocationTargetException from shared objects file]

              [Loaded java.lang.UnsatisfiedLinkError from shared objects file]

              [Loaded java.lang.Integer$IntegerCache from shared objects file]

              [Loaded com.intellij.rt.execution.application.AppMain$1 from file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%2011.0.1/lib/idea_rt.jar]

              [Loaded java.lang.SecurityException from shared objects file]

              [Loaded sun.misc.URLClassPath$FileLoader$1 from shared objects file]

              [Loaded PrintService from file:/D:/print-service/]

              [Loaded java.net.ServerSocket from shared objects file]

              [Loaded java.net.SocketOptions from shared objects file]

              [Loaded java.net.SocketImpl from shared objects file]

              [Loaded java.net.PlainSocketImpl from shared objects file]

              [Loaded java.net.SocksConsts from shared objects file]

              [Loaded java.net.SocksSocketImpl from shared objects file]

              [Loaded sun.security.action.LoadLibraryAction from shared objects file]

              [Loaded java.lang.IllegalAccessException from shared objects file]

              [Loaded java.lang.annotation.Annotation from shared objects file]

              [Loaded java.lang.reflect.TypeVariable from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded sun.reflect.NativeMethodAccessorImpl from shared objects file]

              [Loaded sun.reflect.DelegatingMethodAccessorImpl from shared objects file]

              [Loaded java.awt.print.PrinterJob from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.DocFlavor from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.DocFlavor$SERVICE_FORMATTED from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.MimeType from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.MimeType$LexicalAnalyzer from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.PrintServiceLookup from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded java.net.SocketAddress from shared objects file]

              [Loaded java.net.InetSocketAddress from shared objects file]

              [Loaded sun.awt.AppContext from shared objects file]

              [Loaded java.net.InetAddress from shared objects file]

              [Loaded java.util.logging.Logger from shared objects file]

              [Loaded java.util.logging.Handler from shared objects file]

              [Loaded sun.security.action.GetBooleanAction from shared objects file]

              [Loaded java.util.logging.Level from shared objects file]

              [Loaded java.util.logging.LogManager from shared objects file]

              [Loaded java.util.logging.LogManager$1 from shared objects file]

              [Loaded java.beans.PropertyChangeSupport from shared objects file]

              [Loaded java.util.logging.LogManager$LogNode from shared objects file]

              [Loaded java.util.logging.LoggingPermission from shared objects file]

              [Loaded java.util.logging.LogManager$Cleaner from shared objects file]

              [Loaded java.net.InetAddress$Cache from shared objects file]

              [Loaded java.lang.Enum from shared objects file]

              [Loaded java.lang.ApplicationShutdownHooks[Loaded java.net.InetAddress$Cache$Type from shared objects file]

              from shared objects file]

              [Loaded java.lang.ApplicationShutdownHooks$1 from shared objects file]

              [Loaded java.lang.Shutdown from shared objects file]

              [Loaded java.net.InetAddressImplFactory from shared objects file]

              [Loaded java.lang.Shutdown$Lock from shared objects file]

              [Loaded java.util.IdentityHashMap from shared objects file[Loaded java.net.InetAddressImpl from shared objects file]

              ]

              [Loaded java.net.Inet6AddressImpl from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded java.util.logging.LogManager$RootLogger from shared objects file]

              [Loaded java.util.logging.LogManager$2 from shared objects file]

              [Loaded sun.net.spi.nameservice.NameService from shared objects file]

              [Loaded java.net.InetAddress$1 from shared objects file]

              [Loaded java.net.Inet4AddressImpl from shared objects file]

              [Loaded java.net.Inet4Address from shared objects file]

              [Loaded java.util.Properties$LineReader from shared objects file]

              [Loaded java.util.Hashtable$Enumerator from shared objects file]

              [Loaded java.util.EventObject from shared objects file]

              [Loaded java.beans.PropertyChangeEvent from shared objects file]

              [Loaded java.util.logging.LogManager$3 from shared objects file]

              [Loaded sun.awt.AppContext$1 from shared objects file]

              [Loaded sun.awt.AppContext$2 from shared objects file]

              [Loaded java.net.Socket from shared objects file]

              [Loaded javax.print.PrintServiceLookup$Services from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded sun.awt.MostRecentKeyValue from shared objects file]

              [Loaded javax.print.PrintServiceLookup$1 from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded sun.misc.Service from shared objects file]

              [Loaded sun.misc.Service$LazyIterator from shared objects file]

              [Loaded java.util.SortedSet from shared objects file]

              [Loaded java.util.NavigableSet from shared objects file]

              [Loaded java.util.TreeSet from shared objects file]

              [Loaded java.util.SortedMap from shared objects file]

              [Loaded java.util.NavigableMap from shared objects file]

              [Loaded java.util.TreeMap from shared objects file]

              [Loaded sun.misc.Launcher$1 from shared objects file]

              [Loaded sun.misc.Launcher$2 from shared objects file]

              [Loaded sun.misc.URLClassPath$2 from shared objects file]

              [Loaded java.lang.ClassLoader$2 from shared objects file]

              [Loaded sun.misc.URLClassPath$1 from shared objects file]

              [Loaded java.net.URLClassLoader$3 from shared objects file]

              [Loaded sun.misc.CompoundEnumeration from shared objects file]

              [Loaded java.net.JarURLConnection from shared objects file]

              [Loaded sun.net.www.protocol.jar.JarURLConnection from shared objects file]

              [Loaded sun.net.www.protocol.jar.URLJarFile$URLJarFileCloseController from shared objects file]

              [Loaded sun.net.www.protocol.jar.JarFileFactory from shared objects file]

              [Loaded sun.net.www.protocol.jar.URLJarFile from shared objects file]

              [Loaded sun.net.www.protocol.jar.URLJarFile$URLJarFileEntry from shared objects file]

              [Loaded sun.net.www.protocol.jar.JarURLConnection$JarURLInputStream from shared objects file]

              [Loaded java.util.TreeMap$Entry from shared objects file]

              [Loaded java.util.AbstractList$Itr from shared objects file]

              [Loaded sun.print.Win32PrintServiceLookup from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded sun.print.Win32PrintServiceLookup$PrinterChangeListener from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded java.io.FileNotFoundException from shared objects file]

              [Loaded java.net.URLClassLoader$3$1 from shared objects file]

              [Loaded javax.print.PrintService from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded sun.print.AttributeUpdater from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded sun.print.SunPrinterJobService from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded sun.print.Win32PrintService from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.attribute.Attribute from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.attribute.DocAttribute from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.attribute.PrintRequestAttribute from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.attribute.PrintJobAttribute from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.attribute.EnumSyntax from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.attribute.standard.Media from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.attribute.standard.MediaSizeName from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded sun.print.Win32MediaSize from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.DocFlavor$BYTE_ARRAY from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.DocFlavor$INPUT_STREAM from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.DocFlavor$URL from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.attribute.PrintServiceAttribute from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.attribute.TextSyntax from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.attribute.standard.PrinterName from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.attribute.standard.PrinterIsAcceptingJobs from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.attribute.IntegerSyntax from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.attribute.standard.QueuedJobCount from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.attribute.standard.ColorSupported from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.attribute.standard.JobName from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.attribute.standard.RequestingUserName from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.attribute.standard.Copies from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.attribute.URISyntax from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.attribute.standard.Destination from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.attribute.standard.OrientationRequested from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.attribute.SetOfIntegerSyntax from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.attribute.standard.PageRanges from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.attribute.standard.MediaPrintableArea from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.attribute.standard.Fidelity from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.attribute.standard.SheetCollate from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded sun.print.SunAlternateMedia from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.attribute.standard.Chromaticity from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded javax.print.attribute.standard.MediaTray from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded sun.print.Win32MediaTray from C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar]

              [Loaded java.util.IdentityHashMap$KeySet from shared objects file]

              [Loaded java.util.IdentityHashMap$IdentityHashMapIterator from shared objects file]

              [Loaded java.util.IdentityHashMap$KeyIterator from shared objects file]

              8

              • 4. Re: lookupPrintServices return an empty array with jboss 7
                max wallace Newbie

                Hi Darran,

                Thank you for your answer. It's a good remark.

                 

                In the standalone configuration I have more classes loaded.

                If I keep only the part with javax.print, I have :

                [Loaded javax.print.attribute.DocAttribute from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.attribute.PrintRequestAttribute from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.attribute.PrintJobAttribute from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.attribute.EnumSyntax from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.attribute.standard.Media from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.attribute.standard.MediaSizeName from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded sun.print.Win32MediaSize from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.DocFlavor$BYTE_ARRAY from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.DocFlavor$URL from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.attribute.PrintServiceAttribute from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.attribute.TextSyntax from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.attribute.standard.PrinterName from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.attribute.standard.PrinterIsAcceptingJobs from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.attribute.IntegerSyntax from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.attribute.standard.QueuedJobCount from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.attribute.standard.ColorSupported from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.attribute.standard.JobName from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.attribute.standard.RequestingUserName from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.attribute.standard.Copies from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.attribute.URISyntax from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.attribute.standard.Destination from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.attribute.standard.OrientationRequested from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.attribute.SetOfIntegerSyntax from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.attribute.standard.PageRanges from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.attribute.standard.MediaPrintableArea from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.attribute.standard.Fidelity from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.attribute.standard.SheetCollate from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded sun.print.SunAlternateMedia from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.attribute.standard.Chromaticity from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.attribute.standard.MediaTray from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded sun.print.Win32MediaTray from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                ===> 5

                 

                And in the Jboss, I have only

                [Loaded javax.print.DocFlavor$SERVICE_FORMATTED from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.MimeType from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.MimeType$LexicalAnalyzer from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.PrintServiceLookup from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.PrintServiceLookup$Services from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded sun.awt.MostRecentKeyValue from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.PrintServiceLookup$1 from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                [Loaded javax.print.PrintService from C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar]

                ===> 0

                 

                I don't understand why with Jboss, there is a lot of classes that are not loaded.

                It is probably the problem but I don't see how force jboss to load the classes as a standalone application.

                I search if there is a specific configuration for a windows server.

                I keep you inform if I found more elements or a solution.

                • 5. Re: lookupPrintServices return an empty array with jboss 7
                  Dome Santoro Newbie

                  Hello Guys...

                   

                  Is there any new about? This is gonna crash down an entire (big) project of mine. Solving this issue is fundamental. Hope someone to have some idea about.

                  Thanks

                  • 6. Re: lookupPrintServices return an empty array with jboss 7
                    max wallace Newbie

                    No.

                    I didn't find a solution exept keeping my project running under jboss 5.

                    • 7. Re: lookupPrintServices return an empty array with jboss 7
                      James Livingston Apprentice

                      The cause of this is that the META-INF/services/javax.print.PrintServiceLookup resource from the JRE isn't available in your classloader. Without that there are no implementations of the printer lookup available, so it does not find any printers.

                       

                      To fix this:

                      1) Edit modules/sun/jdk/main/module.xml and add this with the other paths:

                        <path name="sun/print"/>

                      2) Open up resources.jar from your JRE, and extract META-INF/services/javax.print.PrintServiceLookup (and optionally the others) into modules/sun/jdk/main/service-loader-resources/META-INF/services

                      • 8. Re: lookupPrintServices return an empty array with jboss 7
                        Daniel Rosowski Newbie

                        Thanks for your help. After adding javax.print.PrintServiceLookup it worked!

                        • 9. Re: lookupPrintServices return an empty array with jboss 7
                          Tomaz Cerar Master

                          Hi,

                           

                          just for info, this issue was fixed in latest nightly builds.

                           

                           

                          --

                          tomaz

                          • 10. Re: lookupPrintServices return an empty array with jboss 7
                            James Livingston Apprentice

                            https://issues.jboss.org/browse/AS7-5158 fixed it so you don't need to do part (1), but you still currently need to do (2) because the JDK's META-INF/services is not visible to other modules.

                            • 11. Re: lookupPrintServices return an empty array with jboss 7
                              Tomaz Cerar Master

                              James,

                               

                              can you please create issue for that, so we can track and resolve it.

                               

                              tnx,

                              tomaz

                              • 13. Re: lookupPrintServices return an empty array with jboss 7
                                max wallace Newbie

                                Thank you very much James.

                                Your solution works fine.

                                I use now Jboss 7 without problem.