I am studying the tutorial javarevoltions JSF 2 + PrimeFaces 5 + 4 + Spring Hibernate 4.
Essse tutorial is based on weblogic server and Oracle database.
My problem is I want to use glassfish with MySQL instead.
There is a file called utilidades.java containing webologic properties.
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
public class Utilities {
public static Object getEJBRemote (nameEJB String, String iface) throws Exception {
Context context;
Properties props = new Properties ();
props.put (Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
props.put (Context.PROVIDER_URL, "http: // localhost: 7001");
try {
context = new InitialContext (props);
String lookup nameEJB + = "#" + iface;
System.out.println ("Lookup" + lookup);
return context.lookup (lookup);
} Catch (Exception ex) {
throw new Exception ("There is EJB: '" + nameEJB + "'.");
}
}
}
I've changed to:
props.put (Context.INITIAL_CONTEXT_FACTORY, "org.springframework.jndi.JndiObjectFactoryBean");
props.put (Context.PROVIDER_URL, "http: // localhost: 4848");
This I saw a tutorial on the Internet, using glassfish and mysql. I created the ping successfully datasource in glassfish.
When I do a debbug it appears:
ex = (javax.naming.NoInitialContextException) javax.naming.NoInitialContextException: Can not instantiate class: org.springframework.jndi.JndiObjectFactoryBean [Root exception is java.lang.ClassCastException: org.springframework.jndi.JndiObjectFactoryBean can not be cast to javax.naming .spi.InitialContextFactory]
What am I doing wrong?