我下载了BlueMix Java样板,我正在使用它,考虑扩展其他表等等。我对在部署/运行时将BlueMix中的数据库服务链接到应用程序的‘自动连接’感到有点困惑。
在样板内部,persistence.xml中有一些配置内容如下:
<persistence-unit name="openjpa-todo">
<!-- The cloudAutowiring-1.0 Liberty feature will resolve this to whatever
the database service name is -->
<!-- When running locally without this feature, create a datasource with
the JNDI name "jdbc/mydbdatasource" in server.xml -->
<!-- If using MySQL locally then use the "url" property and append "?relaxAutoCommit=true", for example:
<dataSource id='mysql-datasource' jdbcDriverRef='mysql-driver' jndiName='jdbc/mydbdatasource'>
<properties user='root' password='password' url="jdbc:mysql://localhost:3306/db?relaxAutoCommit=true"/>
</dataSource> -->
<jta-data-source>java:comp/env/jdbc/mydbdatasource</jta-data-source>
<class>example.jpa.TODO</class>
<properties>
<!-- allow table definitions/creation on-the-fly jpa-2.0 feature -->
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)" />
<!-- allow table definitions/creation on-the-fly jpa-2.1 feature -->
<property name="eclipselink.ddl-generation" value="create-tables"/>
</properties>
</persistence-unit>BlueMix/ from如何将已部署的服务映射到jta-数据源/持久化单元?
自动装配是否需要满足任何条件或要求?
发布于 2015-04-10 19:24:55
其实挺酷的。在应用程序的部署过程中,buildpack允许您处理一些额外的逻辑。在中有一些逻辑,即在几个服务中自动连接。监控和分析,日志记录,仅举几个例子。节点buildpack也会这样做。
我已经捕捉到了下面的一些自动毛。
2015-04-10T15:24:51.98-0400 [STG] OUT -----> Liberty Buildpack Version: v1.15-20150402-1422
2015-04-10T15:24:51.98-0400 [STG] OUT -----> Retrieving IBM 7.1.2_sr2fp11ifx-20150312 JRE (ibm-java-jre-7.1-2.11-pxa6470_27sr2fp11ifx-20150312_01-sfj.tgz) ... (0.0s)
2015-04-10T15:24:52.82-0400 [STG] OUT Expanding JRE to .java ... (0.8s)
2015-04-10T15:24:52.82-0400 [STG] OUT -----> Retrieving App Management Agent 2015.03.09_101422 (com.ibm.ws.cloudoe.app-mgmt-proxy-agent.zip) ... (0.0s)
2015-04-10T15:24:52.92-0400 [STG] OUT Expanding App Management to .app-management (0.0s)
2015-04-10T15:24:52.92-0400 [STG] OUT -----> Retrieving com.ibm.ws.liberty-2015.3.0.0-201504021422.tar.gz ... (0.0s)
2015-04-10T15:24:53.74-0400 [STG] OUT Installing archive ... (0.8s)
2015-04-10T15:24:53.76-0400 [STG] OUT -----> Retrieving com.ibm.ws.liberty.ext-2015.3.0.0-201504021422.tar.gz ... (0.0s)
2015-04-10T15:24:54.15-0400 [STG] OUT Installing archive ... (0.3s)
2015-04-10T15:24:54.33-0400 [STG] OUT -----> Retrieving and installing client jar(s) from com.ibm.ws.icap.clientJars.cloudant.zip (0.1s)
2015-04-10T15:24:54.34-0400 [STG] OUT -----> Auto-configuration is creating config for service instance 'Cloudant NoSQL DB-wr' of type 'cloudantNoSQLDB'
2015-04-10T15:24:54.36-0400 [STG] OUT -----> Liberty buildpack is done creating the droplet
2015-04-10T15:24:54.63-0400 [STG] ERR
2015-04-10T15:25:06.80-0400 [STG] OUT -----> Uploading droplet (147M)构建包寻找的是绑定到应用程序的服务。如果有绑定服务,如Cloudant或监控和分析,它将添加正确的资源。对于Cloudant,因为它是JDBC,它将为您创建JDBC连接。
此外,自由构建包还为以下服务类型提供了自动配置: SQL数据库ClearDB MySQL数据库MySQL ElephantSQL PostgreSQL Cloudant™NoSQL数据库MongoLab dashDB数据缓存会话缓存MQ光监视和分析新文物上的自动缩放单标牌
https://stackoverflow.com/questions/29569156
复制相似问题