raja.ra Posted August 10, 2021 Share Posted August 10, 2021 Hi Team,I am workiing on create custom jasper studio 6.17 plugin. After placing to dropins folder its showing in adpater list but when we are testing it getting below error - net.sf.jasperreports.engine.JRRuntimeException: No data adapter service factory registered for the "New Data Adapter 1" data adapter. at net.sf.jasperreports.data.DataAdapterServiceUtil.getService(DataAdapterServiceUtil.java:84) at com.jaspersoft.studio.data.wizard.AbstractDataAdapterWizard$3.runOperations(AbstractDataAdapterWizard.java:154) at com.jaspersoft.studio.utils.jobs.CheckedRunnableWithProgress$1.run(CheckedRunnableWithProgress.java:51) at java.base/java.lang.Thread.run(Thread.java:834) Package Name - com.jaspersoft.studio.data.wizardClass Name - AbstractDataAdapterWizardMethod - When pressing on Test button getting above exception on below highlighed code./** * This method is called when the test button is pressed */ public void widgetSelected(SelectionEvent e) { if (getContainer().getCurrentPage() == dataAdapterEditorPage) { final DataAdapter da = dataAdapterEditorPage.getDataAdapterEditor().getDataAdapter().getDataAdapter(); getWizardDialog().setTestButtonEnabled(false); try { getContainer().run(true, true, new CheckedRunnableWithProgress() { private DataAdapterService daService = null; @Override protected void runOperations(IProgressMonitor monitor) { monitor.beginTask("Testing Data Adapter", SWT.INDETERMINATE); ClassLoader oldCL = Thread.currentThread().getContextClassLoader(); try { ClassLoader cl = Thread.currentThread().getContextClassLoader(); IProject[] prjs = ResourcesPlugin.getWorkspace().getRoot().getProjects(); for (IProject p : prjs) { if (ProjectUtil.isOpen(p) && p.getNature(JavaCore.NATURE_ID) != null) { if (cl == null) cl = JavaProjectClassLoader.instance(JavaCore.create(p)); else cl = new CompositeClassloader(cl, JavaProjectClassLoader.instance(JavaCore.create(p))); } } cl = JaspersoftStudioPlugin.getDriversManager().getClassLoader(cl); cl = new CompositeClassloader(cl, getClass().getClassLoader()); Thread.currentThread().setContextClassLoader(cl); getConfig().setClassLoader(cl); daService = DataAdapterServiceUtil.getInstance(new ParameterContributorContext(getConfig(), null, null)) .getService(da); daService.test(); UIUtils.getDisplay().asyncExec(new Runnable() { @Override public void run() { UIUtils.showInformation(Messages.DataAdapterWizard_testbutton, Messages.DataAdapterWizard_testsuccesful); } }); } catch (Exception e1) { UIUtils.showError(e1); } finally { monitor.done(); Thread.currentThread().setContextClassLoader(oldCL); } } @Override protected void abortOperationInvoked() throws InterruptedException { if (daService != null) { daService.dispose(); daService = null; } super.abortOperationInvoked(); } }); } catch (InvocationTargetException e1) { UIUtils.showError(e1.getCause()); } catch (InterruptedException e1) { UIUtils.showError(e1); } finally { getWizardDialog().setTestButtonEnabled(true); } } } See attached plugin dialog, Let me know if you need aditional information.Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now