I'm getting an error that while execute the line PDDocument.load(input)
Code example:
PDDocument pd
String pdfDir = "C:/Users/user/Desktop/file.pdf"
File input = new File("${pdfDir}")
pd = PDDocument.load(input) // System can't execute this line
pdfUtil.writePDF(pd, addr, data)
Error:
Error |
java.io.IOException: Error: End-of-File, expected line
Error |
at org.apache.pdfbox.pdfparser.BaseParser.readLine(BaseParser.java:1519)
Error |
at org.apache.pdfbox.pdfparser.PDFParser.parseHeader(PDFParser.java:360)
Error |
at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:186)
Error |
at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1230)
Error |
at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1197)
Error |
at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1168)
Error |
at org.apache.pdfbox.pdmodel.PDDocument$load.call(Unknown Source)
Error |
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
Error |
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
Error |
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
Error |
Dependency: compile 'org.apache.pdfbox:pdfbox:1.8.11'
As discussed in the comments: the file is empty. This is usually the reason when getting an exception like this
IOException: Error: End-of-File, expected line
with parseHeader in the stack trace.
Related
since today i'm getting an confusing error in ggts, while refreshing dependencies. I never had this error before and it says nothing to me:
Command terminated with an exception: java.lang.Exception (see details for
partial output)
Command: GrailsCommand(P/project> compile --non-interactive --refresh-
dependencies)
---- System.out ----
Loading Grails 2.3.8
.
|Environment set to development
.Error
|
java.lang.NoClassDefFoundError: _GrailsClasspath_groovy$_run_closure1
Error |
at _GrailsClasspath_groovy.run(_GrailsClasspath_groovy:39)
Error |
at _GrailsClasspath_groovy$run.call(Unknown Source)
Error |
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall
(CallSiteArray.java:45)
Error |
at _GrailsEvents_groovy$run.call(Unknown Source)
Error |
at org.codehaus.gant.IncludeTargets.leftShift(IncludeTargets.groovy:59)
Error |
at org.codehaus.gant.IncludeTargets$leftShift.call(Unknown Source)
Error |
at _GrailsEvents_groovy.run(_GrailsEvents_groovy:32)
Error |
at _GrailsEvents_groovy$run.call(Unknown Source)
Error |
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall
(CallSiteArray.java:45)
Error |
at _GrailsArgParsing_groovy$run.call(Unknown Source)
Error |
at org.codehaus.gant.IncludeTargets.leftShift(IncludeTargets.groovy:59)
Error |
at org.codehaus.gant.IncludeTargets$leftShift.call(Unknown Source)
Error |
at _GrailsArgParsing_groovy.run(_GrailsArgParsing_groovy:29)
Error |
at _GrailsArgParsing_groovy$run.call(Unknown Source)
Error |
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall
(CallSiteArray.java:45)
Error |
at _GrailsInit_groovy$run.call(Unknown Source)
Error |
at org.codehaus.gant.IncludeTargets.leftShift(IncludeTargets.groovy:59)
Error |
at org.codehaus.gant.IncludeTargets$leftShift.call(Unknown Source)
Error |
at _GrailsInit_groovy.run(_GrailsInit_groovy:34)
Error |
at _GrailsInit_groovy$run.call(Unknown Source)
Error |
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall
(CallSiteArray.java:45)
Error |
at _GrailsCompile_groovy$run.call(Unknown Source)
Error |
at org.codehaus.gant.IncludeTargets.leftShift(IncludeTargets.groovy:59)
Error |
at org.codehaus.gant.IncludeTargets$leftShift.call(Unknown Source)
Error |
at _GrailsCompile_groovy.run(_GrailsCompile_groovy:28)
Error |
at _GrailsCompile_groovy$run.call(Unknown Source)
Error |
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall
(CallSiteArray.java:45)
Error |
at _GrailsSettings_groovy$run.call(Unknown Source)
Error |
at org.codehaus.gant.IncludeTargets.leftShift(IncludeTargets.groovy:59)
Error |
at org.codehaus.gant.IncludeTargets$leftShift.call(Unknown Source)
Error |
at Compile.run(Compile.groovy:25)
Error |
at Compile$run.call(Unknown Source)
Error |
at gant.Gant.prepareTargets(Gant.groovy:607)
Error |
at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeWithGantInstance
(GrailsScriptRunner.java:769)
Error |
at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeScriptFile
(GrailsScriptRunner.java:571)
Error |
at
org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeScriptWithCaching
(GrailsScriptRunner.java:470)
Error |
at
org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeScriptWithCaching
(GrailsScriptRunner.java:421)
Error |
at org.grails.ide.api.impl.GrailsConnectorImpl.executeCommand
(GrailsConnectorImpl.java:160)
Error |
at org.grails.ide.eclipse.longrunning.process.GrailsProcess.run
(GrailsProcess.java:130)
Error |
at org.grails.ide.eclipse.longrunning.process.GrailsProcess.main
(GrailsProcess.java:93)
Error |
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Error |
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:57)
Error |
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:43)
Error |
at java.lang.reflect.Method.invoke(Method.java:606)
Error |
at
org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader
(GrailsStarter.ja
va:235)
Error |
at
org.codehaus.groovy.grails.cli.support.GrailsStarter.main
(GrailsStarter.java:263)
---- System.err ----
I didn't change the config of my project intentionally, don't know what happened.
I run grails 2.3.8 with java is 1.7
If somebody knows what to do, please tell me!
Thanks in advance
is your grails SDK and jdk configured correctly ?
You can follow below steps:
Go to your project directory e.g. d:\YourProject
Navigate to target\work folder in your project directory e.g. d:\YourProject\target\work
Delete the work folder
run commands grails clean and grails compile
If still issue not solved : run command grails clean-all and right click on project in GGTS then click on refresh dependencies > download
Hope it helps you
i had to remove the script cache folder from project: https://www.javabrahman.com/error-handling/error-_grailsclasspath_groovy_run_closure1/
Below is method for gsp template parsing that have created:
String renderGSPTemplate(String templateText, Map bindings){
def output = new StringWriter()
String pageName = bindings.remove('pageName')
groovyPagesTemplateEngine.clearPageCache()
Template template1 = groovyPagesTemplateEngine.createTemplate(templateText, pageName)
Writable data = template1.make(bindings)
data.writeTo(output)
return output
}
Below is exception that I am getting:
Error java.lang.NullPointerException
| Error at org.codehaus.groovy.grails.web.pages.GroovyPageOutputStack.lookupStack(GroovyPageOutputStack.java:102)
| Error at org.codehaus.groovy.grails.web.pages.GroovyPageOutputStack.currentStack(GroovyPageOutputStack.java:76)
| Error at org.codehaus.groovy.grails.web.pages.GroovyPage.initRun(GroovyPage.java:213)
| Error at org.codehaus.groovy.grails.web.pages.GroovyPageWritable.doWriteTo(GroovyPageWritable.java:199)
| Error at org.codehaus.groovy.grails.web.pages.GroovyPageWritable.writeTo(GroovyPageWritable.java:128)
| Error at groovy.lang.Writable$writeTo.call(Unknown Source)
| Error at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
| Error at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
| Error at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
| Error at com.verecloud.nimbus4.mail.TemplateParserService$$EPpsYO6i.renderGSPTemplate(TemplateParserService.groovy:37)
Any one knows the reason for this error.
Thanks!
groovyPagesTemplateEngine uses HttpRequest and hence if we are not having a call from web application it will fail with NullPointerException.
Hence it was failing for me with NPE
Hi i am new to Groovy/Grails and i recently installed Groovy/Grails suite 3.6.4 on windows 7. I made my JAVA_HOME and GRAIL_HOME and when i tried to run a Grails application i get the following errors.
Error
|
java.io.FileNotFoundException: C:\Users\οΏ½οΏ½οΏ½\Documents\workspace-ggts-3.6.4.RELEASE\.metadata\.plugins\org.grails.ide.eclipse.core\as-dependencies.txt (The system cannot find the path specified)
Error |
at java.io.FileOutputStream.open0(Native Method)
Error |
at java.io.FileOutputStream.open(FileOutputStream.java:270)
Error |
at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
Error |
at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
Error |
at org.grails.ide.eclipse.runtime.shared.DependencyFileFormat$DepWriter.<init>(DependencyFileFormat.java:55)
Error |
at org.grails.ide.eclipse.runtime.shared.DependencyFileFormat.write(DependencyFileFormat.java:106)
Error |
at org.grails.ide.eclipse.runtime.GrailsBuildSettingsDependencyExtractor.writeDependencyFile(GrailsBuildSettingsDependencyExtractor.java:206)
Error |
at org.grails.ide.eclipse.longrunning.process.GrailsProcess.writeDependencyFile(GrailsProcess.java:200)
Error |
at org.grails.ide.eclipse.longrunning.process.GrailsProcess.run(GrailsProcess.java:133)
Error |
at org.grails.ide.eclipse.longrunning.process.GrailsProcess.main(GrailsProcess.java:93)
Error |
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Error |
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
Error |
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Error |
at java.lang.reflect.Method.invoke(Method.java:498)
Error |
at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:236)
Error |
at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:264)
I am getting the "java.lang.RuntimeException: Reloading agent exited via exception" error while running grails app. Previously it was working fine. Suddenly I am getting this error. And I am not able to run application.
Full stacktrace as follows
|Loading Grails 2.4.0
|Configuring classpath
.
|Environment set to development
.................................
|Packaging Grails application
..
|Compiling 10 source files
Error |
java.lang.RuntimeException: Reloading agent exited via exception, please raise a jira
Error |
at org.springsource.loaded.agent.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:104)
Error |
at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
Error |
at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:424)
Error |
at java.lang.ClassLoader.defineClass1(Native Method)
Error |
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
Error |
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
Error |
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
Error |
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
Error |
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
Error |
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
Error |
at java.security.AccessController.doPrivileged(Native Method)
Error |
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
Error |
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
Error |
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:655)
Error |
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:523)
Error |
at org.codehaus.groovy.control.ClassNodeResolver.tryAsLoaderClassOrScript(ClassNodeResolver.java:183)
Error |
at org.codehaus.groovy.control.ClassNodeResolver.findClassNode(ClassNodeResolver.java:168)
Error |
at org.codehaus.groovy.control.ClassNodeResolver.resolveName(ClassNodeResolver.java:124)
Error |
at org.codehaus.groovy.control.ResolveVisitor.resolveToOuter(ResolveVisitor.java:617)
Error |
at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:269)
Error |
at org.codehaus.groovy.control.ResolveVisitor.resolveFromModule(ResolveVisitor.java:551)
Error |
at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:269)
Error |
at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:237)
Error |
at org.codehaus.groovy.control.ResolveVisitor.resolveOrFail(ResolveVisitor.java:221)
Error |
at org.codehaus.groovy.control.ResolveVisitor.resolveOrFail(ResolveVisitor.java:233)
Error |
at org.codehaus.groovy.control.ResolveVisitor.transformConstructorCallExpression(ResolveVisitor.java:988)
Error |
at org.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:647)
Error |
at org.codehaus.groovy.control.ResolveVisitor.transformBinaryExpression(ResolveVisitor.java:956)
Error |
at org.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:641)
Error |
at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitExpressionStatement(ClassCodeExpressionTransformer.java:139)
Error |
at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:40)
Error |
at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:35)
Error |
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:163)
Error |
at org.codehaus.groovy.control.ResolveVisitor.visitBlockStatement(ResolveVisitor.java:1259)
Error |
at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69)
Solved!!!
Delete grails installation folder (GRAILS_HOME), and recreate.
I started getting the following exception on startup recently:
Error log4j:ERROR setFile(null,false) call failed.
| Error java.io.FileNotFoundException: /var/log/log4j/log4jEvents.xml (No such file or directory)
| Error at java.io.FileOutputStream.open(Native Method)
| Error at java.io.FileOutputStream.<init>(FileOutputStream.java:194)
| Error at java.io.FileOutputStream.<init>(FileOutputStream.java:116)
| Error at org.apache.log4j.FileAppender.setFile(FileAppender.java:294)
| Error at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165)
| Error at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:307)
| Error at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:295)
| Error at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:176)
| Error at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java:191)
| Error at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigurator.java:523)
| Error at org.apache.log4j.xml.DOMConfigurator.parseCategory(DOMConfigurator.java:436)
| Error at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:1004)
| Error at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:872)
| Error at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:778)
| Error at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:526)
| Error at org.apache.log4j.LogManager.<clinit>(LogManager.java:127)
| Error at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:415)
| Error at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| Error at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| Error at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| Error at java.lang.reflect.Method.invoke(Method.java:597)
| Error at org.codehaus.groovy.grails.cli.GrailsScriptRunner.initializeLogging(GrailsScriptRunner.java:659)
| Error at org.codehaus.groovy.grails.cli.GrailsScriptRunner.initializeState(GrailsScriptRunner.java:631)
| Error at org.codehaus.groovy.grails.cli.GrailsScriptRunner.callPluginOrGrailsScript(GrailsScriptRunner.java:414)
| Error at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeCommand(GrailsScriptRunner.java:379)
| Error at org.codehaus.groovy.grails.cli.GrailsScriptRunner.main(GrailsScriptRunner.java:227)
| Error at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| Error at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| Error at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| Error at java.lang.reflect.Method.invoke(Method.java:597)
| Error at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:236)
| Error at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:264)
| Error at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| Error at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| Error at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| Error at java.lang.reflect.Method.invoke(Method.java:597)
| Error at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
It doesn't seem to affect anything, but it is a bit annoying. I'm guessing some plugin or dependency that has been put in recently caused this to start happening, because it wasn't always there. I have not been able to track down what it is that's causing it, so I was hoping that maybe someone here had an idea?