List of usage examples for java.lang ClassNotFoundException getMessage
public String getMessage()
From source file:fusion.FuseLinkServlet.java
/** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods.//from ww w .j ava 2 s .c o m * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); HttpSession sess = request.getSession(true); try { dbConf = (DBConfig) sess.getAttribute("db_conf"); grConf = (GraphConfig) sess.getAttribute("gr_conf"); fs = (FusionState) sess.getAttribute("fstate"); nodeA = (String) sess.getAttribute("nodeA"); nodeB = (String) sess.getAttribute("nodeB"); tGraph = (String) sess.getAttribute("t_graph"); try { vSet = new VirtGraph("jdbc:virtuoso://" + dbConf.getDBURL() + "/CHARSET=UTF-8", dbConf.getUsername(), dbConf.getPassword()); } catch (JenaException connEx) { System.out.println(connEx.getMessage()); out.println("Connection to virtuoso failed"); out.close(); return; } try { Class.forName("org.postgresql.Driver"); } catch (ClassNotFoundException ex) { System.out.println(ex.getMessage()); out.println("Class of postgis failed"); out.close(); return; } try { String url = DB_URL.concat(dbConf.getDBName()); dbConn = DriverManager.getConnection(url, dbConf.getDBUsername(), dbConf.getDBPassword()); dbConn.setAutoCommit(false); } catch (SQLException sqlex) { System.out.println(sqlex.getMessage()); out.println("Connection to postgis failed"); out.close(); return; } String[] props = request.getParameterValues("props[]"); System.out.println("Fusing : " + nodeA + " " + nodeB); AbstractFusionTransformation trans = null; for (int i = 0; i < 5; i += 5) { System.out.println(props[3]); trans = FuserPanel.transformations.get(props[3]); System.out.println(trans == null); trans.fuse(dbConn, nodeA, nodeB); } VirtuosoImporter virtImp = (VirtuosoImporter) sess.getAttribute("virt_imp"); virtImp.setTransformationID(trans.getID()); virtImp.importGeometriesToVirtuoso((String) sess.getAttribute("t_graph")); for (int i = 5; i < props.length; i += 5) { System.out.println("Pred : " + props[i]); System.out.println("Pred : " + props[i + 1]); System.out.println("Pred : " + props[i + 2]); System.out.println("Pred : " + props[i + 3]); System.out.println("Pred : " + props[i + 4]); handleMetadataFusion(props[i + 3], i); } System.out.println("List : " + fs.actions); System.out.println("List : " + fs.objsA); System.out.println("List : " + fs.objsB); System.out.println("List : " + fs.preds); System.out.println("List : " + fs.predsA); System.out.println("List : " + fs.predsB); virtImp.trh.finish(); //System.out.println(FuserPanel.transformations); /* TODO output your page here. You may use following sample code. */ out.println("<!DOCTYPE html>"); out.println("<html>"); out.println("<head>"); out.println("<title>Servlet FuseLinkServlet</title>"); out.println("</head>"); out.println("<body>"); out.println("<h1>Servlet FuseLinkServlet at " + request.getContextPath() + "</h1>"); out.println("</body>"); out.println("</html>"); } finally { if (rs != null) { try { rs.close(); } catch (SQLException ex) { Logger.getLogger(FuseLinkServlet.class.getName()).log(Level.SEVERE, null, ex); } } if (stmt != null) { try { stmt.close(); } catch (SQLException ex) { Logger.getLogger(FuseLinkServlet.class.getName()).log(Level.SEVERE, null, ex); } } if (dbConn != null) { try { dbConn.close(); } catch (SQLException ex) { Logger.getLogger(FuseLinkServlet.class.getName()).log(Level.SEVERE, null, ex); } } out.close(); } }
From source file:name.livitski.tools.persista.StorageBootstrap.java
/** * Returns the list of entity classes configured for this * object's {@link #getPersistenceUnit() persistence unit} * or an empty list if no classes have been configured. * Persistence unit's XML descriptor is expected to list * all its persistent classes explicitly. * @throws StorageConfigurationException if there is a problem * reading persistence unit configuration * @throws IllegalStateException if a persistent class cannot * be loaded/*from ww w .j a va 2 s . c o m*/ */ public List<Class<?>> getEntityClasses() throws StorageConfigurationException { if (null == entities) { final ClassLoader loader = Thread.currentThread().getContextClassLoader(); final URL resource = loader.getResource(PERSISTENCE_RESOURCE); if (null == resource) throw new IllegalStateException("Persistence metadata is not deployed in " + PERSISTENCE_RESOURCE); try { final String persistenceUnit = getPersistenceUnit(); final List<PersistenceMetadata> descriptor = PersistenceXmlLoader.deploy(resource, Collections.emptyMap(), new EntityResolverStub(log()), PersistenceUnitTransactionType.RESOURCE_LOCAL); PersistenceMetadata source = null; for (PersistenceMetadata candidate : descriptor) if (candidate.getName().equals(persistenceUnit)) { source = candidate; break; } if (null == source) throw new ConfigurationException( "Persistence unit '" + persistenceUnit + "' is not defined in " + resource + ". "); entities = new ArrayList<Class<?>>(); for (String qName : source.getClasses()) entities.add(Class.forName(qName, false, loader)); } catch (ClassNotFoundException noclass) { throw new IllegalStateException("Could not load persistent class. " + noclass.getMessage(), noclass); } catch (ConfigurationException e) { throw new StorageConfigurationException(this, e); } catch (Exception e) { throw new StorageConfigurationException(this, "Error parsing persistence metadata at " + resource + ". " + e.getMessage(), e); } } return Collections.unmodifiableList(entities); }
From source file:com.snaplogic.snaps.firstdata.Create.java
private ObjectSchema getSchema(SchemaProvider provider, Class<?> classType, SnapType snapType) { ArrayList<Method> getterMethods = findGetters(classType); ObjectSchema schema = null;//from w ww . ja v a 2s. co m if (!getterMethods.isEmpty()) { schema = provider.createSchema(snapType, classType.getSimpleName()); } String name; String paramType; Class<?> subClass; Class<?> fieldTypeParameterType; ObjectSchema subSchema; ParameterizedType fieldGenericType; for (Method method : getterMethods) { try { paramType = method.getReturnType().getName(); if (paramType.startsWith(FD_PROXY_PKG_PREFIX) && !paramType.endsWith(TYPE)) { try { subClass = Class.forName(paramType); } catch (ClassNotFoundException e) { log.error(e.getMessage(), e); throw new ExecutionException(e.getMessage()); } subSchema = getSchema(provider, subClass, SnapType.STRING); if (subSchema != null) { schema.addChild(subSchema); } } else if (paramType.endsWith(List.class.getSimpleName())) { fieldGenericType = (ParameterizedType) method.getGenericReturnType(); fieldTypeParameterType = (Class<?>) fieldGenericType.getActualTypeArguments()[0]; if (fieldTypeParameterType == String.class) { subSchema = provider.createSchema(SnapType.COMPOSITE, getFieldName(method.getName())); } else { subSchema = getSchema(provider, fieldTypeParameterType, SnapType.COMPOSITE); } if (subSchema != null) { schema.addChild(subSchema); } } else { name = getFieldName(method.getName()); schema.addChild(provider.createSchema(getDataTypes(paramType), name)); } } catch (Exception e) { log.error(e.getMessage(), e); return null; } } return schema; }
From source file:org.apache.fop.cli.InputHandler.java
/** * Creates a catalog resolver and uses it for XML parsing and XSLT URI resolution. * Tries the Apache Commons Resolver, and if unsuccessful, * tries the same built into Java 6.// ww w . ja v a2 s . com * @param userAgent the user agent instance */ public void createCatalogResolver(FOUserAgent userAgent) { String[] classNames = new String[] { "org.apache.xml.resolver.tools.CatalogResolver", "com.sun.org.apache.xml.internal.resolver.tools.CatalogResolver" }; ResourceEventProducer eventProducer = ResourceEventProducer.Provider.get(userAgent.getEventBroadcaster()); Class resolverClass = null; for (int i = 0; i < classNames.length && resolverClass == null; ++i) { try { resolverClass = Class.forName(classNames[i]); } catch (ClassNotFoundException e) { // No worries } } if (resolverClass == null) { eventProducer.catalogResolverNotFound(this); return; } try { entityResolver = (EntityResolver) resolverClass.newInstance(); uriResolver = (URIResolver) resolverClass.newInstance(); } catch (InstantiationException e) { log.error("Error creating the catalog resolver: " + e.getMessage()); eventProducer.catalogResolverNotCreated(this, e.getMessage()); } catch (IllegalAccessException e) { log.error("Error creating the catalog resolver: " + e.getMessage()); eventProducer.catalogResolverNotCreated(this, e.getMessage()); } }
From source file:be.fedict.eid.idp.model.bean.ProtocolServiceManagerBean.java
public IdentityProviderProtocolService getProtocolService( IdentityProviderProtocolType identityProviderProtocol) { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); LOG.debug("loading protocol service class: " + identityProviderProtocol.getProtocolService()); Class<?> protocolServiceClass; try {//from w ww. ja va2s. c om protocolServiceClass = classLoader.loadClass(identityProviderProtocol.getProtocolService()); } catch (ClassNotFoundException e) { LOG.error("protocol service class not found: " + identityProviderProtocol.getProtocolService(), e); return null; } if (!IdentityProviderProtocolService.class.isAssignableFrom(protocolServiceClass)) { LOG.error("illegal protocol service class: " + identityProviderProtocol.getProtocolService()); return null; } IdentityProviderProtocolService protocolService; try { protocolService = (IdentityProviderProtocolService) protocolServiceClass.newInstance(); } catch (Exception e) { LOG.error("could not init the protocol service object: " + e.getMessage(), e); return null; } return protocolService; }
From source file:com.evolveum.midpoint.prism.marshaller.PrismBeanInspector.java
private Class getObjectFactoryClassUncached(Package pkg) { try {/*w w w . j a v a 2s . c om*/ return Class.forName(pkg.getName() + ".ObjectFactory"); } catch (ClassNotFoundException e) { throw new IllegalArgumentException( "Cannot find object factory class in package " + pkg.getName() + ": " + e.getMessage(), e); } }
From source file:org.jenkinsci.plugins.GitLabSecurityRealm.java
/** * Calls {@code SecurityListener.fireAuthenticated()} but through reflection * to avoid hard dependency on non-LTS core version. TODO delete in 1.569+ *///from ww w. j av a 2 s .com private void fireAuthenticated(UserDetails details) { try { Class<?> c = Class.forName("jenkins.security.SecurityListener"); Method m = c.getMethod("fireAuthenticated", UserDetails.class); m.invoke(null, details); } catch (ClassNotFoundException e) { // running with old core } catch (NoSuchMethodException e) { // running with old core } catch (IllegalAccessException e) { throw (Error) new IllegalAccessError(e.getMessage()).initCause(e); } catch (InvocationTargetException e) { LOGGER.log(Level.WARNING, "Failed to invoke fireAuthenticated", e); } }
From source file:com.servicelibre.jxsl.scenario.XslScenario.java
/** * Return or create the TransformerFactory * <ol>/*from www . ja v a 2 s. co m*/ * <li>via setter (Spring)</li> * <li>via system property</li> * <li>default (DEFAULT_TRANSFORMER_FACTORY)</li> * </ol> * */ public TransformerFactory getTransformerFactory() { if (transformerFactory == null) { try { transformerFactory = (TransformerFactory) Class.forName(getTransformerFactoryFQCN()).newInstance(); } catch (ClassNotFoundException e) { logger.error(e.getMessage(), e); } catch (InstantiationException e) { logger.error(e.getMessage(), e); } catch (IllegalAccessException e) { logger.error(e.getMessage(), e); } } return transformerFactory; }
From source file:be.fedict.eid.idp.model.bean.AttributeServiceManagerBean.java
public IdentityProviderAttributeService getAttributeService( IdentityProviderAttributeType identityProviderAttribute) { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); LOG.debug("loading attribute service class: " + identityProviderAttribute.getAttributeService()); Class<?> attributeServiceClass; try {/*w ww.j a va2 s. c o m*/ attributeServiceClass = classLoader.loadClass(identityProviderAttribute.getAttributeService()); } catch (ClassNotFoundException e) { LOG.error("attribute service class not found: " + identityProviderAttribute.getAttributeService(), e); return null; } if (!IdentityProviderAttributeService.class.isAssignableFrom(attributeServiceClass)) { LOG.error("illegal attribute service class: " + identityProviderAttribute.getAttributeService()); return null; } IdentityProviderAttributeService attributeService; try { attributeService = (IdentityProviderAttributeService) attributeServiceClass.newInstance(); } catch (Exception e) { LOG.error("could not init the attribute service object: " + e.getMessage(), e); return null; } return attributeService; }
From source file:de.raion.xmppbot.XmppBot.java
private Map<String, Class<AbstractXmppCommand>> loadCommands(List<String> commandClasses) throws CLIInitException { Map<String, Class<AbstractXmppCommand>> commandMap = new HashMap<String, Class<AbstractXmppCommand>>(); for (String commandClassName : commandClasses) { try {/*from w w w . j a v a 2 s . co m*/ @SuppressWarnings("unchecked") Class<AbstractXmppCommand> commandClass = (Class<AbstractXmppCommand>) Class .forName(commandClassName); if (AbstractXmppCommand.class.isAssignableFrom(commandClass)) { CLICommand annotation = commandClass.getAnnotation(CLICommand.class); commandMap.put(annotation.name().toLowerCase(), commandClass); log.debug("Loaded command [" + annotation.name() + "]."); } } catch (ClassNotFoundException e) { throw new CLIInitException("Unable to find command class [" + commandClassName + "]."); } catch (Exception e) { throw new CLIInitException( "Unable to load command class [" + commandClassName + "]: " + e.getMessage()); } } return commandMap; }