eclipse-ee4j / glassfish

Eclipse GlassFish
https://eclipse-ee4j.github.io/glassfish/
383 stars 143 forks source link

Server CreateDecorator does not create config in same transaction #13753

Closed glassfishrobot closed 14 years ago

glassfishrobot commented 14 years ago

It looks like the config that is created when a server instance is created (and no cluster or existing config is specified) is not created in the same transaction as the server instance. This means that if class-level bean validation fails on Server, then the instance creation is rolled back but not the config creation. This leaves an orphaned config which causes downstream problems.

To see this:

================================================================= $ asadmin create-node-config foo Command create-node-config executed successfully.

$ asadmin create-instance --node localhost foo remote failure: Exception while adding the new configuration Constraints for this bean violated. Message = Name is already used by another instance, cluster, config or node : org.jvnet.hk2.config.TransactionFailure: Constraints for this bean violated. Message = Name is already used by another instance, cluster, config or node Constraints for this bean violated. Message = Name is already used by another instance, cluster, config or node

Ignore the ugly error message, but do look at domain.xml. You'll see there is no server instance named "foo", but there is a config named "foo-config".

The config really should be created in the same transaction as the server instance. Then it's creation would be rolled back when the constraint violation occurred.

Environment

Operating System: All Platform: All

Affected Versions

[3.1]

glassfishrobot commented 6 years ago
glassfishrobot commented 14 years ago

@glassfishrobot Commented bhaktimehta said: Created an attachment (id=5045) patch

glassfishrobot commented 14 years ago

@glassfishrobot Commented bhaktimehta said: I have a patch for this and this works will commit once I can see the cause of 7 devtest failures I have not related to my changes

./asadmin create-node-config foo66 Command create-node-config executed successfully. /Users/bhakti/gftest/foradmin/glassfishv3/glassfish/bin % asadmin create-instance --node localhost foo bash: asadmin: command not found /Users/bhakti/gftest/foradmin/glassfishv3/glassfish/bin % ./asadmin create-instance --node localhost foo66 Using DAS host localhost and port 4848 from existing das.properties for node localhost. To use a different DAS, create a new node using create-node-ssh or create-node-config. Create the instance with the new node and correct host and port: asadmin --host das_host --port das_port create-local-instance --node node_name instance_name. Command _create-instance-filesystem executed successfully. Port Assignments for server instance foo66: JMX_SYSTEM_CONNECTOR_PORT=28686 JMS_PROVIDER_PORT=27676 HTTP_LISTENER_PORT=28080 ASADMIN_LISTENER_PORT=24848 JAVA_DEBUGGER_PORT=29009 IIOP_SSL_LISTENER_PORT=23820 IIOP_LISTENER_PORT=23700 OSGI_SHELL_TELNET_PORT=26666 HTTP_SSL_LISTENER_PORT=28181 IIOP_SSL_MUTUALAUTH_PORT=23920 The instance, foo66, was created on host localhost

Command create-instance executed successfully.

glassfishrobot commented 14 years ago

@glassfishrobot Commented bhaktimehta said: Sending admin/config-api/src/main/java/com/sun/enterprise/config/serverbeans/Cluster.java Sending admin/config-api/src/main/java/com/sun/enterprise/config/serverbeans/CopyConfig.java Sending admin/config-api/src/main/java/com/sun/enterprise/config/serverbeans/LocalStrings.properties Sending admin/config-api/src/main/java/com/sun/enterprise/config/serverbeans/Server.java Sending cluster/admin/src/main/java/com/sun/enterprise/v3/admin/cluster/CopyConfigCommand.java Sending cluster/admin/src/main/java/com/sun/enterprise/v3/admin/cluster/LocalStrings.properties Transmitting file data ...... Committed revision 41384.

glassfishrobot commented 14 years ago

@glassfishrobot Commented File: joe-patch.txt Attached By: bhaktimehta

glassfishrobot commented 14 years ago

@glassfishrobot Commented Was assigned to bhaktimehta

glassfishrobot commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA GLASSFISH-13753

glassfishrobot commented 14 years ago

@glassfishrobot Commented Reported by @barchetta

glassfishrobot commented 14 years ago

@glassfishrobot Commented Marked as fixed on Tuesday, October 5th 2010, 4:29:08 am