Index: src/org/jboss/tools/ws/jaxrs/core/jdt/JdtUtils.java =================================================================== --- src/org/jboss/tools/ws/jaxrs/core/jdt/JdtUtils.java (revision 38910) +++ src/org/jboss/tools/ws/jaxrs/core/jdt/JdtUtils.java (working copy) @@ -89,8 +89,10 @@ public static ICompilationUnit getCompilationUnit(final IJavaElement element) { if (element instanceof IMember) { return ((IMember) element).getCompilationUnit(); - } else if (element instanceof IAnnotation) { - return ((IMember) ((IAnnotation) element).getParent()).getCompilationUnit(); + } else if (element instanceof IAnnotation + // ignore annotations on PackageDeclaration, such as in package-info.java + && element.getParent() instanceof IMember) { + return ((IMember) (element.getParent())).getCompilationUnit(); } else if (element instanceof ICompilationUnit) { return (ICompilationUnit) element; } @@ -380,7 +382,11 @@ */ public static Annotation resolveAnnotation(IAnnotation javaAnnotation, CompilationUnit ast) throws JavaModelException { - return resolveAnnotation((IMember) javaAnnotation.getParent(), ast, javaAnnotation.getElementName()); + if (javaAnnotation.getParent() instanceof IMember) { + return resolveAnnotation((IMember) javaAnnotation.getParent(), ast, + javaAnnotation.getElementName()); + } + return null; } private static Map> resolveAnnotationElements(IAnnotation annotation) Index: src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsElementFactory.java =================================================================== --- src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsElementFactory.java (revision 38910) +++ src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsElementFactory.java (working copy) @@ -67,6 +67,9 @@ public JaxrsJavaElement createElement(IAnnotation javaAnnotation, CompilationUnit ast, JaxrsMetamodel metamodel) throws CoreException { Annotation annotation = JdtUtils.resolveAnnotation(javaAnnotation, ast); + if(annotation == null) { // annotation on package declaration are ignored + return null; + } final String annotationName = annotation.getName(); if (annotationName.equals(HttpMethod.class.getName())) { final JaxrsHttpMethod httpMethod = createHttpMethod(annotation, ast, metamodel);