Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Applet/JWS not launching application with Form-based Authentication config

980718Dec 19 2012 — edited Dec 19 2012
I have a web application having an index.jsp as a welcome page and it has two href links. One pointing to jnlp file and the other to a jsp (having applet config in it). Either way, a swing application is launched via JWS or java-plugin in the browser depending on which link got clicked.

This application is deployed in Tomcat 7 with form based authentication configured for every resource in the context i.e. /*.

On requesting index.jsp (the very first request to server) from browser, i am correctly redirected to login.jsp and on passing right credentials, web server successfully redirects and delivers contents of index.jsp. So far so good.

Now, on clicking jnlp link, JWS complains of JNLParseException (arising due to the jnlp file content being that of login.jsp). On clicking the other link (pointing to jsp having applet config in it), java plugin complains of 'ClassFormatError - incompatible magic value 1008813135 in class file path/to/the/applet/class/file'. I am assuming this error due to the same login.jsp being returned when the java-plugin requests for the required applet class file.

When switched to the Basic Authentication configuration in tomcat, the application works fine. In this configuration, the browser pops up the 401 auth dialog on requesting index.jsp (the very first request to server). On successful authentication, contents of index.jsp is returned. After that, on clicking either jnlp/jsp(containing applet config in it), jws/java-plugin pops up another 401 authentication dialog requesting for correct username+password. On entering correct credentials here, the application launches without any issues.

Any suggestions on what can be done for the form based authentication scenario?

Please comment in case of confusion or more details are required.

Thanks in advance. :)

Edited by: MiKu on Dec 19, 2012 12:40 AM

Comments

877753
Hi,
I'm pasting few lines in which you can fetch the diagnosticManager and then do the appropriate Mbean calls for creating Diagnostic profiles via java code.

import com.bea.wlevs.management.diagnostic.DiagnosticProfileMBean;
import com.bea.wlevs.management.diagnostic.DiagnosticProfileManagerMBean;
import javax.management.MBeanServerConnection;
import javax.management.MBeanServerInvocationHandler;
import java.lang.management.ManagementFactory;
import javax.management.ObjectName;
import javax.management.ObjectInstance;
import org.w3c.dom.Node;


MBeanServerConnection conn=ManagementFactory.getPlatformMBeanServer();
private static DiagnosticProfileManagerMBean diagNosticManager=null;
private static Node updateprofileNode=null;
ObjectName diagProfileObjectName;
try {
diagProfileObjectName = ObjectName.getInstance("com.bea.wlevs:Name=ProfileManager,Type=ProfileManager,Application=diagnostic");
} catch (Exception e) {
throw new RuntimeException(e);
}
diagNosticManager=(DiagnosticProfileManagerMBean) MBeanServerInvocationHandler.newProxyInstance(conn, diagProfileObjectName, DiagnosticProfileManagerMBean.class, false);

Now we can use diagNosticManager.createDiagnosticProfile(String profileName, ObjectName[] probeNames) method to create the diagnostic profile.

Thanks
Patha
938644
Tnanks,
I tried this. now I'm getting :

javax.management.InstanceNotFoundException: com.bea.wlevs:Name=ProfileManager,Type=ProfileManager,Application=diagnostic
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1094)

What did I do wrong?
938644
Hi again ..

I think I know where is the problem but I don't know how to solve it:
i use these lines to make a connection :
..

env.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES, "com.bea.core.jmx.remote.provider");
System.setProperty("mx4j.remote.resolver.pkgs", "com.bea.core.jmx.remote.resolver");
connector = JMXConnectorFactory.newJMXConnector(serviceUrl, env);

connector.connect(env);
connection = connector.getMBeanServerConnection();
....
and you suggested to use this :

connection=ManagementFactory.getPlatformMBeanServer();


I think there is inconsistency in the typs of the connection mbean.
Neither of of them works fine:

The first one works fine for getting troughput , averageLatency and so on ,
BUT, when i try to terminate ( unregister from the mbean server ),
and than re-connect again, the numbers i'm getting are wrong.

In the second type (ManagementFactory.getPlatformMBeanServer() ) , when I want to use as a profile creator ( like in the 'Visualizer' tool - which works fine )
I don't know which of the types to use.

What is your recommendation to to use : for temintinag the probeRuntime, and for making a profile .

again, neither of them works all the way!
Plz help.
1 - 3
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jan 16 2013
Added on Dec 19 2012
0 comments
1,131 views