我已经创建了集群“mycluster”、两个本地实例以及资源 jms/Queue1、jms/Queue2 和 jms/Topic 以及目标服务器和集群。
所以我就这样创建了集群:
- create-cluster mycluster
- create-instance --node localhost-domain1 --cluster mycluster instance01
- create-instance --node localhost-domain1 --cluster mycluster instance02
[...]
- start-cluster mycluster
- deploy --target mycluster Coo.ear
Application deployed with name Coo.
Warning: Command _deploy did not complete successfully on server instance instance01: remote failure: Failed to load the application on instance instance01. The application will not run properly. Please fix your application and redeploy.
Exception while loading the app : EJB Container initialization error. Please see server.log for more details.
Warning: Command _deploy did not complete successfully on server instance instance02: remote failure: Failed to load the application on instance instance02. The application will not run properly. Please fix your application and redeploy.
Exception while loading the app : EJB Container initialization error. Please see server.log for more details.
Command deploy completed with warnings.
[...]
On [server]: hostname:8080/FE-war/ all right.
On [instance01 the cluster] hostname:28080/FE-war
and
On [instance02 the cluster] hostname:28081/FE-war
我得到了令人绝望的 HTTP 状态 404 - 未找到 ((((
完整日志文件服务器,instance01,instance02,[...]:
https://drive.google.com/folderview?id=0B7CqU8774DG8RGx0VkRVeEZXclE&usp=sharing
2016-02-06T17:00:24.593+0100] [glassfish 4.1] [SEVERE] [] [org.eclipse.persistence.session./file:/home/glassfish/glassfish4/glassfish/nodes/localhost-domain1/Coo1/applications/ejb-timer-service-app/WEB-INF/classes/___EJB__Timer__App.ejb] [tid: _ThreadID=22 _ThreadName=RunLevelControllerThread-1454774410800] [timeMillis: 1454774424593] [levelValue: 1000] [[
Local Exception Stack:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.1.v20150605-31e8258): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: java.net.ConnectException: Errore di connessione al server localhost sulla porta 1527 con messaggio Connessione rifiutata.
Error Code: 0
[...]
您的数据库/数据源配置不正确。它当前想要连接到
localhost:1527
上的数据库,但这意味着每个实例将尝试连接到其本地的数据库。显然这不是您想要的 - 您希望您的应用程序始终连接到同一个数据库,无论使用什么实例。
您需要编辑集群配置中的数据源以使用正确的主机名,以便每个实例连接到,例如,
dbserver:1527
,如果这是生产部署,请将数据库从 Derby 更改为其他数据库(例如 MySQL、 MariaDB、PostgreSQL 等)。 Apache Derby 不适合生产使用。
要在集群主机之一或运行的 DAS 主机上启动 derby 数据库服务器。
asadmin start-database
您还需要在管理控制台中重新配置 jdbc/__default 数据源的 URL。选择 DerbyPool 连接池的“附加属性”选项卡,并将 serverName 从 localhost 更改为启动数据库的服务器的主机名。