Return-Path: X-Original-To: apmail-felix-dev-archive@www.apache.org Delivered-To: apmail-felix-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 45AF56439 for ; Tue, 7 Jun 2011 10:00:23 +0000 (UTC) Received: (qmail 30233 invoked by uid 500); 7 Jun 2011 10:00:22 -0000 Delivered-To: apmail-felix-dev-archive@felix.apache.org Received: (qmail 30180 invoked by uid 500); 7 Jun 2011 10:00:22 -0000 Mailing-List: contact dev-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list dev@felix.apache.org Received: (qmail 30136 invoked by uid 99); 7 Jun 2011 10:00:22 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Jun 2011 10:00:22 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Jun 2011 10:00:20 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 0AD8C1058C9 for ; Tue, 7 Jun 2011 09:59:59 +0000 (UTC) Date: Tue, 7 Jun 2011 09:59:59 +0000 (UTC) From: =?utf-8?Q?Michael_D=C3=BCrig_=28JIRA=29?= To: dev@felix.apache.org Message-ID: <865942427.3219.1307440799041.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (FELIX-2492) scr plugin: using src annotations causes NoClassDefFoundError and other errors MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/FELIX-2492?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1304= 5347#comment-13045347 ]=20 Michael D=C3=BCrig commented on FELIX-2492: -------------------------------------- Yes. > scr plugin: using src annotations causes NoClassDefFoundError and other e= rrors > -------------------------------------------------------------------------= ----- > > Key: FELIX-2492 > URL: https://issues.apache.org/jira/browse/FELIX-2492 > Project: Felix > Issue Type: Bug > Components: Maven SCR Plugin > Affects Versions: maven-scr-plugin-1.4.4 > Reporter: Michael D=C3=BCrig > > Using comment tags and having a dependency on slf4j-api causes the scr pl= ugin to throw a NoClassDefFoundError: > java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder > =09at org.slf4j.LoggerFactory.(LoggerFactory.java:60) > =09at com.day.crx.spi.sharepoint.resource.SharepointResourceProvider.(SharepointResourceProvider.java:60) > =09at sun.misc.Unsafe.ensureClassInitialized(Native Method) > =09at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeField= AccessorFactory.java:25) > =09at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.ja= va:122) > =09at java.lang.reflect.Field.acquireFieldAccessor(Field.java:918) > =09at java.lang.reflect.Field.getFieldAccessor(Field.java:899) > =09at java.lang.reflect.Field.get(Field.java:358) > =09at org.apache.felix.scrplugin.tags.ClassUtil.getInitializationExpressi= on(ClassUtil.java:41) > =09at org.apache.felix.scrplugin.tags.qdox.QDoxJavaField.getInitializatio= nExpression(QDoxJavaField.java:44) > =09at org.apache.felix.scrplugin.helper.PropertyHandler.getPropertyName(P= ropertyHandler.java:239) > A workaround is to add a 'dummy' dependency to i.e. slf4j-simple. But the= n > [WARNING] Unused declared dependencies found: > [WARNING] org.slf4j:slf4j-simple:jar:1.5.0:provided > Furthermore when the 'dummy' dependency has the wrong version, the scr pl= ugin might throw other errors: > java.lang.NoSuchFieldError: name > =09at org.slf4j.impl.Log4jLoggerAdapter.(Log4jLoggerAdapter.java:75= ) > =09at org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java= :75) > =09at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:103) > =09at com.day.crx.spi.sharepoint.resource.SharepointResourceProvider.(SharepointResourceProvider.java:60) > =09at sun.misc.Unsafe.ensureClassInitialized(Native Method) > =09at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeField= AccessorFactory.java:25) > =09at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.ja= va:122) > =09at java.lang.reflect.Field.acquireFieldAccessor(Field.java:918) > =09at java.lang.reflect.Field.getFieldAccessor(Field.java:899) > =09at java.lang.reflect.Field.get(Field.java:358) > =09at org.apache.felix.scrplugin.tags.ClassUtil.getInitializationExpressi= on(ClassUtil.java:41) > =09at org.apache.felix.scrplugin.tags.qdox.QDoxJavaField.getInitializatio= nExpression(QDoxJavaField.java:44) > =09at org.apache.felix.scrplugin.helper.PropertyHandler.getPropertyName(P= ropertyHandler.java:238) > I think such errors should be handled more gracefully indicating the sour= ce of the problem. Also it should not be necessary to have a 'dummy' depend= encies. This was not the case up to version 1.4.1.=20 > If it is absolutely necessary to include such dummy dependencies, the plu= gin should state so in its error message. Also the slf4j case is so common = that it might be worth to considering a specific solution/workaround for th= is in the plugin. This is still much better than forcing all clients to ana= lyze the problem from the stacktrace and then implement workarounds. =20 -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira