Вопрос

While deploying a custom war to a WebSphere Liberty profile I get the following exception:

Class org.hsqldb.jdbcDriver not found

I have created and configured the databases by following:

http://pic.dhe.ibm.com/infocenter/wrklight/v6r0m0/index.jsp?topic=%2Fcom.ibm.worklight.help.doc%2Fadmin%2Ft_configuring_liberty_profile_for_derby_manually.html

And edited the server.xml file by following:

http://pic.dhe.ibm.com/infocenter/wrklight/v6r0m0/index.jsp?topic=%2Fcom.ibm.worklight.help.doc%2Fadmin%2Ft_configuring_liberty_profile_manually.html

In the web.xml of the generated custom war the resource references for the datasources have these values:

<res-ref-name>jdbc/WorklightDS</res-ref-name>
<res-ref-name>jdbc/WorklightReportsDS</res-ref-name>

But the datasources defined in the server xml have these others:

<dataSource jndiName="worklight/jdbc/WorklightDS" transactional="false" statementCacheSize="10">
<dataSource jndiName="worklight/jdbc/WorklightReportsDS" transactional="false" statementCacheSize="10">

Anyway I have tried changing the datasource jndi and I get the same exception.

I have also tried to add to the worklight.properties file the properties wl.db.jndi.name and wl.reports.db.jndi.name without success. I supose these properties are not longer valid in WL6.0.

Also tried adding a file ibm-web-bnd.xml to the generated war.

I guess the problem is related to the binding between the application and the Liberty profile datasources.

The only way I have been able to deploy the custom war is setting the Derby databases in the workligh.properties file.

wl.db.url=jdbc:derby:C:/WebSphere/Worklight60DBs/WRKLGHT;create=true
wl.reports.db.url=jdbc:derby:C:/WebSphere/Worklight60DBs/WLREPORT;create=true
wl.db.username=WORKLIGHT

For the error this is my server.xml:

<featureManager>                      
    <feature>jsp-2.2</feature>        
    <feature>ssl-1.0</feature>        
    <feature>servlet-3.0</feature>    
    <feature>jdbc-4.0</feature>       
    <feature>appSecurity-1.0</feature>
    <feature>jndi-1.0</feature>                                     
</featureManager>                     

<application id="CaixaProject" name="CaixaProject" location="CaixaProject.war" type="war">   
    <classloader delegation="parentLast">                                                        
        <commonLibrary>                                                                          
            <fileset dir="${shared.resource.dir}/lib" includes="worklight-jee-library.jar"/>                      
        </commonLibrary>                                                                         
    </classloader>                                                                               
</application>                                                                                   

<webContainer invokeFlushAfterService="false"/>  

<library id="DerbyLib">                                                                                               
    <fileset dir="${shared.resource.dir}/derby" includes="derby.jar"/>
</library>                          

<dataSource jndiName="jdbc/WorklightDS" transactional="false" statementCacheSize="10">                                                                           
    <jdbcDriver libraryRef="DerbyLib" javax.sql.ConnectionPoolDataSource="org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource"/>                                                                
    <properties.derby.embedded databaseName="C:/WebSphere/Worklight60DBs/WRKLGHT" user="WORKLIGHT" shutdownDatabase="false" connectionAttributes="upgrade=true"/>
    <connectionManager connectionTimeout="180" maxPoolSize="10" minPoolSize="1" reapTime="180" maxIdleTime="1800" agedTimeout="7200" purgePolicy="EntirePool" /> 
</dataSource>    

<dataSource jndiName="jdbc/WorklightReportsDS" transactional="false" statementCacheSize="10">                                                                                                                                                                                                                     
   <jdbcDriver libraryRef="DerbyLib" javax.sql.ConnectionPoolDataSource="org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource"/>                                
    <properties.derby.embedded databaseName="C:/WebSphere/Worklight60DBs/WLREPORT" user="WORKLIGHT" shutdownDatabase="false" connectionAttributes="upgrade=true"/>
    <connectionManager connectionTimeout="180" maxPoolSize="10" minPoolSize="1" reapTime="180" maxIdleTime="1800" agedTimeout="7200" purgePolicy="EntirePool" />  
</dataSource>

And the only properties I have modified in the worklight.properties file:

publicWorkLightHostname
publicWorkLightProtocol
publicWorkLightPort

How can I deploy a custom war to a Liberty profile using datasources?

Thank you.

Это было полезно?

Решение

is a misleading message. It is related to jndi configuration.

Your jndi references should include CaixaProject in the name like this in the server.xml

<dataSource jndiName="CaixaProject/jdbc/WorklightDS"
<dataSource jndiName="CaixaProject/jdbc/WorklightReportsDS" 

and inside the web.xml is should be like this

<res-ref-name>CaixaProject/jdbc/WorklightDS</res-ref-name>
<res-ref-name>CaixaProject/jdbc/WorklightReportsDS</res-ref-name>

Referece for you Worklight 6.0 does not start on Liberty - HSQLDB

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top