Skip to main content

One EAR - multiple Swing Clients

4 replies [Last post]
janmueller
Offline
Joined: 2008-02-20

Hi

ok, this might be a more Netbeans-related question.
I developed an EJB-App (Swing-Client), and tried out if I could add second client to the Enterprise Application Project. I deployed it, and so far it worked. I could launch both clients using Webstart from the admin-console.

But when I choose "Run" (in Netbeans) on the Enterprise Application Project, the client throws the following Exception:

11.03.2008 08:46:10 com.sun.enterprise.appclient.MainWithModuleSupport
WARNUNG: ACC003: Application threw an exception.
java.lang.IllegalArgumentException: Could not locate an embedded app client matching the display name null
at com.sun.enterprise.appclient.NestedAppClientInfo.getAppClient(NestedAppClientInfo.java:153)
at com.sun.enterprise.appclient.AppClientInfo.getAppClient(AppClientInfo.java:202)
at com.sun.enterprise.appclient.AppClientInfo.completeInit(AppClientInfo.java:175)
at com.sun.enterprise.appclient.AppClientInfoFactory.buildAppClientInfo(AppClientInfoFactory.java:149)
at com.sun.enterprise.appclient.MainWithModuleSupport.(MainWithModuleSupport.java:366)
at com.sun.enterprise.appclient.MainWithModuleSupport.(MainWithModuleSupport.java:259)
at com.sun.enterprise.appclient.Main.main(Main.java:200)

Ok, I might just create a new EAR with the second client, but would it be possible to set a starting client, or make both clients start in an EAR?

Greetings,
Jan

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
santoszv
Offline
Joined: 2009-04-06

I [b]had [/b]the same problem (NetBeans 5.6.1). Today I'm resolved with this workaround.

* Open nbproject/project.properties in the EAR project
* Add the property 'application.args.param' with value '-name ${app.client}' below of property 'app.client'
[code]
app.client=<>
application.args.param=-name ${app.client}
[/code]

If I'm correct, the problem is in 'nbproject/build-impl.xml', an autogenerated file by NetBeans
[code]







[/code]

If you search in propject.properties and private.properties, 'application.args.param' and 'j2ee.appclient.mainclass.tool.param' don't exist. So we are free to use (by moment).

I only tried with 'application.args.param' because the name resemble 'for user' and worked for me at first time.

tjquinn
Offline
Joined: 2005-03-30

Hello, Jan.

It looks like the issue here is as follows: As you may know GlassFish creates a generated app client JAR file when an EAR contains one or more app client modules. It is this JAR that is used during launches of an app client.

When the generated JAR contains only one app client module there is no ambiguity about which client should be run, because there is only one. When the JAR contains multiple app clients then the app client container needs some help selecting which one to run.

One way of doing this is to specify the -name display-name option on the appclient command. Each app client's descriptor can contain a element, and the app client container will use the value of the -name option to select the app client with that display-name.

Of course, NetBeans is handling the launch of the app client for you when you run the EAR from inside NetBeans. Because the EAR - and therefore the generated app client JAR - contains multiple app clients it seems that NetBeans cannot tell which app client you want to run, so it has no way of telling the ACC which one to launch.

The error message is not the greatest but it does reflect that the app client container is trying to choose which of the multiple clients to run. It is falling back to try to use the -name value and because that option was not specified that's why the error reports "null" for the display name.

I am not sure if there is a way around this in NetBeans. You can do so outside of NetBeans if you (1) make sure to specify a in each of the app client's application-client.xml descriptors and then (2) on the appclient command specify -name xxx where xxx is the display-name of the client you want to launch.

The appclient command is capable of launching only one client at a time, but you could use appclient in two command windows and launch a different client in each.

I hope that helps some.

- Tim

janmueller
Offline
Joined: 2008-02-20

Hello Tim,

thanks a lot. Your post gave me quite a lot more understanding whats going on. Actually Netbeans generates application-client.xml files containing a display-name tag.
Whats quite a bit funny is that Netbeans lets you choose an Client-Project in the Properties-Dialog of the Enterprise Application Project. (As seen in the attached Screenshot), so I wonder if it's a bug or missing feature, that this information is just not used.

Here I post the server output for registering the clients, I wonder if its ok that module-name is empty.

Registering ad hoc servlet: WebPathPath: context root = "/PI1", path = "/Pi1-lager-client'
Registering ad hoc servlet: WebPathPath: context root = "/PI1", path = "/PI1-app-client'
Java Web Start services started for application com.sun.enterprise.appclient.jws.ApplicationContentOrigin@19e8be2 registration name=PI1
com.sun.enterprise.appclient.jws.NestedAppclientContentOrigin@1f1a75d registration name=PI1, context root=/PI1/Pi1-lager-client, module name=
, parent=PI1
com.sun.enterprise.appclient.jws.NestedAppclientContentOrigin@22cebe registration name=PI1, context root=/PI1/PI1-app-client, module name=
, parent=PI1

Greetings,
Jan

tjquinn
Offline
Joined: 2005-03-30

Hello, Jan.

The module being empty should not be a concern.

As long as the context-root value is there that's the key piece of information.

I am not sure of the internal details of how NetBeans is dealing with the multiple clients in the EAR and whether and how it passes the -name option and value. If it uses that technique then it should be working. Which is what you said earlier!

- Tim