0

I setup graniteds and gravity servlet in java spring application that runs in tomcat 7. in web xml :

<servlet-class>org.granite.gravity.servlet3.GravityAsyncServlet</servlet-class>

and an AMF meswage servlet class :

<servlet-class>org.granite.messaging.webapp.AMFMessageServlet</servlet-class>

and a graniteConfig classe that is read by tomcat servlet :

@ServerFilter
public class GraniteConfig

the amf messaging works well . but the gravity servlet could not start correctly . i debugged graniteds libraries . this line of code won't pass

ServletGraniteConfig servletGraniteConfig = (ServletGraniteConfig)context.getAttribute(GRANITE_CONFIG_KEY);

(this code is from graniteDs Core librairies) and the error was :

java.lang.ClassCastException: org.granite.config.GraniteConfig cannot be cast to org.granite.config.ServletGraniteConfig

i don't get how the graniteConfig object is set in servletContext attributes instead of ServletGraniteConfig . and what part of graniteds configuration i'm missing .

ketan
  • 19,129
  • 42
  • 60
  • 98
Sami Jmii
  • 460
  • 7
  • 17
  • This smells like a classloader problem, as in one class is loaded in classloader A and the other class is loaded in classloader B. That tends to be caused by duplicate jars, such as there being jars in tomcat/lib and in the web application's lib folder. The code regarding this does not provide any hint as to how it could otherwise be a problem: http://www.granitedataservices.com/public/doc/2.1.0/doc/java/api/src-html/org/granite/config/ServletGraniteConfig.html – Gimby Aug 29 '14 at 09:26
  • Yup , i think that this is the broblem . i didn't 100% debugged but this solved the problem : in pom.xml i updated the version of graniteds from 3.1.0.GA to 3.1.0.RC1(the latest) and i deleted a maven dependencie (granite-gravity) . I guess this dependecies contains duplicate classes in other ortifacts as you said . – Sami Jmii Aug 29 '14 at 10:08
  • That's a downgrade. GA = general availability (AKA: final), RC1 = Release Candidate 1 (AKA: beta). You did not at all understood what I was saying and have nto solved your problem, you merely made it go away by just trying some stuff. That's fine, but I expect you and your problem to return at one point in time. – Gimby Aug 29 '14 at 10:46
  • ok @Gimby . In my defense that's how coder behave under pressure deadline . I will try to have accurate anwers when i have time . thanks :) – Sami Jmii Aug 29 '14 at 12:21

0 Answers0