I want to load postgreSQL jar file from ear archive .
this is my configuration :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<includeLibInApplicationXml>true</includeLibInApplicationXml>
<generateApplicationXml>true</generateApplicationXml>
<defaultLibBundleDir>/lib</defaultLibBundleDir>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
<modules>
<jarModule>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</jarModule>
<webModule>
<groupId>${project.groupId}</groupId>
<artifactId>module-war</artifactId>
<uri>/foodpicker.war</uri>
<!-- Set custom context root -->
<contextRoot>/</contextRoot>
</webModule>
</modules>
</configuration>
</plugin>
and server.xml :
<server description="Default Server">
<featureManager>
<feature>cdi-2.0</feature>
<feature>beanValidation-2.0</feature>
<feature>appSecurity-3.0</feature>
<feature>managedBeans-1.0</feature>
<feature>ejbLite-3.2</feature>
<feature>localConnector-1.0</feature>
<feature>microProfile-3.3</feature>
<feature>jpa-2.2</feature>
<feature>jwt-1.0</feature>
</featureManager>
<library id="project-libs">
<fileset dir="lib" includes="*.jar"/> // <--- not loaded from ear file !!!
</library>
<dataSource jndiName="jdbc/jta-datasource" transactional="true">
<jdbcDriver id="database-driver" libraryRef="project-libs"/>
<properties databaseName="${database.name}" serverName="${database.hostname}" portNumber="${database.port}"
user="${database.username}" password="${database.password}"/>
</dataSource>
<basicRegistry id="basic" realm="BasicRealm"/>
<httpSession securityIntegrationEnabled="false"/>
<httpEndpoint id="defaultHttpEndpoint" host="*" httpPort="8080" httpsPort="9443">
<httpOptions http2="enabled"/>
</httpEndpoint>
<webContainer disableXPoweredBy="true"/>
<applicationManager autoExpand="true"/>
<applicationMonitor updateTrigger="mbean"/>
</server>
this is directory structure of ear file :
.
├── foodpicker.war
├── lib
│ └── org.postgresql-postgresql-42.2.12.jar
└── META-INF
├── application.xml
├── MANIFEST.MF
└── maven
└── ir.moke.foodpicker
└── module-ear
├── pom.properties
└── pom.xml
if i change <fileset> to absolute path of another directory on filesystem , application load and worked without any problem . but i want to OpenLiberty Application Server load this library from ear file .
How can fix this problem ?
UPDATE
finally i configured server.xml to fix this problem :
<library id="project-libs">
<fileset dir="${server.config.dir}/lib" includes="*.jar"/>
</library>
<dataSource jndiName="jdbc/jta-datasource" transactional="true">
<jdbcDriver id="database-driver" libraryRef="project-libs"/>
<properties databaseName="${database.name}" serverName="${database.hostname}" portNumber="${database.port}"
user="${database.username}" password="${database.password}"/>
</dataSource>