java-apns 0.2.0 version

663 views
Skip to first unread message

amitfrid

unread,
Jul 20, 2011, 4:29:42 AM7/20/11
to Java client for Apple Push Notification service (APNs)
Hi,
I am using apns-0.1.5-jar-with-dependencies.jar and I saw relevant
changes that I need.
Do you plan to add to GitHub the apns-0.2.0-jar-with-
dependencies.jar?

Thanks,
Amit

Mahmood Ali

unread,
Jul 20, 2011, 11:11:41 AM7/20/11
to java-apn...@googlegroups.com
Greetings,

When 0.2.0 is released! You can grab snapshots of it from maven repository though: https://oss.sonatype.org/content/repositories/snapshots/com/notnoop/apns/apns/0.2.0-SNAPSHOT/ (pick the latest version at any time).

Also, please note that I would advise against using apns-x.x.x-jar-with-dependencies.jar. It is meant to ease initial development, but in production it may cause ClassLoader issues if you happen to use the jackson or slf4j libraries as well, as there will be two copies of the library present in the classpath to confuse the JVM. It will be even worst if you happen to use different versions.

Regards,- Mahmood

Arthur Neves

unread,
Jul 20, 2011, 11:19:33 AM7/20/11
to java-apn...@googlegroups.com
Hey,


I just released a new version for the grails apns plugin.(version0.5)
Which uses your lovely api in the backend!

Today I am using the 0.1.5-with-dependencies in that plugin! so would you say that is better I switch to start using your maven repo instead?!

Lemme know what is the best approach here, then I will release a new version of the plugin!


cheers

Arthur Neves
arth...@gmail.com
www.arthurnn.com
@arthurnn89

Mahmood Ali

unread,
Jul 20, 2011, 11:40:26 AM7/20/11
to java-apn...@googlegroups.com
The general rule of bundling Java libraries apply here: the responsibility of handling dependencies is the library client's responsibility in a production use-case. Any other way, will cause just so much trouble (and I learnt it the hard way).

> Today I am using the 0.1.5-with-dependencies in that plugin! so would you say that is better I switch to start using your maven repo instead?!
> Lemme know what is the best approach here, then I will release a new version of the plugin!

I recommend hosting your plugin as maven/Ivy repo with declaring your transitive dependencies (e.g. java-apns in this case). Your clients then can very easily pull in your plugin and the rest of dependencies easily. However, I don't know Groovy/Grails to know the ecosystem of tools well, but gradle handles dependencies from Maven/Ivy well.

- Mahmood

Arthur Neves

unread,
Jul 20, 2011, 11:52:10 AM7/20/11
to java-apn...@googlegroups.com
Grails handle maven repo really smoothly .

So in my plugin, I will start using this config:

   <dependencies>
        <dependency>
            <groupId>com.notnoop.apns</groupId>
            <artifactId>apns</artifactId>
            <version>0.2.0</version>
        </dependency>
        ...
    </dependencies>



right!?

Mahmood Ali

unread,
Jul 20, 2011, 12:01:46 PM7/20/11
to java-apn...@googlegroups.com
For now, I would recommend 0.1.6, till 0.2.0 is released, and 0.1.6 is available in the central Maven repository. If you want to use 0.2.0, it should be 0.2.0-SNAPSHOT I think.

Regards,- Mahmood

> arth...@gmail.com (mailto:arth...@gmail.com)
> www.arthurnn.com (http://www.arthurnn.com)
> @arthurnn89


Arthur Neves

unread,
Jul 20, 2011, 1:36:38 PM7/20/11
to java-apn...@googlegroups.com
Ok,

I set to use 0.1.6 from mavenCentral.

in my local machine, everything runs ok! but in my QA env I am getting this error:


java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V
at org.apache.commons.logging.impl.SLF4JLocationAwareLog.trace(SLF4JLocationAwareLog.java:107)
at org.apache.commons.beanutils.BeanUtilsBean.convert(BeanUtilsBean.java:1073)
at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1009)
at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:830)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:433)
at org.apache.commons.beanutils.BeanUtils$populate.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
at org.apache.commons.beanutils.BeanUtils$populate.call(Unknown Source)
at org.codehaus.groovy.grails.plugins.logging.Log4jConfig.methodMissing(Log4jConfig.groovy:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:813)
at groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:1107)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1060)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:706)
at org.codehaus.groovy.grails.plugins.logging.Log4jConfig.invokeMethod(Log4jConfig.groovy)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeOnDelegationObjects(ClosureMetaClass.java:403)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:349)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:44)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:149)
at Config$_run_closure2_closure13.doCall(Config.groovy:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:273)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:44)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:149)
at Config$_run_closure2_closure13.doCall(Config.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:273)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:39)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
at org.codehaus.groovy.grails.plugins.logging.Log4jConfig.appenders(Log4jConfig.groovy:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:362)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:44)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:149)
at Config$_run_closure2.doCall(Config.groovy:127)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:273)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:39)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124)
at org.codehaus.groovy.grails.plugins.logging.Log4jConfig.configure(Log4jConfig.groovy:138)
at org.codehaus.groovy.grails.web.util.Log4jConfigListener.contextInitialized(Log4jConfigListener.java:62)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

Arthur Neves
arth...@gmail.com
www.arthurnn.com
@arthurnn89

Mahmood Ali

unread,
Jul 20, 2011, 1:43:18 PM7/20/11
to java-apn...@googlegroups.com
Greetings,

> I set to use 0.1.6 from mavenCentral.
>
> in my local machine, everything runs ok! but in my QA env I am getting this error:
> java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V
>        at org.apache.commons.logging.impl.SLF4JLocationAwareLog.trace(SLF4JLocationAwareLog.java:107)
>        at org.apache.commons.beanutils.BeanUtilsBean.convert(BeanUtilsBean.java:1073)

This should be documented better: The library user should declare the
logging framework dependency. The library uses slf4j, so you can use
any logging framework that either supports it natively (e.g. logback)
or via a bridge (e.g. commons, jul, log4j). Check www.slf4j.org for
more documentation.

- Mahmood

Arthur Neves

unread,
Jul 20, 2011, 2:22:16 PM7/20/11
to java-apn...@googlegroups.com
Hey,,


This is a problem btw grails and slf4j 1.6!

my question is!! is it version 0.1.5 still using the slf4j 1.5.8 ??

if it is, where can a grab it from, using maven?!

Arthur Neves
arth...@gmail.com
www.arthurnn.com
@arthurnn89

Mahmood Ali

unread,
Jul 20, 2011, 3:06:10 PM7/20/11
to java-apn...@googlegroups.com
> This is a problem btw grails and slf4j 1.6!
>
> my question is!! is it version 0.1.5 still using the slf4j 1.5.8 ??
>
> if it is, where can a grab it from, using maven?!
Java APNS 0.1.5 still declares slf4j 1.6.1. I don't know Grails or your development environment to make intelligent comments. Slf4j though claims that slf4j binaries are backward compatible: http://www.slf4j.org/faq.html#compatibility, so you should be able to fix it within your build systems (gradle?). You might need to figure out the right bridge-api version for the concrete logger.

Please investigate the problem and report how we can fix it in the library.

Regards,
Mahmood


Arthur Neves

unread,
Jul 20, 2011, 3:43:29 PM7/20/11
to java-apn...@googlegroups.com
The thing is, grails has slf4j 1.5.8 .jar and also all bridges for 1.5.8 !! but your maven repo has the dependency for slf4j 1.6! this is causing me a jar conflict!


so what I want to ask to you is, how about if instead of using maven repo to get apns0.1.5, I use the jar! with all dependencies unless the slf4j 1.6 .. is that going to work?!


cheers

Arthur Neves
arth...@gmail.com
www.arthurnn.com
@arthurnn89

Reply all
Reply to author
Forward
0 new messages