TIBCOSoftware / bw6-plugin-maven

Plug-in Code for Apache Maven and TIBCO ActiveMatrix BusinessWorks™
Other
65 stars 78 forks source link

EAR building/deployment Issue for mavenized Code with custom plug-in #634

Open darpansil opened 2 years ago

darpansil commented 2 years ago

Maven Plugin version: 2.7.1 Maven version: 3.6.3 Product : TIBCO ActiveMatrix Businessworks Product version: 6.6.1 Component: Maven build plugin

Steps to reproduce the issue: 1) Created Custom JDBC driver for Sybase(via jconn4.jar ) as per instruction provided by TIBCO.

2) Mavenized the Custom JDBC driver through Configure  Convert to Maven Project

3) Published the org.osgi.service.jdbc.jar to local Maven Repository:

mvn install:install-file -Dfile=org.osgi.service.jdbc.jar -DgroupId=com.tibco.plugins -DartifactId=org.osgi.service.jdbc -Dversion=5.0.0 -Dpackaging=jar

4) Published the jconn4.jar to local Maven Repository:

mvn install:install-file -Dfile=jconn4.jar -DgroupId=com.sybase.jdbc4.jdbc -DartifactId=jconn4 -Dversion=1.0.0 -Dpackaging=jar

5) Then add the following dependency to the custom driver POM file:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.tibco.custom.driver</groupId>
  <artifactId>PBNA.Sybase</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <outputDirectory>target/classes</outputDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.3</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.tibco.plugins</groupId>
        <artifactId>bw6-maven-plugin</artifactId>
        <version>2.7.0</version>
        <extensions>true</extensions>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
        <groupId>com.tibco.plugins</groupId>
        <artifactId>org.osgi.service.jdbc</artifactId>
        <version>5.0.0</version>
    </dependency>
    <dependency>
        <groupId>com.sybase.jdbc4.jdbc</groupId>
        <artifactId>jconn4</artifactId>
        <version>1.0.0</version>
    </dependency>
  </dependencies>
</project>

6) Executed “clean package”

7) Console output for mvn package giving success and including all Modules in EAR:

======================
[INFO] --- bw6-maven-plugin:2.7.1:bwmodule (default-bwmodule) @ FileActivityTester ---
[INFO] Module Packager Mojo started for Module FileActivityTester ...
[INFO] Updated the Manifest version 
[INFO] The OSGi verion is 2.0.0 for Maven version of 2.0.0
[INFO] Removing the externals entries if any. 
[INFO] Created Plugin JAR with name C:\GIT\FileActivityTesterWithCustPlugin\FileActivityTester\target\FileActivityTester_2.0.0.jar
[INFO] Adding Maven Dependencies to the Plugin JAR file
[INFO] Creating the Plugin JAR file
[INFO] Building jar: C:\GIT\FileActivityTesterWithCustPlugin\FileActivityTester\target\FileActivityTester_2.0.0.jar
[INFO] BW Module Packager Mojo finished execution.
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building FileActivityTester.application 2.0.0
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ FileActivityTester.application ---
[INFO] Deleting C:\GIT\FileActivityTesterWithCustPlugin\FileActivityTester.application\target
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ FileActivityTester.application ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Using 'null' encoding to copy filtered properties files.
[INFO] skip non existing resourceDirectory C:\GIT\FileActivityTesterWithCustPlugin\FileActivityTester.application\src\main\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ FileActivityTester.application ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) @ FileActivityTester.application ---
[INFO] Not copying test resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ FileActivityTester.application ---
[INFO] Not compiling test sources
[INFO] 
[INFO] --- bw6-maven-plugin:2.7.1:bwtest (default-bwtest) @ FileActivityTester.application ---
[INFO] -------------------------------------------------------
[INFO] Skipping Test phase.
[INFO] -------------------------------------------------------
[INFO] 
[INFO] --- bw6-maven-plugin:2.7.1:bwear (default-bwear) @ FileActivityTester.application ---
[INFO] BWEARPackager Mojo started ...
[INFO] Updated the Manifest version 
[INFO] The OSGi verion is 2.0.0 for Maven version of 2.0.0
[INFO] Adding Modules to the EAR file
[INFO] Adding Module JAR with name FileActivityTester_2.0.0.jar with version 2.0.0
[INFO] Adding Module JAR with name com.tibco.custom.driver.PBNA.Sybase-1.0.0.qualifier.jar with version null
[INFO] Adding EAR Information to the EAR File
[INFO] Manifest updated with Version 2.0.0
[INFO] The EAR file name for Application is C:\GIT\FileActivityTesterWithCustPlugin\FileActivityTester.application\target\FileActivityTester.application_2.0.0.ear
[INFO] Building jar: C:\GIT\FileActivityTesterWithCustPlugin\FileActivityTester.application\target\FileActivityTester.application_2.0.0.ear
[INFO] BWEARPackager Mojo finished execution
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building FileActivityTester.application.parent 2.0.0
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ FileActivityTester.application.parent ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] com.tibco.custom.driver.PBNA.Sybase ................ SUCCESS [  1.980 s]
[INFO] FileActivityTester ................................. SUCCESS [  1.351 s]
[INFO] FileActivityTester.application ..................... SUCCESS [  0.441 s]
[INFO] FileActivityTester.application.parent .............. SUCCESS [  0.040 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.542 s
[INFO] Finished at: 2021-10-27T18:37:47-07:00
[INFO] Final Memory: 29M/226M
======================

8) But While deploying this EAR(FileActivityTester.application_2.0.0.ear) Application is not getting started. With the below Error "Native library not found.":

2021-10-27 20:48:43.309 INFO  [main] com.tibco.thor.frwk - bwappnode TIBCO ActiveMatrix BusinessWorks version 6.6.1, build V26, 2020-05-15 initialized using logging config /opt/tibco/product/bw/6.6/domains/PBNA-ORTEC-Q1/appnodes/as-FileActivityTester-1/an-FileActivityTester-peplap05834/logback.xml
2021-10-27 20:48:43.359 INFO  [AppNodeStateNotificationThread] com.tibco.thor.frwk - AppNodeStateNotificationThread started
2021-10-27 20:48:44.456 ERROR [main] com.tibco.thor.frwk - Not all bundles resolved!
2021-10-27 20:48:45.757 ERROR [main] com.tibco.hawk.microagent.bw6.Activator - {}
java.lang.UnsatisfiedLinkError: Native library not found. Tried to load tibrvnativesd64 and tibrvnativesd
    at com.tibco.tibrv.Tibrv.loadNativeLibrary(Tibrv.java:396)
    at com.tibco.tibrv.Tibrv.<clinit>(Tibrv.java:79)
    at COM.TIBCO.hawk.util.tibrv.TibrvProxy.open(TibrvProxy.java:44)
    at COM.TIBCO.hawk.util.tibrv.TibrvProxy.open(TibrvProxy.java:27)
    at COM.TIBCO.hawk.ami.tibrv.AmiRvSessionTransport.init(AmiRvSessionTransport.java:455)
    at COM.TIBCO.hawk.ami.AmiSession.<init>(AmiSession.java:399)
    at COM.TIBCO.hawk.ami.AmiSessionFactory.getAmiSession(AmiSessionFactory.java:208)
    at com.tibco.hawk.microagent.bw6.Activator.super(Activator.java:268)
    at com.tibco.hawk.microagent.bw6.Activator.activate(Activator.java:108)
    at com.tibco.hawk.microagent.bw6.Activator.start(Activator.java:78)
    at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:771)
    at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:764)
    at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:721)
    at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:936)
    at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:319)
    at org.eclipse.osgi.container.Module.doStart(Module.java:571)
    at org.eclipse.osgi.container.Module.start(Module.java:439)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1562)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)
    at org.eclipse.osgi.container.SystemModule.startWorker(SystemModule.java:242)
    at org.eclipse.osgi.container.Module.doStart(Module.java:571)
    at org.eclipse.osgi.container.Module.start(Module.java:439)
    at org.eclipse.osgi.container.SystemModule.start(SystemModule.java:172)
    at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:393)
    at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:412)
    at org.eclipse.osgi.launch.Equinox.start(Equinox.java:115)
    at com.tibco.bw.thor.admin.node.commands.StartCommand.start(StartCommand.java:510)
    at com.tibco.bw.thor.admin.node.commands.StartCommand.doExecute(StartCommand.java:211)
    at com.tibco.bw.thor.management.cli.commands.AbstractCommand.execute(AbstractCommand.java:62)
    at org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)
    at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)
    at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)
    at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)
    at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)
    at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)
    at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)
    at com.tibco.bw.thor.management.cli.commands.AbstractMain.run(AbstractMain.java:483)
    at com.tibco.bw.thor.management.cli.commands.AbstractMain.run(AbstractMain.java:452)
    at com.tibco.bw.thor.management.cli.commands.AbstractMain.mainLoop(AbstractMain.java:180)
    at com.tibco.bw.thor.admin.node.Main.main(Main.java:36)
Caused by: java.lang.UnsatisfiedLinkError: no tibrvnativesd in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1122)
    at com.tibco.tibrv.Tibrv.loadNativeLibrary(Tibrv.java:393)
    ... 42 common frames omitted
2021-10-27 20:48:48.772 INFO  [main] com.tibco.bw.frwk.engine.BWEngine - TIBCO-BW-FRWK-300002: BW Engine [Main] started successfully.
2021-10-27 20:48:49.704 INFO  [main] com.tibco.thor.frwk - AppNode (OSGi Framework) started in 6 seconds
2021-10-27 20:48:49.708 INFO  [Framework Event Dispatcher: Equinox Container: c0fb2b2f-9137-001c-1aca-e0d2686c0c08] com.tibco.thor.frwk.Deployer - TIBCO-THOR-FRWK-300001: Started OSGi Framework of AppNode [an-FileActivityTester-peplap05834] in AppSpace [as-FileActivityTester-1] of Domain [PBNA-ORTEC-Q1]

9) But the same code with Studio generated EAR(FileActivityTester.application_1.0.0.ear), getting deployed and running fine:

2021-10-27 21:19:23.082 INFO  [qtp107799732-69] com.tibco.thor.frwk.Application - TIBCO-THOR-FRWK-300005: Starting BW Application [FileActivityTester.application:1.0]
2021-10-27 21:19:23.100 INFO  [qtp107799732-69] com.tibco.thor.frwk.Application - TIBCO-THOR-FRWK-300021: All Application dependencies are resolved for Application [FileActivityTester.application:1.0]
2021-10-27 21:19:25.454 INFO  [EventAdminThread #5] com.tibco.thor.frwk.Application - TIBCO-THOR-FRWK-300006: Started BW Application [FileActivityTester.application:1.0]

Additional information you deem important

10) After Comparing/decoding both EAR (maven generated and Studio generated) found the following deferences, PFA doc for detail Pictures:

a. Same osgi version present in .jar for Studio EAR: Where a no osgi version not present in .jar for maven generated EAR:

c. Resource folder missing for maven generated EAR:

Note: initially referred to defect 103 for similar issue with CE, but still the issue exists with BW6.

darpansil commented 2 years ago

Added Attachments.

darpansil commented 2 years ago

referred Issue # 139 earlier, but didn't resolve the current issue..