2013-08-19 88 views
0

虽然部署自定义战争到WebSphere自由的个人资料,我得到以下异常:IBM Worklight 6.0 - 如何绑定数据源?

类org.hsqldb.jdbcDriver没有找到

我已经创建并按照配置的数据库:

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

,并按照编辑的server.xml文件

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

在生成定制战争的web.xml中的数据源资源引用有下列值:

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

但在服务器定义XML数据源中有这些人:

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

无论如何,我已经尝试更改数据源jndi,我得到相同的异常。

我也尝试添加到worklight.properties文件的属性wl.db.jndi.name和wl.reports.db.jndi.name没有成功。我将这些属性在WL6.0中不再有效。

还尝试将文件ibm-web-bnd.xml添加到生成的战争中。

我想这个问题与应用程序和Liberty概要文件数据源之间的绑定有关。

我能够部署自定义战争的唯一方法是在workligh.properties文件中设置Derby数据库。

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 

对于这个错误是我的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> 

而且我已经在worklight.properties文件修改的唯一属性:

publicWorkLightHostname 
publicWorkLightProtocol 
publicWorkLightPort 

我如何部署自定义战争使用数据源的Liberty配置文件?

谢谢。

回答

0

是一个误导消息。它与jndi配置有关。

你的JNDI引用应包括CaixaProject在名称 这样在server.xml

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

,并在web.xml里面应该是这样的

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

Referece你Worklight 6.0 does not start on Liberty - HSQLDB

+0

你不应该触摸web.xml –

+0

嗨。我可以使用dataSource jndiName中的应用程序ID来工作。 (CaixaProject/jdbc/WorklightDS)并且不需要修改web.xml。再多一点评论,我所遭受的其他副作用是我下载了比为ProcessCenter配置的derby.jar版本更高的Derby版本。我使用较新的derby来创建工作灯和报表数据库,但我在server.xml中使用了较旧的jar。它导致应用程序也不启动。 – Jxadro

相关问题