Following up many many questions and answers to use BATIK, I'm having trouble of fixing my error and I couldn't find anything that might help. And this question has no answer.
My problem is when I download the pdf on my application, the error occur(I even tried to include the jar):
java.lang.ClassNotFoundException: org.apache.batik.dom.svg.SVGOMDocument
In my jasper report I have this included:
<image>
<reportElement x="453" y="117" width="246" height="115"/>
<imageExpression class="net.sf.jasperreports.engine.JRRenderable"><![CDATA[net.sf.jasperreports.renderers.BatikRenderer.getInstance(new java.io.File("C:\\Project\\myProject\\web-app\\images\\tomcat.svg"))]]>
</imageExpression>
</image>
Basically, my BuildConfig.groovy is like this:
inherits("global") {
excludes 'xml-apis', 'xml-apis-ext', 'xercesImpl'
}
and my dependencies:
compile("org.apache.xmlgraphics:fop:0.94",
"org.apache.xmlgraphics:batik-transcoder:1.7",
"org.apache.xmlgraphics:batik-codec:1.7",
"org.apache.xmlgraphics:batik-awt-util:1.7",
"org.apache.xmlgraphics:batik-bridge:1.7",
"org.apache.xmlgraphics:batik-dom:1.7",
"org.apache.xmlgraphics:batik-gvt:1.7",
"org.apache.xmlgraphics:batik-svg-dom:1.7",
"org.apache.xmlgraphics:batik-svggen:1.7",
"org.apache.xmlgraphics:batik-util:1.7",
"org.apache.xmlgraphics:batik-xml:1.7",
"org.apache.xmlgraphics:batik-anim:1.7",
"org.apache.xmlgraphics:batik-css:1.7",
"org.apache.xmlgraphics:batik-ext:1.7",
"org.apache.xmlgraphics:batik-js:1.7",
"org.apache.xmlgraphics:batik-parser:1.7",
"org.apache.xmlgraphics:batik-script:1.7",
"org.apache.xmlgraphics:xmlgraphics-commons:1.2",
"commons-logging:commons-logging:1.0.4",
"org.apache.avalon.framework:avalon-framework-api:4.3.1",
"org.apache.avalon.framework:avalon-framework-impl:4.3.1",
"xalan:xalan:2.6.0",
"xml-apis:xml-apis-ext:1.3.04"
){
transitive = false
Why I can't download? Invalid svg? I got this svg from wiki.
Check your deployed code on either the presence of batik-svg-dom-1.7.jar or batik-all-1.7.jar (using that would shorten your compile configuration considerably too). If it is missing, add it manually just to see if that fixes your issue. If it is missing however something is missing in your deploy configuration.
This is not a good/bad answer nor a fix, but it only runs at grails run-war, I don't know why and it works.
Related
Trying MockWebServer for the first time on a Groovy/Spring project that uses Spock for unit testing.
I added MockWebServer dependencies as directed (I had to add the second line myself to avoid errors, but it's not documented:
testImplementation("com.squareup.okhttp3:mockwebserver:4.0.0")
testImplementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.40")
I have a basic Spock test that looks like this:
def 'server'() {
setup:
MockWebServer server = new MockWebServer()
expect:
server
}
But it fails with this output:
java.lang.NoSuchMethodError: okhttp3.internal.Util.immutableListOf([Ljava/lang/Object;)Ljava/util/List;
at okhttp3.mockwebserver.MockWebServer.<init>(MockWebServer.kt:176)
Is there another dependency I'm missing? Does MockWebServer not play well with Groovy and Spock?
For what it's worth, using version 3.1.4 seems to work:
testImplementation("com.squareup.okhttp3:mockwebserver:3.14.2")
(I'm a first time user of MockWebServer)
Thank you!
Try adding this:
testImplementation("com.squareup.okhttp3:mockwebserver:4.0.0")
testImplementation("com.squareup.okhttp3:okhttp:4.0.0")
With MockWebServer your OkHttp dependency must be the same version.
I got the same problem, I found the solution in version, just change the version to "3.7.0" and it's work fine.
there is some discussion about version changing to "3.4.1" but this version got the problem (Cannot inherit from final class) that discussed at this issue :
https://github.com/andrzejchm/RESTMock/issues/56
so the safest version is "3.7.0" :D
just notice that both versions should be the same..
change your to dependencies to below:
//mock retrofit
testImplementation("com.squareup.okhttp3:mockwebserver:3.7.0")
testImplementation("com.squareup.okhttp3:okhttp:3.7.0")
//if your source code is java
testImplementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.40")
I am trying port to Dart this nice paper-datatable implementation using custom_element_apigen.
Some problems occurred and sought to find solutions according to my understanding (perhaps included more problems!).
However, still an error is thrown and not been able to move on. I need some help about how port to Dart!!! I will briefly describe the steps, errors and solutions that gave and a link to source code of the project test:
1) I following the steps, accord to https://github.com/dart-lang/custom-element-apigen. I had problems on Windows, but I got to resolve after (custom_element_apigen: gives an error importing paper-datatable to Dart)
2) apigen.yaml used with custom_element_apigen does not clear how to configuration.
I used the "trial-and-error" method until no more error occur. It was so:
files_to_generate:
- paper-datatable\paper-datatable.html
- paper-datatable\paper-datatable-column.html
- paper-datatable\paper-datatable-edit-dialog.html
- paper-datatable\paper-datatable-card.html
- paper-datatable\paper-datatable-styles.html
- paper-datatable\datatable-icons.html
files_to_load:
- package:polymer_elements/src/paper-material/paper-material.html
- package:polymer_elements/src/iron-ajax/iron-request.html
- package:polymer_elements/src/iron-ajax/iron-ajax.html
- package:polymer_elements/src/iron-form/iron-form.html
- package:polymer_elements/src/iron-meta/iron-meta.html
- package:polymer_elements/src/iron-icon/iron-icon.html
- package:polymer_elements/src/iron-iconset-svg/iron-iconset-svg.html
- package:polymer_elements/src/paper-ripple/paper-ripple.html
- package:polymer_elements/src/paper-checkbox/paper-checkbox.html
- package:polymer_elements/src/neon-animation/animations/opaque-animation.html
- package:polymer_elements/src/neon-animation/animations/fade-in-animation.html
- package:polymer_elements/src/neon-animation/animations/fade-out-animation.html
- package:polymer_elements/src/paper-tooltip/paper-tooltip.html
- package:polymer_elements/src/iron-resizable-behavior/iron-resizable-behavior.html
- package:polymer_interop/src/js/debug/src/lib/template/templatizer.html
Some paths imports were wrongs on paper-datatable*.(html and dart) files. p.e. : import 'packages\polymer_interop\src\js\debug\src\lib\template\templatizer.dart'; I changed to import 'package:polymer_interop/src/behaviors/templatize.dart';
on paper_datatable_column.dart.
I changed reserved Dart word default to defaultx on get defaultx => jsElement[r'default']; and set defaultx(value) { jsElement[r'default'] = (value is Map || (value is Iterable && value is! JsArray)) ? new JsObject.jsify(value) : value;} instructions on paper_datatable_column.dart and paper_datatable_card.dart;
After the following erros were occuring in several polymer componentes. P.e.: Failed to execute 'registerElement' on 'Document': Registration failed for type 'iron-meta'. A type with that name is already registered.
I changed all paths into paper-datatable*.* files to get official package (pub.dartlang) of the polymer and polymer elements. P.e.: <link rel="import" href="paper_icon_button_nodart.html"> to <link rel="import" href="../../packages/polymer_elements/paper_icon_button_nodart.html">. The register problem does not occur more!
But now, the following problem is occuring and I don't know how to resolve it: On debug console appear the following message: Uncaught SyntaxError: Unexpected token =>. The web app works on browser, but the paper-datatable does not appear.
My complete test project (webstorm) is on https://github.com/supermuka/paper_datatable_port_dart_demo
Is there some wrong in how I used Dart custom_element_apigen (and apigen.yaml)? Did I some things wrong on paths changed? I also need to change some other source?
Thanks!
Most likely you just created a syntax error when editing the files. That being said there are options built in to do most of the things you manually did, and that also makes it easier to update in the future.
omit_imports: This is used on individual items in the files_to_generate section. It can be used to get rid of the templatizer import entirely, resolving issue #3. See example here.
name_substitutions: This is used on individual items in the files_to_generate section, and allows you to rename fields. You can use this to resolve issue #4, example here.
stubs_to_generate: This option allows you to generate stubs which actually import elements from a different package, this should resolve issue #5 you listed above. See example usage here.
Hopefully that helps, and applying those options will just resolve your issues.
If I include compile "org.jasig.cas.client:cas-client-core:3.3.3" in my BuildConfig.groovy, I get a stack overflow as seen below. If I change compile to runtime the error goes away, but I do have dependencies at compile time as well as runtime.
It looks like some kind of circular reference related to logging, and just getting a stack dump like this isn't helpful. How would I fix it?
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:253)
at org.apache.log4j.Category.<init>(Category.java:52)
at org.apache.log4j.Logger.<init>(Logger.java:35)
at org.apache.log4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:59)
at org.apache.log4j.LogManager.getLogger(LogManager.java:42)
at org.slf4j.impl.GrailsSlf4jLoggerFactory.getLogger(GrailsSlf4jLoggerFactory.java:43)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:253)
at org.apache.log4j.Category.<init>(Category.java:52)
at org.apache.log4j.Logger.<init>(Logger.java:35)
at org.apache.log4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:59)
at org.apache.log4j.LogManager.getLogger(LogManager.java:42)
at org.slf4j.impl.GrailsSlf4jLoggerFactory.getLogger(GrailsSlf4jLoggerFactory.java:43)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:253)
| Error Error executing script RefreshDependencies: null
You may have multiple versions of log4j-over-slf4j in your dependency chain. If you run 'grails dependency-report runtime', you will see a list of libs that your app sucks in.
Using transitive=false will exclude all dependencies of the lib, but you could try 'exclude "log4j-over-slf4j"' as a more focused exclude if you have multiple slf4j versions in your dependency chain. E.g.,
compile("org.jasig.cas.client:cas-client-core:3.3.3") {
exclude "log4j-over-slf4j"
}
adding transitive=false made the error go away:
compile("org.jasig.cas.client:cas-client-core:3.3.3") {
transitive=false
}
I'm not clear what I needed to exclude specifically, or how anyone could have figured that out from the stack overflow.
I need some help, I am trying to make an controller using Google Analytics API, but using:
statsController.groovy
/**************************************************************/
import com.google.gdata.client.analytics.AnalyticsService
class StatsController {
def myService
def stats(){
myService = new AnalyticsService("example-App");
}
}
/************************************************************/
error Message:
ClassNotFoundException occurred when processing request: [...]
com.google.common.collect.Maps
I ve tryed adding to the buildpath the "gdata.analytics*.jar", "google-collect-1.0.jar", "guava.jar" and "jsr305.jar" but without results, the error always says that i described or NotDefClassError ocurred when processing request: [...] com.google.gdata.client.analytics.AnalyticsService.
I need to solve.
The handling of JARs is kept pretty easy in grails. If you don't use stuff like maven you can just copy your JARs into the lib folder in the root directory of your grails application.
Try to put them there and see if it solves the problem.
Further: what IDE do you use? IntelliJ for instance recognize JARs within the lib folder instantly. So you should see the effects in your IDE already.
I got this error which according to Apache Support is an issue relating with Glassfish rather than OpenJPA:
java.lang.IllegalStateException: WEB9031: WebappClassLoader unable to load resource [org.apache.openjpa.util.LongId], because it has not yet been started, or was already stopped
The stacktrace is:
Caused by: java.lang.IllegalStateException: WEB9031: WebappClassLoader unable to load resource [org.apache.openjpa.util.LongId], because it has not yet been started, or was already stopped
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1410)
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1368)
at com.ckd.model.BookModel.pcNewObjectIdInstance(BookModel.java)
at org.apache.openjpa.enhance.PCRegistry.newObjectId(PCRegistry.java:138)
at org.apache.openjpa.meta.MetaDataRepository.processRegisteredClass(MetaDataRepository.java:1693)
at org.apache.openjpa.meta.MetaDataRepository.processRegisteredClasses(MetaDataRepository.java:1643)
... 112 more
Has anyone come across this before and how to resolve it? I have been stuck on this issue for the last several days.
Another of my post related to this issue can be found here: JSF 2: h:link and getrowdata.
The above error relates to a problem with the OpenJPA enhancer. When you execute Sun's JDK the OpenJPA's dynamic enhancer starts by default. This action, in turn, stuffs up Glassfish's classloader class - hence, the WEB9031 error.
For those who experience this same issue, a simple workaround is to do the enhancement at build time - which I did in ANT with org.apache.openjpa.ant.PCEnhancerTask - and add this property to your persistence.xml to shut off the dynamic enhancer: <property name="openjpa.DynamicEnhancementAgent" value="false"/>.
Also, it wouldn't hurt to throw this in your persistence.xml as well <property name="openjpa.RuntimeUnenhancedClasses" value="unsupported" />.