But for Glassfish V3, I cannot find any guide, and authentication failed for Glassfish V3.1.1. And then I downloaded the source code of Glassfish V3.1.1 and BlazeDS 4, after 1 day's debugging. I got the solution hacking TomcatValve again. If you don't want to know the detail, just download the jar file or java file. For java file you have to compile that by yourself in BlazeDS 4 open source project. And for jar file, put them into the following directory:
$glassfish_home/glassfish/lib/
If you want to know all the detail about this issue, you can read the article below.
What caused BlazeDS's TomcatValve failed to authenticate?
No method found for Realm.authenticate(String username, String password).
Why BlazeDS's TomcatValve doesn't work for Glassfish V3.1.1 Server?
Glassfish changed it's method signature to Realm.authenticate(String username, char[] password).
How to hack?
Simple replace the method invocation with the following code segment:
char[] passwordCharArray = password.toCharArray(); try { Method m = realm.getClass().getMethod("authenticate", String.class, char[].class); principal = (Principal) m.invoke(realm, username, passwordCharArray); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); }
More details.
Glassfish(Tomcat) Server will configure Web Module via following class and method:
WebModule.configureCatalinaProperties
/** * Configure theWebModule
We can see, why we have to configure "" into glassfish-web.xml,