Project

General

Profile

Bug #5615

Project builds should copy out p2jpl.jar from FWD

Added by Roger Borrello over 2 years ago. Updated over 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
Due date:
% Done:

0%

billable:
No
vendor_id:
GCD
case_num:

History

#1 Updated by Roger Borrello over 2 years ago

Vlad had this suggestion:

Hi Roger.

The goal ant import.db relies on the file p2jpl.jar is located in /usr/share/java, which is not mentioned in instructions and is quite unexpected.

I think, the build_db.xml should be fixed, so the file from the FWD distribution is used. The file should be copied to a temporary location first, and file access must be changed, so the file is readable by the postgresql system account.

Regards,

Vladimir

PS: below is the diff:

=== modified file 'build_db.xml'
--- build_db.xml    2021-07-29 18:11:21 +0000
+++ build_db.xml    2021-08-20 17:11:45 +0000
@@ -9,9 +9,7 @@
<format property="LOG_STAMP" pattern="yyyyMMdd_HHmmss" />
</tstamp>

-   <condition property="p2jpl.jar.path" value="${deploy.home.abs}/lib/p2jpl.jar" else="/usr/share/java/p2jpl.jar">
-      <isset property="isWindows"  />
-   </condition>
+   <property name="p2jpl.jar.path" value="${deploy.home}/lib/p2jpl.jar"/>

<!-- drop the H2 database by deleting the ${db.home} directory -->
<target name="clean.db.h2" description="Remove generated database directory." if="${db.h2}">
@@ -171,6 +169,8 @@
<arg value="${db.name}" />
</exec>
<!-- load the FWD UDF library into the database -->
+      <copy file="${p2jpl.jar.path}" tofile="/tmp/p2jpl.jar" />
+      <chmod file="/tmp/p2jpl.jar" perm="ugo+r"/>
<exec executable="psql">
<env key="PGPASSWORD" value="${sql.admin.pass}" />
<arg value="-U" />
@@ -180,7 +180,7 @@
<arg value="-p" />
<arg value="${db.port}" />
<arg value="-c" />
-         <arg value="select sqlj.install_jar('file://${p2jpl.jar.path}', 'p2j', true)" />
+         <arg value="select sqlj.install_jar('file:///tmp/p2jpl.jar', 'p2j', true)" />
<arg value="${db.name}" />
</exec>
<!-- set classpath for FWD UDF library -->

#2 Updated by Ovidiu Maxiniuc over 2 years ago

I encountered a related issue while setting up the pg database on Windows. My installation is on a dedicated drive Z:. The create.db.pg task finished without critical failure and the import advanced to next step, but later I saw this in log:

[exec] ERROR:  java.sql.SQLException: I/O exception reading jar file: z

I tried manually to run the script:

select sqlj.install_jar('file://z:/app_dir/deploy/lib/p2jpl.jar', 'p2j', true);

but I got similar results :(. Evidently, the install_jar attempts parse the first argument using a very strict tokenizer and the Windows specific path fail to match its pattern.
I tried some tricks like:
  • dropping the file:// protocol;
  • escaping the : with a \;
  • escaping the : with %3A like normal URLs.

None of these worked. The only accepted solution was to execute:

select sqlj.install_jar('file:///app_dir/deploy/lib/p2jpl.jar', 'p2j', true);

but being carefully to start psql from the Z: drive so that the absolute path is relative to current drive. If somebody has a solution here, please let me know.

PS:
I think the title should read p2jpl.jar instead of p2j.jar.

#3 Updated by Roger Borrello over 2 years ago

  • Subject changed from Project builds should copy out p2j.jar from FWD to Project builds should copy out p2jpl.jar from FWD

Also available in: Atom PDF