Hi Tim,
I refactored my demo by your recommendation and the Embedded ACC is already working, but I still have few question.
The annotations like @EJB are not working when I call an Application Client from Embedded ACC, is it normal?
Is it okay or related with this complier warning:
Compiling 1 source file to /java/projects/HelloApp/HelloApp-emb-ACC/build/classes
/java/resources/repository/SunGFv3/gf-client-module.jar(org/glassfish/appclient/client/acc/AppClientContainer.class): warning: Cannot find annotation method 'value()' in type 'org.jvnet.hk2.annotations.Scoped': class file for org.jvnet.hk2.annotations.Scoped not found
1 warning
When the Applicaton Client finished and falled back into Embedded ACC the "acc.stop()" throws a "java.lang.IllegalStateException", why?
What fault I do there?
The test source included.
Thanks, Attila.
THE SCRIPT:
-----------
#!/bin/sh
echo "get STUB"
/java/glassfishv3/glassfish/bin/asadmin get-client-stubs --appname HelloApp /java/projects/HelloApp/dist
echo "start STD"
cd /java/projects/HelloApp/HelloApp-std-client/dist
java -cp /java/glassfishv3/glassfish/modules/gf-client.jar:/java/projects/HelloApp/HelloApp-std-client/dist/lib/HelloApp-com.jar:/java/projects/HelloApp/HelloApp-std-client/dist/HelloApp-std-client.jar enterprise.hello_stateless_client.StandaloneStatelessJavaClient
echo "start ACC"
cd /java/projects/HelloApp/dist
/java/glassfishv3/glassfish/bin/appclient -client HelloAppClient.jar -name HelloApp-app-client
echo "start EmbeddedACC"
cd /java/projects/HelloApp/dist
java -cp /java/glassfishv3/glassfish/modules/gf-client.jar:/java/projects/HelloApp/HelloApp-emb-ACC/dist/lib/HelloApp-com.jar:/java/projects/HelloApp/HelloApp-emb-ACC/dist/lib/HelloApp-std-client.jar:/java/projects/HelloApp/HelloApp-emb-ACC/dist/HelloApp-emb-ACC.jar enterprise.hello_stateless_client.EmbACCStatelessJavaClient
cd /java/projects
THE RESULTS:
------------
root_at_aszomor:/java/projects# ./hellostub_and_testacc.sh
get STUB
Authentication failed with password from login store: /root/.asadminpass
Enter admin password for user "admin">
Command get-client-stubs executed successfully.
start STD
2010.03.31. 10:32:55 com.sun.enterprise.transaction.JavaEETransactionManagerSimplified initDelegates
INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
start ACC
2010.03.31. 10:32:59 com.sun.enterprise.transaction.JavaEETransactionManagerSimplified initDelegates
INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
start EmbeddedACC
2010.03.31. 10:33:07 com.sun.enterprise.transaction.JavaEETransactionManagerSimplified initDelegates
INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate
@EJB sets the 'StatelessSession' to null !
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
java.lang.IllegalStateException
at org.glassfish.appclient.client.acc.AppClientContainer.stop(AppClientContainer.java:543)
at enterprise.hello_stateless_client.EmbACCStatelessJavaClient.main(EmbACCStatelessJavaClient.java:64)
root_at_aszomor:/java/projects#
THE ERROR PLACE IS:
-------------------
acc = builder.newContainer(StatelessJavaClient.class);
try {
acc.startClient(args);
} finally {
acc.stop(); <<-- java.lang.IllegalStateException
}
[Message sent by forum member 'aszomor']
http://forums.java.net/jive/thread.jspa?messageID=394603