Open Siwakhile opened 4 years ago
Hi @Siwakhile please try to output the command using the function output(); and run it manually in the console.
Usually this happens because the jasperstarter in linux needs execution setup. Do this sudo chmod +777 jasperstarter and sudo chmod +x jasperstarter
Hello,
I have the same problem. I see what's happening.
My console output its like:
./jasperstarter process "/var/www/html/....
If I execute in the command line I need to remove the innitial dot slash to execute the commnad.
Debugging the code at line 87 in PHPJasper file of the package I see this function:
private function checkServer()
{
return $this->command = $this->windows ? $this->executable : './' . $this->executable;
}
If I remove './' . the next code works well
$jasper = new PHPJasper;
$jasper->process(
$input,
$output,
$options
)->execute();
Why the dot slash is necessary or not? Depends on the linux flavor?
Why the dot slash is necessary or not? Depends on the linux flavor? On linux it´s mandatory ./ (dot slash) to execute de jasperstarter command. On windows japerstarter.exe ...... to execute
Hi, but I'm on a Linux Docker and it's not working with the dot-slash. Any ideas why?
try sh command, maybe, i am not sure
El sáb., 18 abr. 2020 a las 10:28, Jose Juan Calvo (< notifications@github.com>) escribió:
Hi, but I'm on a Linux Docker and it's not working with the dot-slash. Any ideas why?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PHPJasper/phpjasper/issues/211#issuecomment-615880580, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6OQ52C5RJRP24JGK7PANTRNG2JXANCNFSM4LD7QB2Q .
Hi, I found the problem and a solution.
I make an in depth debugging and catch the stderror and I get this error
Exception in thread "main" java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap') at de.cenote.tools.classpath.ApplicationClasspath.add(ApplicationClasspath.java:75) at de.cenote.tools.classpath.ApplicationClasspath.add(ApplicationClasspath.java:65) at de.cenote.tools.classpath.ApplicationClasspath.addJars(ApplicationClasspath.java:134) at de.cenote.tools.classpath.ApplicationClasspath.addJarsRelative(ApplicationClasspath.java:151) at de.cenote.jasperstarter.App.processReport(App.java:178) at de.cenote.jasperstarter.App.main(App.java:109)
I found that this is an error reported before in https://github.com/PHPJasper/phpjasper/issues/152
I have installed openjdk 11. Following the suggestions from some users I change java to version 1.8 following this steps.
I download the jdk following the instructions in this link
https://lv.binarybabel.org/catalog/java/jdk8
I execute in my home root
wget --no-check-certificate --no-cookies --header 'Cookie: oraclelicense=accept-securebackup-cookie' ' http://download.oracle.com/otn-pub/java/jdk/8u251-b08/3d5a2bb8f8d4428bbe94aed7ec7ae784/jdk-8u251-linux-x64.tar.gz'
Or download from https://www.oracle.com/java/technologies/javase-jdk8-downloads.html
After download execute this commands adapting these commands to your server or installation:
mkdir -p /usr/java
mv jdk-8u251-linux-x64.tar.gz /usr/java
cd /usr/java
tar zxvf jdk-8u251-linux-x64.tar.gz
rm jdk-8u251-linux-x64.tar.gz
cd /usr/java/jdk1.8.0_251/bin
./java -version
After that the java version installed in this directory must be:
java version "1.8.0_251"
Java(TM) SE Runtime Environment (build 1.8.0_251-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.251-b08, mixed mode)
Now configure this new Java package as the default one following the instructions on this link
https://www.javahelps.com/2015/03/install-oracle-jdk-in-ubuntu.html
So I add to the /etc/environment
nano /etc/environment
this lines
PATH=$PATH:/usr/java/jdk1.8.0_251/bin:/usr/java/jdk1.8.0_251/db/bin:/usr/java/jdk1.8.0_251/jre/bin
J2SDKDIR="/usr/java/jdk1.8.0_251/bin"
J2REDIR="/usr/java/jdk1.8.0_251/db/bin"
JAVA_HOME="/usr/java/jdk1.8.0_251/jre/bin"
and configure the new installed java jdk executing this commands
update-alternatives --install "/usr/bin/java" "java" "/usr/java/jdk1.8.0_251/bin/java" 0
update-alternatives --install "/usr/bin/javac" "javac" "/usr/java/jdk1.8.0_251/bin/javac" 0
update-alternatives --set java /usr/java/jdk1.8.0_251/bin/java
update-alternatives --set javac /usr/java/jdk1.8.0_251/bin/javac
After this you can see the new configured java jdk executing:
update-alternatives --list java
update-alternatives --list javac
After that, all is working well.
Best regards
Okey, congratulations, i am happy for you, and thanks for share and comment the solution for everyone. Best regards.
El dom., 19 abr. 2020 a las 8:18, Jose Juan Calvo (notifications@github.com) escribió:
Hi, I found the problem and a solution.
I make an in depth debugging and catch the stderror and I get this error
Exception in thread "main" java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap') at de.cenote.tools.classpath.ApplicationClasspath.add(ApplicationClasspath.java:75) at de.cenote.tools.classpath.ApplicationClasspath.add(ApplicationClasspath.java:65) at de.cenote.tools.classpath.ApplicationClasspath.addJars(ApplicationClasspath.java:134) at de.cenote.tools.classpath.ApplicationClasspath.addJarsRelative(ApplicationClasspath.java:151) at de.cenote.jasperstarter.App.processReport(App.java:178) at de.cenote.jasperstarter.App.main(App.java:109)
I found that this is an error reported before in
152 https://github.com/PHPJasper/phpjasper/issues/152
I have installed openjdk 11. Following the suggestions from some users I change java to version 1.8 following this steps.
I download the jdk following the instructions in this link
https://lv.binarybabel.org/catalog/java/jdk8
I execute in my home root
wget --no-check-certificate --no-cookies --header 'Cookie: oraclelicense=accept-securebackup-cookie' '
Or download from https://www.oracle.com/java/technologies/javase-jdk8-downloads.html
After download execute this commands adapting these commands to your server or installation:
mkdir -p /usr/java
mv jdk-8u251-linux-x64.tar.gz /usr/java
cd /usr/java
tar zxvf jdk-8u251-linux-x64.tar.gz
rm jdk-8u251-linux-x64.tar.gz
cd /usr/java/jdk1.8.0_251/bin
./java -version
After that the java version installed in this directory must be:
java version "1.8.0_251" Java(TM) SE Runtime Environment (build 1.8.0_251-b08) Java HotSpot(TM) 64-Bit Server VM (build 25.251-b08, mixed mode)
Now configure this new Java package as the default one following the instructions on this link
https://www.javahelps.com/2015/03/install-oracle-jdk-in-ubuntu.html
So I add to the /etc/environment
nano /etc/environment
this lines
PATH=$PATH:/usr/java/jdk1.8.0_251/bin:/usr/java/jdk1.8.0_251/db/bin:/usr/java/jdk1.8.0_251/jre/bin J2SDKDIR="/usr/java/jdk1.8.0_251/bin" J2REDIR="/usr/java/jdk1.8.0_251/db/bin" JAVA_HOME="/usr/java/jdk1.8.0_251/jre/bin"
and configure the new installed java jdk executing this commands
update-alternatives --install "/usr/bin/java" "java" "/usr/java/jdk1.8.0_251/bin/java" 0
update-alternatives --install "/usr/bin/javac" "javac" "/usr/java/jdk1.8.0_251/bin/javac" 0
update-alternatives --set java /usr/java/jdk1.8.0_251/bin/java
update-alternatives --set javac /usr/java/jdk1.8.0_251/bin/javac
After this you can see the new configured java jdk executing:
update-alternatives --list java
update-alternatives --list javac
After that, all is working well.
Best regards
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PHPJasper/phpjasper/issues/211#issuecomment-616119950, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6OQ5YFXGPV6STJUTCLPF3RNLT23ANCNFSM4LD7QB2Q .
Im only able to compile on linux shell,
on browser/apache I get
Fatal error: Uncaught PHPJasper\Exception\ErrorCommandExecutable: Your report has an error and couldn 't be processed!\ Try to output the command using the function
output();
and run it manually in the console. in /var/www/html/Siphile/admin/vendor/geekcom/phpjasper/src/PHPJasper.php:236 Stack trace: #0 /var/www/html/Siphile/admin/reporttest.php(9): PHPJasper\PHPJasper->execute() #1 {main} thrown in /var/www/html/Siphile/admin/vendor/geekcom/phpjasper/src/PHPJasper.php on line 23