ClassCastException in JavaeeFacetUtil (JavaeeFacetUtilImpl)

Hi, I want to access web.xml file through this code:

WebFacet facet = WebUtil.getWebFacet(psiFile.getOriginalElement());
WebApp app = facet.getRoot();

but when I debug my plugin I always get ClassCastException:

java.lang.ClassCastException: com.intellij.javaee.facet.JavaeeFacetUtilImpl
at com.intellij.javaee.facet.JavaeeFacetUtil.getInstance(JavaeeFacetUtil.java:37)
at com.intellij.javaee.web.WebUtil.getWebFacet(WebUtil.java:64)

Strange is the fact it sometimes works when I run plugin in IDEA (and sometimes does not). Are there any special prerequisites to do before calling this code?

I am using IDEA 7.0M1b. Thanks for any advice.

pepcza

Message was edited by:
Josef Pavlas

3 comments
Avatar
Nikolay Chashnikov

Hello Josef,

Looks like IDEA SDK used in your plugin isn't properly upgraded. Please check
whether file com/intellij/javaee/facet/JavaeeFacetUtilImpl.class exists in
idea.jar of your IDEA SDK. If that's the case your idea.jar isn't upgraded
to 7.0M1b.

Hi, I want to access web.xml file through this code:

WebFacet facet = WebUtil.getWebFacet(psiFile.getOriginalElement());

but when I debug my plugin I always get ClassCastException:

java.lang.ClassCastException:
com.intellij.javaee.facet.JavaeeFacetUtilImpl
at
com.intellij.javaee.facet.JavaeeFacetUtil.getInstance(JavaeeFacetUtil.
java:37)
at com.intellij.javaee.web.WebUtil.getWebFacet(WebUtil.java:64)
Strange is the fact it sometimes works when I run plugin in IDEA (and
sometimes does not). Are there any special prerequisites to do before
calling this code?

I am using IDEA 7.0M1b. Thanks for any advice.

pepcza



0

Hi Nikolay,

whole package com.intellij.javaee.facet is not present in idea.jar, I get it from JavaEE plugin (javaee-impl.jar, javaee-openapi.jar).
Could this be "The problem"? I am using build 6833.

Thanks, Josef

Message was edited by:
Josef Pavlas

0

The problem was caused by copying JavaEE plugin JARs into sandbox. My mistake.

0

Please sign in to leave a comment.