Skip to content

Argument -p: expected one argument #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
amelyec opened this issue Sep 21, 2017 · 6 comments
Closed

Argument -p: expected one argument #63

amelyec opened this issue Sep 21, 2017 · 6 comments

Comments

@amelyec
Copy link

amelyec commented Sep 21, 2017

Facing the error below while trying to compile;

D:\xampp\htdocs\pro\testoneusage: jasperstarter process [-h] -f [ ...] [-o ] [-w]
[-a []] [-P [ ...]]
[-r []] [-t ] [-H ]
[-u ] [-p ] [-n ]
[--db-sid ] [--db-port ]
[--db-driver ] [--db-url ]
[--jdbc-dir

] [--data-file ]
[--csv-first-row] [--csv-columns ]
[--csv-record-del ]
[--csv-field-del ]
[--csv-charset ] [--xml-xpath ]
[--json-query ] [-N ] [-d]
[-s ] [-c ]
[--out-field-del ]
[--out-charset ]
jasperstarter: error: argument -p: expected one argument
PHP Fatal error: Uncaught exception 'JasperPHP\Exception\ErrorCommandExecutable' with message 'Your report has an error and couldn 't be processed!\ Try to output the command using the functi
on output(); and run it manually in the console.' in D:\xampp\htdocs\pro\testone\vendor\geekcom\phpjasper\src\JasperPHP.php:198
Stack trace:
#0 D:\xampp\htdocs\pro\testone\report.php(52): JasperPHP\JasperPHP->execute()
#1 {main}
thrown in D:\xampp\htdocs\pro\testone\vendor\geekcom\phpjasper\src\JasperPHP.php on line 198

Fatal error: Uncaught exception 'JasperPHP\Exception\ErrorCommandExecutable' with message 'Your report has an error and couldn 't be processed!\ Try to output the command using the function o utput(); and run it manually in the console.' in D:\xampp\htdocs\pro\testone\vendor\geekcom\phpjasper\src\JasperPHP.php:198
Stack trace:
#0 D:\xampp\htdocs\pro\testone\report.php(52): JasperPHP\JasperPHP->execute()
#1 {main}
thrown in D:\xampp\htdocs\pro\testone\vendor\geekcom\phpjasper\src\JasperPHP.php on line 198

@geekcom
Copy link
Member

geekcom commented Sep 25, 2017

Hello @amechax, show your code.

@amelyec
Copy link
Author

amelyec commented Sep 25, 2017

Hi, please find the code below

require __DIR__ . '/vendor/autoload.php';

use JasperPHP\JasperPHP;

$input = __DIR__ . '/vendor/geekcom/phpjasper/examples/TemplateData03.jrxml';   
echo __DIR__;

$jasper = new JasperPHP;
$jasper->compile($input)->execute();

$input = __DIR__ . '/vendor/geekcom/phpjasper/examples/TemplateData03.jasper';  
$output = __DIR__ . '/vendor/geekcom/phpjasper/examples';    

$options = [
    'format' => ['pdf'],
    'locale' => 'en',
    'params' => [],
    'db_connection' => [
    'driver' => 'mysql',
    'username' => 'root',
    'password' => '',
    'host' => 'localhost',
    'database' => 'crm',
    'port' => '3306'
    ]
];

$jasper->process(
        $input,
        $output,
        $options
)->execute();

@azaman2204
Copy link

azaman2204 commented Nov 24, 2017

How I solved/figured out with this ERROR below:

Fatal error: Uncaught exception 'JasperPHP\Exception\ErrorCommandExecutable' with message 'Your report has an error and couldn 't be processed!\ Try to output the command using the function o utput(); and run it manually in the console.

  1. As suggested by geekcom, I echo the output commands to execute by changing the following to get the command line

$jasper->process( $input, $output, $options )->execute();
TO
echo $jasper->process( $input, $output, $options )->output();

  1. I ran the output of the above (1) on the console, and found out the issue/problem.
    Found out the problem was with one of my parameter that was using java.sql.Date type which is not yet supported by PHPJasper. I changed the parameter type in Jasper Studio to string type and it solved the problem.

@geekcom
Copy link
Member

geekcom commented Nov 24, 2017 via email

@geekcom geekcom closed this as completed Dec 4, 2017
@mutaqinzae
Copy link

How I solved/figured out with this ERROR below:

Fatal error: Uncaught exception 'JasperPHP\Exception\ErrorCommandExecutable' with message 'Your report has an error and couldn 't be processed!\ Try to output the command using the function o utput(); and run it manually in the console.

1. As suggested by geekcom, I echo the output commands to execute by changing the following to get the command line

$jasper->process( $input, $output, $options )->execute();
TO
echo $jasper->process( $input, $output, $options )->output();

1. I ran the output of the above (1) on the console, and found out the issue/problem.
   Found out the problem was with one of my parameter that was using  **java.sql.Date**  type which is not yet supported by PHPJasper. I changed the parameter type in Jasper Studio to   **string** type and it solved the problem.

Dear @azaman2204

How to run the output from console?
Thanks in advance

Regards,
Zaenal M

@akhil5570
Copy link

Dear @amechax , Argument -p: expected one argument | Because you not passed any password in the DB config. Create an user for your database and assign rights, then pass that username and password in Jasper config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants