/** * Creates a class loader for loading JAXB/WS 2.2 jar */ private static URL[] findIstack22APIs(ClassLoader cl) throws ClassNotFoundException, IOException { List<URL> urls = new ArrayList<URL>(); if(Service.class.getClassLoader()==null) { // JAX-WS API is loaded from bootstrap class loader URL res = cl.getResource("javax/xml/ws/EndpointContext.class"); if(res==null) throw new ClassNotFoundException("There's no JAX-WS 2.2 API in the classpath"); urls.add(ParallelWorldClassLoader.toJarUrl(res)); res = cl.getResource("javax/xml/bind/JAXBPermission.class"); if(res==null) throw new ClassNotFoundException("There's no JAXB 2.2 API in the classpath"); urls.add(ParallelWorldClassLoader.toJarUrl(res)); } return urls.toArray(new URL[urls.size()]); }
static File getJarFile(Class clazz) { URL url = null; try { url = ParallelWorldClassLoader.toJarUrl(clazz.getResource('/'+clazz.getName().replace('.','/')+".class")); return new File(url.toURI()); } catch (ClassNotFoundException e) { // if we can't figure out where JAXB/JAX-WS API are, we couldn't have been executing this code. throw new Error(e); } catch (MalformedURLException e) { // if we can't figure out where JAXB/JAX-WS API are, we couldn't have been executing this code. throw new Error(e); } catch (URISyntaxException e) { // url.toURI() is picky and doesn't like ' ' in URL, so this is the fallback return new File(url.getPath()); } }
/** * Creates a class loader for loading JAXB/WS 2.2 jar */ private static URL[] findIstack22APIs(ClassLoader cl) throws ClassNotFoundException, IOException { List<URL> urls = new ArrayList<URL>(); if(Service.class.getClassLoader()==null) { // JAX-WS API is loaded from bootstrap class loader URL res = cl.getResource("javax/xml/ws/EndpointContext.class"); if(res==null) throw new ClassNotFoundException("There's no JAX-WS 2.2 API in the classpath"); urls.add(ParallelWorldClassLoader.toJarUrl(res)); res = cl.getResource("javax/xml/bind/JAXBPermission.class"); if(res==null) throw new ClassNotFoundException("There's no JAXB 2.2 API in the classpath"); urls.add(ParallelWorldClassLoader.toJarUrl(res)); } return urls.toArray(new URL[urls.size()]); }
static File getJarFile(Class clazz) { URL url = null; try { url = ParallelWorldClassLoader.toJarUrl(clazz.getResource('/'+clazz.getName().replace('.','/')+".class")); return new File(url.toURI()); } catch (ClassNotFoundException e) { // if we can't figure out where JAXB/JAX-WS API are, we couldn't have been executing this code. throw new Error(e); } catch (MalformedURLException e) { // if we can't figure out where JAXB/JAX-WS API are, we couldn't have been executing this code. throw new Error(e); } catch (URISyntaxException e) { // url.toURI() is picky and doesn't like ' ' in URL, so this is the fallback return new File(url.getPath()); } }
/** * Creates a class loader for loading JAXB/WS 2.2 jar */ private static URL[] findIstack22APIs(ClassLoader cl) throws ClassNotFoundException, IOException { List<URL> urls = new ArrayList<URL>(); if(Service.class.getClassLoader()==null) { // JAX-WS API is loaded from bootstrap class loader URL res = cl.getResource("javax/xml/ws/EndpointContext.class"); if(res==null) throw new ClassNotFoundException("There's no JAX-WS 2.2 API in the classpath"); urls.add(ParallelWorldClassLoader.toJarUrl(res)); res = cl.getResource("javax/xml/bind/JAXBPermission.class"); if(res==null) throw new ClassNotFoundException("There's no JAXB 2.2 API in the classpath"); urls.add(ParallelWorldClassLoader.toJarUrl(res)); } return urls.toArray(new URL[urls.size()]); }
/** * Creates a class loader for loading JAXB/WS 2.2 jar */ private static URL[] findIstack22APIs(ClassLoader cl) throws ClassNotFoundException, IOException { List<URL> urls = new ArrayList<URL>(); if(Service.class.getClassLoader()==null) { // JAX-WS API is loaded from bootstrap class loader URL res = cl.getResource("javax/xml/ws/EndpointContext.class"); if(res==null) throw new ClassNotFoundException("There's no JAX-WS 2.2 API in the classpath"); urls.add(ParallelWorldClassLoader.toJarUrl(res)); res = cl.getResource("javax/xml/bind/JAXBPermission.class"); if(res==null) throw new ClassNotFoundException("There's no JAXB 2.2 API in the classpath"); urls.add(ParallelWorldClassLoader.toJarUrl(res)); } return urls.toArray(new URL[urls.size()]); }
static File getJarFile(Class clazz) { URL url = null; try { url = ParallelWorldClassLoader.toJarUrl(clazz.getResource('/'+clazz.getName().replace('.','/')+".class")); return new File(url.toURI()); } catch (ClassNotFoundException e) { // if we can't figure out where JAXB/JAX-WS API are, we couldn't have been executing this code. throw new Error(e); } catch (MalformedURLException e) { // if we can't figure out where JAXB/JAX-WS API are, we couldn't have been executing this code. throw new Error(e); } catch (URISyntaxException e) { // url.toURI() is picky and doesn't like ' ' in URL, so this is the fallback return new File(url.getPath()); } }
static File getJarFile(Class clazz) { URL url = null; try { url = ParallelWorldClassLoader.toJarUrl(clazz.getResource('/'+clazz.getName().replace('.','/')+".class")); return new File(url.toURI()); } catch (ClassNotFoundException e) { // if we can't figure out where JAXB/JAX-WS API are, we couldn't have been executing this code. throw new Error(e); } catch (MalformedURLException e) { // if we can't figure out where JAXB/JAX-WS API are, we couldn't have been executing this code. throw new Error(e); } catch (URISyntaxException e) { // url.toURI() is picky and doesn't like ' ' in URL, so this is the fallback return new File(url.getPath()); } }
@Override protected Enumeration<URL> findResources(String name) throws IOException { Enumeration<URL> en = getParent().getResources(prefix + name); while (en.hasMoreElements()) { try { jars.add(new JarFile(new File(toJarUrl(en.nextElement()).toURI()))); } catch (URISyntaxException ex) { //should not happen Logger.getLogger(ParallelWorldClassLoader.class.getName()).log(Level.WARNING, null, ex); } catch (IOException ex) { Logger.getLogger(ParallelWorldClassLoader.class.getName()).log(Level.WARNING, null, ex); } catch (ClassNotFoundException ex) { //ignore - not a jar } } return en; }
@Override protected URL findResource(String name) { URL u = getParent().getResource(prefix + name); if (u != null) { try { jars.add(new JarFile(new File(toJarUrl(u).toURI()))); } catch (URISyntaxException ex) { Logger.getLogger(ParallelWorldClassLoader.class.getName()).log(Level.WARNING, null, ex); } catch (IOException ex) { Logger.getLogger(ParallelWorldClassLoader.class.getName()).log(Level.WARNING, null, ex); } catch (ClassNotFoundException ex) { //ignore - not a jar } } return u; }
@Override protected Enumeration<URL> findResources(String name) throws IOException { Enumeration<URL> en = getParent().getResources(prefix + name); while (en.hasMoreElements()) { try { jars.add(new JarFile(new File(toJarUrl(en.nextElement()).toURI()))); } catch (URISyntaxException ex) { //should not happen Logger.getLogger(ParallelWorldClassLoader.class.getName()).log(Level.WARNING, null, ex); } catch (IOException ex) { Logger.getLogger(ParallelWorldClassLoader.class.getName()).log(Level.WARNING, null, ex); } catch (ClassNotFoundException ex) { //ignore - not a jar } } return en; }
@Override protected URL findResource(String name) { URL u = getParent().getResource(prefix + name); if (u != null) { try { jars.add(new JarFile(new File(toJarUrl(u).toURI()))); } catch (URISyntaxException ex) { Logger.getLogger(ParallelWorldClassLoader.class.getName()).log(Level.WARNING, null, ex); } catch (IOException ex) { Logger.getLogger(ParallelWorldClassLoader.class.getName()).log(Level.WARNING, null, ex); } catch (ClassNotFoundException ex) { //ignore - not a jar } } return u; }
throw new ClassNotFoundException("There's no JAXB 2.2 API in the classpath"); cl = new URLClassLoader(new URL[]{ParallelWorldClassLoader.toJarUrl(apiUrl)},cl);
throw new ClassNotFoundException("There's no JAXB 2.1 API in the classpath"); cl = new URLClassLoader(new URL[]{ParallelWorldClassLoader.toJarUrl(apiUrl)},cl);
throw new ClassNotFoundException("There's no JAXB 2.2 API in the classpath"); cl = new URLClassLoader(new URL[]{ParallelWorldClassLoader.toJarUrl(apiUrl)},cl);
throw new ClassNotFoundException("There's no JAXB 2.2 API in the classpath"); cl = new URLClassLoader(new URL[]{ParallelWorldClassLoader.toJarUrl(apiUrl)},cl);
throw new ClassNotFoundException("There's no JAXB 2.2 API in the classpath"); cl = new URLClassLoader(new URL[]{ParallelWorldClassLoader.toJarUrl(apiUrl)},cl);
throw new ClassNotFoundException("There's no JAXB 2.2 API in the classpath"); cl = new URLClassLoader(new URL[]{ParallelWorldClassLoader.toJarUrl(apiUrl)},cl);