List of usage examples for java.lang ClassNotFoundException getMessage
public String getMessage()
From source file:cz.cuni.mff.d3s.been.mapstore.mongodb.MongoMapStore.java
@Override public Object load(Object key) { try {// w w w . ja v a 2 s . c om DBObject dbo = new BasicDBObject(); dbo.put("_id", key); DBObject obj = coll.findOne(dbo); if (obj == null) return null; try { Class clazz = Class.forName(obj.get("_class").toString()); Object object = converter.toObject(clazz, obj); if (object instanceof TaskEntry) { setLoadedFromMapStore((TaskEntry) object); } return object; } catch (ClassNotFoundException e) { log.error(e.getMessage(), e); } return null; } catch (Throwable t) { String msg = String.format("Cannot load key '%s' of map '%s'", key.toString(), mapName); log.error(msg, t); return null; } }
From source file:org.apache.axis2.deployment.POJODeployer.java
public void setMessageReceivers(AxisService service) { Iterator<AxisOperation> iterator = service.getOperations(); while (iterator.hasNext()) { AxisOperation operation = iterator.next(); String MEP = operation.getMessageExchangePattern(); if (MEP != null) { try { if (WSDL2Constants.MEP_URI_IN_ONLY.equals(MEP)) { Class<?> inOnlyMessageReceiver = Loader .loadClass("org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"); MessageReceiver messageReceiver = (MessageReceiver) inOnlyMessageReceiver.newInstance(); operation.setMessageReceiver(messageReceiver); } else { Class<?> inoutMessageReceiver = Loader .loadClass("org.apache.axis2.rpc.receivers.RPCMessageReceiver"); MessageReceiver inOutmessageReceiver = (MessageReceiver) inoutMessageReceiver.newInstance(); operation.setMessageReceiver(inOutmessageReceiver); }//from w ww . j ava 2 s . c o m } catch (ClassNotFoundException e) { log.error(e.getMessage(), e); } catch (InstantiationException e) { log.error(e.getMessage(), e); } catch (IllegalAccessException e) { log.error(e.getMessage(), e); } } } }
From source file:com.wso2telco.claims.RemoteClaimsRetriever.java
public Map<String, Object> getTotalClaims(String operatorName, CustomerInfo customerInfo) throws IllegalAccessException, InstantiationException, ClassNotFoundException { Map<String, Object> totalClaims; try {/* ww w . jav a2s . com*/ totalClaims = getRemoteTotalClaims(operatorName, customerInfo); } catch (ClassNotFoundException e) { log.error("Class Not Found Exception occurred when calling operator'd endpoint - " + operatorName + ":" + e); throw new ClassNotFoundException(e.getMessage(), e); } catch (InstantiationException e) { log.error("Instantiation Exception occurred when calling operator'd endpoint - " + operatorName + ":" + e); throw new InstantiationException(e.getMessage()); } catch (IllegalAccessException e) { log.error("Illegal Access Exception occurred when calling operator'd endpoint - " + operatorName + ":" + e); throw new IllegalAccessException(e.getMessage()); } return totalClaims; }
From source file:cz.cuni.mff.d3s.been.mapstore.mongodb.MongoMapStore.java
@Override public Map loadAll(Collection keys) { try {/*from ww w.j a v a 2s. c om*/ Map map = new HashMap(); BasicDBList dbo = new BasicDBList(); for (Object key : keys) { dbo.add(new BasicDBObject("_id", key)); } BasicDBObject dbb = new BasicDBObject("$or", dbo); DBCursor cursor = coll.find(dbb); while (cursor.hasNext()) { try { DBObject obj = cursor.next(); Class clazz = Class.forName(obj.get("_class").toString()); Object object = converter.toObject(clazz, obj); if (object instanceof TaskEntry) { setLoadedFromMapStore((TaskEntry) object); } map.put(obj.get("_id"), object); } catch (ClassNotFoundException e) { log.error(e.getMessage(), e); } } return map; } catch (Throwable t) { log.warn("Cannot load collection from MongoDB", t); } finally { mapIsLoaded = true; } return null; }
From source file:autohit.vm.VMLoader.java
/** * Get a call. If it isn't in the cache, load it. There is no thread * safety here at all! However, it shouldn't matter since there is a * loader per VM.//from w w w .ja v a 2s . c o m * @param name of routine to load * @param core a VMCore that holds a callcache * @param li log injector to give to the call * @return runnable call * @throws VMException unable to load. */ public Call get(String name, VMCore core, AutohitLogInjectorWrapper li) throws VMException { if (core.callcache.containsKey(name)) { // cache hit //log.debug( // "Loader(call-basic): cache hit [" + name + "].", // AutohitErrorCodes.LOG_INFORMATIONAL_OK); return (Call) core.callcache.get(name); } Call c = null; try { String decoratedName = "autohit.call.Call_" + name.toUpperCase(); Class t = Class.forName(decoratedName); c = (Call) t.newInstance(); Universe u = sc.getUniverse(); c.load(core, sc, li); log.debug("Loader(call-basic): Instantiated a [" + name + "].", AutohitErrorCodes.CODE_INFORMATIONAL_OK_VERBOSE); core.callcache.put(name, c); } catch (ClassNotFoundException ef) { throw new VMException("Loader(call-basic): CALL does not exist. error=" + ef.getMessage(), VMException.CODE_VM_GENERAL_FAULT, ef); } catch (CallException ex) { throw new VMException( "Loader(call-basic): Instantiation error for [" + name + "]. Not aborting, but state of CALL undefined. Error=" + ex.getMessage(), VMException.CODE_VM_CALL_FAULT, ex); } catch (Exception e) { throw new VMException("Loader(call-basic): CALL does not exist. error=" + e.getMessage(), VMException.CODE_VM_GENERAL_FAULT, e); } return c; }
From source file:io.netty.example.file.FileServerHandler.java
private void initDbPool() { logger.debug("init db pool"); try {//www.j ava 2 s. c o m Class.forName(FileServerConstants.DB_DRIVER); } catch (ClassNotFoundException e) { logger.info(e.getMessage()); } try { // setup the connection pool BoneCPConfig config = new BoneCPConfig(); config.setJdbcUrl(FileServerConstants.DB_CONNECTION); config.setUsername(FileServerConstants.DB_USER); config.setPassword(FileServerConstants.DB_PASSWORD); config.setMinConnectionsPerPartition(5); config.setMaxConnectionsPerPartition(10); config.setPartitionCount(1); connectionPool = new BoneCP(config); } catch (SQLException e) { logger.fatal(e.getMessage()); } }
From source file:com.jaspersoft.studio.data.tools.mapping.BeanMappingTool.java
public Control createControl(Composite parent) { control = new Composite(parent, SWT.NONE); control.setLayout(new GridLayout(3, false)); Label label = new Label(control, SWT.NONE); label.setText(Messages.BeanMappingTool_labeltitle); final ClassType classType = new ClassType(control, ""); //$NON-NLS-1$ classType.addListener(new ModifyListener() { public void modifyText(ModifyEvent e) { try { errMsg.setText(""); //$NON-NLS-1$ JasperReportsConfiguration jConfig = dataQueryAdapters.getjConfig(); Class<?> clazz = jConfig.getClassLoader().loadClass(classType.getClassType()); methodsarray = PropertyUtils.getPropertyDescriptors(clazz); String[] strm = new String[methodsarray.length]; for (int i = 0; i < methodsarray.length; i++) { strm[i] = methodsarray[i].getName(); }/* w w w . java 2 s . c o m*/ methods.setItems(strm); } catch (ClassNotFoundException e1) { errMsg.setText(Messages.BeanMappingTool_errormessage + e1.getMessage()); } } }); methods = new org.eclipse.swt.widgets.List(control, SWT.MULTI | SWT.READ_ONLY | SWT.BORDER | SWT.V_SCROLL); methods.setItems(new String[] {}); GridData gd = new GridData(GridData.FILL_BOTH); gd.horizontalSpan = 3; methods.setLayoutData(gd); Composite bottomToolbar = new Composite(control, SWT.NONE); GridLayout btGL = new GridLayout(3, false); btGL.marginWidth = 0; btGL.marginHeight = 0; bottomToolbar.setLayout(btGL); bottomToolbar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 3, 1)); Button gfbtn = new Button(bottomToolbar, SWT.PUSH); gfbtn.setText(Messages.BeanMappingTool_selectfieldstitle); gfbtn.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); gfbtn.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { int[] items = methods.getSelectionIndices(); if (methodsarray != null && items != null) { List<JRDesignField> flist = new ArrayList<JRDesignField>(); for (int i = 0; i < items.length; i++) { JRDesignField f = new JRDesignField(); f.setName(methodsarray[items[i]].getName()); Class<?> propertyType = methodsarray[items[i]].getPropertyType(); if (propertyType != null) f.setValueClassName(getClassName(propertyType)); else f.setValueClass(Object.class); String description = methodsarray[items[i]].getShortDescription(); if (description != null) f.setDescription(description); flist.add(f); } fsetter.addFields(flist); } } public void widgetDefaultSelected(SelectionEvent e) { widgetSelected(e); } }); Button clearBtn = new Button(bottomToolbar, SWT.PUSH); clearBtn.setText(Messages.BeanMappingTool_17); clearBtn.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); clearBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetDefaultSelected(SelectionEvent e) { widgetSelected(e); } @Override public void widgetSelected(SelectionEvent e) { fsetter.clearFields(); } }); errMsg = new Label(bottomToolbar, SWT.RIGHT); errMsg.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); return control; }
From source file:com.google.api.ads.adwords.awreporting.model.csv.CsvReportEntitiesMapping.java
/** * Initializes the report type definition map. * * The base package is scanned in order to find the candidates to report beans, and the map of * {@code ReportDefinitionReportType} to the report bean class is created, based on the annotated * classes./*from w ww . j a v a 2 s . com*/ * */ public void initializeReportMap() { List<Class<? extends Report>> reportBeans; try { reportBeans = this.findReportBeans(this.packageToScan); } catch (ClassNotFoundException e) { LOGGER.severe("Class not found in classpath: " + e.getMessage()); throw new IllegalStateException(e); } catch (IOException e) { LOGGER.severe("Could not read class file: " + e.getMessage()); throw new IllegalStateException(e); } for (Class<? extends Report> reportBeanClass : reportBeans) { CsvReport csvReport = reportBeanClass.getAnnotation(CsvReport.class); this.reportDefinitionMap.put(csvReport.value(), reportBeanClass); Set<String> propertyExclusions = new HashSet<String>(); String[] reportExclusionsArray = csvReport.reportExclusions(); propertyExclusions.addAll(Arrays.asList(reportExclusionsArray)); List<String> propertiesToSelect = this.findReportPropertiesToSelect(reportBeanClass, propertyExclusions); this.reportProperties.put(csvReport.value(), propertiesToSelect); } }
From source file:fr.paris.lutece.plugins.calendar.service.EventListService.java
/** * Load an eventlist object from its keyname * @param nViewType The viewtype of the EventList * @return An EventList object//w ww. ja v a 2 s .co m */ public EventList newEventList(int nViewType) { EventList eventlist = null; String strEventListKeyName = StringUtils.EMPTY; switch (nViewType) { case CalendarView.TYPE_DAY: strEventListKeyName = AppPropertiesService.getProperty(Constants.PROPERTY_EVENTLIST_VIEW_DAY); break; case CalendarView.TYPE_WEEK: strEventListKeyName = AppPropertiesService.getProperty(Constants.PROPERTY_EVENTLIST_VIEW_WEEK); break; case CalendarView.TYPE_MONTH: strEventListKeyName = AppPropertiesService.getProperty(Constants.PROPERTY_EVENTLIST_VIEW_MONTH); break; default: } if (StringUtils.isNotEmpty(strEventListKeyName)) { String strClassKey = Constants.PROPERTY_EVENTLIST + strEventListKeyName + Constants.SUFFIX_CLASS; String strClass = AppPropertiesService.getProperty(strClassKey); try { eventlist = (EventList) Class.forName(strClass).newInstance(); } catch (ClassNotFoundException e) { AppLogService.error(e.getMessage(), e); } catch (IllegalAccessException e) { AppLogService.error(e.getMessage(), e); } catch (InstantiationException e) { AppLogService.error(e.getMessage(), e); } } return eventlist; }
From source file:org.candlepin.resource.JobResource.java
@ApiOperation(notes = "Triggers select asynchronous jobs", value = "schedule") @ApiResponses({ @ApiResponse(code = 400, message = ""), @ApiResponse(code = 500, message = "") }) @POST/*from w w w .j a v a2 s . co m*/ @Path("schedule/{task}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @SuppressWarnings("unchecked") public JobStatus schedule(@PathParam("task") String task) { /* * at the time of implementing this API, the only jobs that * are permissible are cron jobs. */ String className = "org.candlepin.pinsetter.tasks." + task; try { boolean allowed = false; for (String permissibleJob : ConfigProperties.DEFAULT_TASK_LIST) { if (className.equalsIgnoreCase(permissibleJob)) { allowed = true; // helps ignore case className = permissibleJob; } } if (allowed) { Class taskClass = Class.forName(className); return pk.scheduleSingleJob((Class<? extends KingpinJob>) taskClass, Util.generateUUID()); } else { throw new BadRequestException(i18n.tr("Not a permissible job: {0}. Only {1} are permissible", task, prettyPrintJobs(ConfigProperties.DEFAULT_TASK_LIST))); } } catch (ClassNotFoundException e) { throw new IseException(i18n.tr("Error trying to schedule {0}: {1}", className, e.getMessage())); } catch (PinsetterException e) { throw new IseException(i18n.tr("Error trying to schedule {0}: {1}", className, e.getMessage())); } }