I am using Java 8 and Dynamic reports version is 6.0.0.
In pom.xml, I have added this dependency :
<dependency>
<groupId>net.sourceforge.dynamicreports</groupId>
<artifactId>dynamicreports-core</artifactId>
<version>6.0.0</version>
</dependency>
This code is to generate the report parameters:
JasperReportBuilder report = new JasperReportBuilder();
report.setPageMargin(DynamicReports.margin().setLeft(30).setRight(30).setTop(10).setBottom(10));
report.setPageFormat(PageType.A4, PageOrientation.PORTRAIT);
report.title(cmp.subreport(subReport1));
Here, the variable subreport1 contains all the report data. They are verified to be correct.
After generating all the report data, this is the code I execute to write the report details into a file:
FileOutputStream st = new FileOutputStream("<<DUMMY_FILE_PATH>>");
report.toPdf(st);
At this line where .toPdf is present, the following exception is being thrown:
Exception in thread "main" java.lang.AbstractMethodError: javax.xml.parsers.DocumentBuilderFactory.setFeature(Ljava/lang/String;Z)V
at net.sf.jasperreports.engine.fonts.SimpleFontExtensionHelper.<init>(SimpleFontExtensionHelper.java:149)
at net.sf.jasperreports.engine.fonts.SimpleFontExtensionHelper.getInstance(SimpleFontExtensionHelper.java:131)
at net.sf.jasperreports.engine.fonts.FontExtensionsRegistry.ensureFontExtensions(FontExtensionsRegistry.java:80)
at net.sf.jasperreports.engine.fonts.FontExtensionsRegistry.getExtensions(FontExtensionsRegistry.java:57)
at net.sf.jasperreports.extensions.DefaultExtensionsRegistry.getExtensions(DefaultExtensionsRegistry.java:130)
at net.sf.jasperreports.engine.DefaultJasperReportsContext.getExtensions(DefaultJasperReportsContext.java:277)
at net.sf.jasperreports.engine.fonts.FontUtil.getFontInfo(FontUtil.java:191)
at net.sf.jasperreports.engine.fonts.FontUtil.getFontInfo(FontUtil.java:291)
at net.sf.jasperreports.engine.fonts.FontUtil.getAwtFontFromBundles(FontUtil.java:476)
at net.sf.jasperreports.engine.fonts.FontUtil.getAwtFontFromBundles(FontUtil.java:466)
at net.sf.dynamicreports.design.transformation.StyleResolver.getFont(StyleResolver.java:122)
at net.sf.dynamicreports.design.transformation.StyleResolver.getFont(StyleResolver.java:100)
at net.sf.dynamicreports.design.transformation.StyleResolver.getFontHeight(StyleResolver.java:69)
at net.sf.dynamicreports.design.transformation.TemplateTransform.getTextFieldHeight(TemplateTransform.java:1391)
at net.sf.dynamicreports.design.transformation.ComponentTransform.textField(ComponentTransform.java:395)
at net.sf.dynamicreports.design.transformation.ComponentTransform.component(ComponentTransform.java:155)
at net.sf.dynamicreports.design.transformation.ComponentTransform.list(ComponentTransform.java:303)
at net.sf.dynamicreports.design.transformation.BandTransform.band(BandTransform.java:231)
at net.sf.dynamicreports.design.transformation.BandTransform.transform(BandTransform.java:86)
at net.sf.dynamicreports.design.base.DRDesignReport.transform(DRDesignReport.java:155)
at net.sf.dynamicreports.design.base.DRDesignReport.<init>(DRDesignReport.java:127)
at net.sf.dynamicreports.design.base.DRDesignReport.<init>(DRDesignReport.java:111)
at net.sf.dynamicreports.jasper.builder.JasperReportBuilder.toJasperReportDesign(JasperReportBuilder.java:299)
at net.sf.dynamicreports.jasper.builder.JasperReportBuilder.getJasperParameters(JasperReportBuilder.java:346)
at net.sf.dynamicreports.jasper.builder.JasperReportBuilder.toJasperPrint(JasperReportBuilder.java:363)
at net.sf.dynamicreports.jasper.builder.JasperReportBuilder.export(JasperReportBuilder.java:896)
at net.sf.dynamicreports.jasper.builder.JasperReportBuilder.toPdf(JasperReportBuilder.java:735)
at net.sf.dynamicreports.jasper.builder.JasperReportBuilder.toPdf(JasperReportBuilder.java:724)
Please let me know the solution for this error.
I found the actual solution. There was a version mismatch between xerces jar and dynamic reports jar. It was resolved by adding the following dependency :
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.11.0</version>
</dependency>
Related
During initialization of Apache's Storm JdbcInsertBolt I get an error
java.lang.ClassCastException:
Cannot cast org.apache.phoenix.jdbc.PhoenixDriver to javax.sql.DataSource
at com.zaxxer.hikari.util.UtilityElf.createInstance(UtilityElf.java:90)
at com.zaxxer.hikari.pool.PoolBase.initializeDataSource(PoolBase.java:292)
at com.zaxxer.hikari.pool.PoolBase.<init>(PoolBase.java:84)
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:102)
at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:71)
at org.apache.storm.jdbc.common.HikariCPConnectionProvider.prepare(HikariCPConnectionProvider.java:53)
at org.apache.storm.jdbc.mapper.SimpleJdbcMapper.<init>(SimpleJdbcMapper.java:43)
from the underlying HikariCPConnectionProvider. Whats wrong?
I am following http://storm.apache.org/releases/1.1.2/storm-jdbc.html, here is what I am doing based on that:
I like to write data from a Apache Storm topology to a HBase table via Phoenix. For that I downloaded the driver-file (phoenix-4.7.0.2.6.5.3003-25-client.jar) from my cluster-Server and added it to my local maven repository:
mvn install:install-file
-Dfile=lib\phoenix-4.7.0.2.6.5.3003-25-client.jar
-DgroupId=org.apache.phoenix
-DartifactId=phoenix-jdbc -Dversion=4.7.0 -Dpackaging=jar
After that I updated my .pom:
<dependency>
<groupId>org.apache.phoenix</groupId>
<artifactId>phoenix-jdbc</artifactId>
<version>4.7.0</version>
</dependency>
Now add Storm's JDBC-Bolt:
<dependency>
<groupId>org.apache.storm</groupId>
<artifactId>storm-jdbc</artifactId>
<version>1.2.2</version>
<scope>provided</scope>
</dependency>
and I am set-up to use the bolt. First: Setup Connection-Provider:
Map hikariConfigMap = new HashMap();
hikariConfigMap.put("dataSourceClassName", "org.apache.phoenix.jdbc.PhoenixDriver");
hikariConfigMap.put("dataSource.url", "<zookeeperQuorumURI>:2181:/hbase-unsecure");
this.connectionProvider = new HikariCPConnectionProvider(hikariConfigMap);
Now initialize the tuple-values-to-db-columns-mapper
this.simpleJdbcMapper = new SimpleJdbcMapper(this.tablename, connectionProvider);
During this the error mentioned above happens.
Just for completeness: The JdbcInsertBolt gets created like this:
new JdbcInsertBolt(this.connectionProvider, this.simpleJdbcMapper)
.withTableName(this.tablename)
.withQueryTimeoutSecs(30);
have you tried to set :
driverClassName -> org.apache.phoenix.jdbc.PhoenixDriver. The current code seems to have set the dataSourceClassName which is different i guess
Refering this
I am trying to get key in this way:
private static String getPolicyKey(String secretName, String keyVaultUrl, String applicationId, String applicationSecret) {
KeyVaultClient keyVaultClient = new KeyVaultClient(new ApplicationTokenCredentials(
applicationId, // Application ID
"myDomain.com", // Azure Active Directory Domain
applicationSecret, // Application Key Value
AzureEnvironment.AZURE
));
return keyVaultClient.getSecret(
keyVaultUrl, // KeyValut URL
secretName // Secret Name
).value();
}
But I am getting an Exception:
java.lang.NoSuchMethodError: com.microsoft.azure.credentials.ApplicationTokenCredentials.proxy()Ljava/net/Proxy;
at com.microsoft.azure.credentials.ApplicationTokenCredentials.acquireAccessToken(ApplicationTokenCredentials.java:137)
at com.microsoft.azure.credentials.ApplicationTokenCredentials.getToken(ApplicationTokenCredentials.java:127)
at com.microsoft.azure.credentials.AzureTokenCredentials.getToken(AzureTokenCredentials.java:39)
at com.microsoft.azure.credentials.AzureTokenCredentialsInterceptor.intercept(AzureTokenCredentialsInterceptor.java:36)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:190)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:163)
at okhttp3.RealCall.execute(RealCall.java:57)
at retrofit2.OkHttpCall.execute(OkHttpCall.java:174)
at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$RequestArbiter.request(RxJavaCallAdapterFactory.java:171)
at rx.Subscriber.setProducer(Subscriber.java:211)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.setProducer(OnSubscribeMap.java:102)
at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$CallOnSubscribe.call(RxJavaCallAdapterFactory.java:152)
at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$CallOnSubscribe.call(RxJavaCallAdapterFactory.java:138)
at rx.Observable.unsafeSubscribe(Observable.java:10142)
I am using the following dependencies:
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-eventhubs</artifactId>
<version>0.15.1</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-keyvault</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-client-authentication</artifactId>
<version>1.1.0</version>
</dependency>
Note: I tried with azure-eventhubs version 1.0.1 but even that gave same error.
This is my first time dealing with azure-eventhubs, any kind of direction on this will be extremely helpful.
In Maven, when you have a transitive dependency shared between multiple direct dependencies at the same distance (or depth), the one that will end up in your dependency tree will be one coming from the first direct dependency in order of appearance.
Since com.microsoft.azure:azure-keyvault:1.0.0 appears first in your POM, the project will end up with version 1.0.0 of com.microsoft.azure:azure-client-runtime, which is where the class that would contain the proxy() method resides. The problem is that this method was introduced until version 1.1.0
What you can do here is swapping the order in which the Azure Key Vault and Azure Client Authentication dependencies appear. Another thing you can do is directly declare which version of azure-client-runtime you want to use in your POM:
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-client-runtime</artifactId>
<version>1.1.0</version>
</dependency>
I'm trying to use Byte Buddy library in Android but I get an error:
java.lang.IllegalStateException: This JVM's version string does not
seem to be valid: 0
I have coded nothing yet, just:
ByteBuddy test = new ByteBuddy();
in my App.java
I have imported:
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>0.7.7</version>
</dependency>
but it didn't work, to I tried with:
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy-android</artifactId>
<version>0.7.7</version>
</dependency>
but I still get same error.
EDIT
I have put this line before initialize ByteBuddy:
System.setProperty("java.version", "1.7.0_51");
But now I get this another error:
Caused by: java.lang.UnsupportedOperationException: can't load this
type of class file.
for this code:
Class<?> dynamicType = new ByteBuddy(ClassFileVersion.JAVA_V6)
.subclass(Object.class)
.method(ElementMatchers.named("toString"))
.intercept(FixedValue.value("Hello World!"))
.make()
.load(getClass().getClassLoader(), AndroidClassLoadingStrategy.Default.WRAPPER)
.getLoaded();
The error is because java.version returns 0 in Android (See section System Properties here - Comparison of Java and Android API)
Also, if you observe ByteBuddy ClassFileVersion
forCurrentJavaVersion() : This method checks for versionString which should return any valid Java/JDK version else it
throws IllegalStateException("This JVM's version string does not seem to be valid: " + versionString);
& since java.version is returning 0, it's throwing IllegalStateException.
Try to log this value:
String versionString = System.getProperty(JAVA_VERSION_PROPERTY);
Log.d(TAG, versionString);//retruns 0 here
hence workaround for this issue is to add
System.setProperty(JAVA_VERSION_PROPERTY, "1.7.0_79");//add your jdk version here
before calling
ByteBuddy test = new ByteBuddy();
where JAVA_VERSION_PROPERTY is declared as:
private static final String JAVA_VERSION_PROPERTY = "java.version";
Also dependency to use is:
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>0.7.7</version>
</dependency>
Else if you are using studio, you can add
compile 'net.bytebuddy:byte-buddy:0.7.7'
to your app build.gradle.
Hope this will help solve your issue.
Am sending map and accessing in velocity template version 1.2 but I tried to create map in vm I couldn't create and getting exception.Please give you guidance.
#set($buyerActionStat = {
"0":"New",
"5":"Response-Acknowledged",
"6":"Response-Accepted",
"7":"Response-Rejected"
})
Exception :
org.apache.velocity.exception.ParseErrorException: Lexical error: org.apache.velocity.runtime.parser.TokenMgrError: Lexical error at line 5, column 25. Encountered: "{" (123), after : ""
at org.apache.velocity.Template.process(Template.java:181)
at org.apache.velocity.runtime.resource.ResourceManager.getResource(ResourceManager.java:327)
at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:736)
at org.apache.velocity.runtime.RuntimeSingleton.getTemplate(RuntimeSingleton.java:355)
at org.apache.velocity.app.Velocity.getTemplate(Velocity.java:533)
at ecnet.rd.core.template.TemplateResolver.<init>(TemplateResolver.java:45)
at ecnet.rd.core.template.TemplateResolver.getInstance(TemplateResolver.java:34)
at ecnet.rd.helper.AMECPOHelper.mergePOTemplate(AMECPOHelper.java:71)
the expcetion is caused by velocity versions only.
Use apache velocity version 1.6.2 or later versions.
Maven dependency
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.6.2</version>
</dependency>
I inherited some code that is using XPath for which I am a novice. I have it now so that it loads the document, but when the document.selectPath(queryPath) it always fails with the following error:
java.lang.RuntimeException: Trying XBeans path engine... Trying XQRL... Trying delegated path engine... FAILED on //
at org.apache.xmlbeans.impl.store.Path.getCompiledPath(Path.java:173)
at org.apache.xmlbeans.impl.store.Path.getCompiledPath(Path.java:130)
at org.apache.xmlbeans.impl.store.Cursor._selectPath(Cursor.java:902)
at org.apache.xmlbeans.impl.store.Cursor.selectPath(Cursor.java:2634)
at org.apache.xmlbeans.impl.values.XmlObjectBase.selectPath(XmlObjectBase.java:462)
at org.apache.xmlbeans.impl.values.XmlObjectBase.selectPath(XmlObjectBase.java:446)
Thank you jor for the post. I was confused as earlier commands to xml beans were successful.
Without saxon, this still works:
MapDocument doc;
...
String cityQuery = "$this//City";
XmlObject[] cities = doc.selectPath(cityQuery);
However saxon is required for explicit selection of fields within tags:
String aveQuery= "$this//Street[Kind='Avenue']";
XmlObject[] avenues = doc.selectPath(aveQuery); // RuntimeException without saxon on path
java.lang.RuntimeException:
Trying XBeans path engine... Trying XQRL... Trying delegated path engine... FAILED on $this//Street[Kind='Avenue']
I hope this might be of use to others that encounter a similar issue.
You need an XPath engine in your classpath, which one bepends on the XMLBeans version, see
http://wiki.apache.org/xmlbeans/XmlBeansFaq#whatJars
The movement if you have [] in your xpath, it is searching for the external xpath enginer.. you have to download saxonb9-0-0-4j & xmlbeans-xpath-2.4.0.jar and add to the classpath
worked for me:
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
<version>10.6</version>
</dependency>
<dependency>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>2.1.3</version>
</dependency>