Grails 3 injecting service into interceptor

1,886 views
Skip to first unread message

Voffka

unread,
Apr 17, 2015, 10:20:44 PM4/17/15
to grails-de...@googlegroups.com
Hi,
Section 7.5 of Grails 3 documentation says that filters are replaced with interceptors because they are more superior. 

However when interceptor is created under /grails-app/controllers/com.a.b.c folder  Grails does not inject services into it.
Any ideas why it does not work? Is it intentional or I am missing something?

package a.b.c

class AuthInterceptor {

def authService

AuthInterceptor() {
matchAll()
}

boolean before() {
return authService.method1() // authService is always null here
}
}


Thank you,
Vlad

Jeff Scott Brown

unread,
Apr 18, 2015, 12:20:09 AM4/18/15
to grails-de...@googlegroups.com
I think either of these will work...

- Instead of dynamically typing the property with "def", use a static type and mark the property with the @org.springframework.beans.factory.annotation.Autowired annotation.

- Dynamically type the property with "def" and mark the property with the @javax.annotation.Resource annotation

Let me know if those work for you.

Thanks.



JSB

--
Jeff Scott Brown
je...@jeffandbetsy.net

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/

Jeff Scott Brown

unread,
Apr 18, 2015, 12:25:21 AM4/18/15
to grails-de...@googlegroups.com

> On Apr 17, 2015, at 11:20 PM, Jeff Scott Brown <je...@jeffandbetsy.net> wrote:
>
>>
>> On Apr 17, 2015, at 9:20 PM, Voffka <voff...@gmail.com> wrote:
>>
>> Hi,
>> Section 7.5 of Grails 3 documentation says that filters are replaced with interceptors because they are more superior.
>>
>> However when interceptor is created under /grails-app/controllers/com.a.b.c folder Grails does not inject services into it.
>> Any ideas why it does not work? Is it intentional or I am missing something?
>>
>> package a.b.c
>>
>> class AuthInterceptor {
>>
>> def authService
>>
>> AuthInterceptor() {
>> matchAll()
>> }
>>
>> boolean before() {
>> return authService.method1() // authService is always null here
>> }
>> }
>>
>>
>
> I think either of these will work...
>
> - Instead of dynamically typing the property with "def", use a static type and mark the property with the @org.springframework.beans.factory.annotation.Autowired annotation.
>
> - Dynamically type the property with "def" and mark the property with the @javax.annotation.Resource annotation
>
> Let me know if those work for you.
>
> Thanks.
>
>

btw… I think this is a shortcoming and one that is probably easy to address. It appears that we aren’t automatically auto wiring interceptors by name, but probably should. If you confirm that and want to file a request for enhancement at https://github.com/grails/grails-core/issues, we can take a look. Maybe there is something else going on that I am not thinking of right now, but this is probably just an oversight.

Jeff Scott Brown

unread,
Apr 18, 2015, 12:29:20 AM4/18/15
to grails-de...@googlegroups.com

Jeff Scott Brown

unread,
Apr 18, 2015, 2:20:38 AM4/18/15
to grails-de...@googlegroups.com

Voffka

unread,
Apr 18, 2015, 1:37:15 PM4/18/15
to grails-de...@googlegroups.com
Jeff,
Thank you so much for your effort!!!

-Vlad

Owen Rubel

unread,
Jun 11, 2015, 4:16:49 PM6/11/15
to grails-de...@googlegroups.com
How do we access grailsApplication in Interceptors? I keep 'null' object.

Owen Rubel

unread,
Jun 12, 2015, 9:24:00 AM6/12/15
to grails-de...@googlegroups.com
Ah nvm... think I got it. It's automatically wired and can be instantly access like an env variable. So Rather than calling:

def grailsApplication
grailsApplication.currentRequest

... we can now just instantly access grailsApplication like so...

grailsAplication.currentRequest

Owen Rubel

unread,
Jun 15, 2015, 11:19:59 AM6/15/15
to grails-de...@googlegroups.com
No I guess I was wrong. It seems like I still have an error getting 'grailsApplication' in the Interceptor in a plugin.

Does anyone know how to fix?

Owen Rubel

unread,
Jun 15, 2015, 11:37:14 AM6/15/15
to grails-de...@googlegroups.com
DOH! should have been doing it with a HOLDER...

grails.util.Holders.getGrailsApplication().config


etc

Jeff Scott Brown

unread,
Jun 15, 2015, 10:23:33 PM6/15/15
to grails-de...@googlegroups.com

> On Jun 15, 2015, at 10:37 AM, Owen Rubel <oru...@gmail.com> wrote:
>
> DOH! should have been doing it with a HOLDER...
>
> grails.util.Holders.getGrailsApplication().config
>
>

You should not have to do that. The compiler should be adding the grailsApplication property to your interceptor class. Is that not happening?



JSB


Jeff Scott Brown
Principal Software Engineer
Grails Development Team
Object Computing Inc.
http://www.ociweb.com/

Owen Rubel

unread,
Jun 28, 2015, 9:47:44 PM6/28/15
to grails-de...@googlegroups.com
Do I have to reference at top of class with 'def grailsApplication' still???

Owen Rubel

unread,
Jun 28, 2015, 10:06:05 PM6/28/15
to grails-de...@googlegroups.com
Right but I went through alot of variations on how to do this because I am going on Grails 2.x assumptions and there is little documentation on interceptors on how to implement this properly :)

So for the record you have to:

import grails.core.GrailsApplication


class ProjectInterceptor {


GrailsApplication grailsApplication


...


}


This would be good to update on the Interceptors documentation ;)

Jeff Scott Brown

unread,
Jun 28, 2015, 10:32:19 PM6/28/15
to grails-de...@googlegroups.com

> On Jun 28, 2015, at 8:47 PM, Owen Rubel <oru...@gmail.com> wrote:
>
> Do I have to reference at top of class with 'def grailsApplication' still???


No. Use the one that the compiler adds.

See https://github.com/jeffbrown/owensinterceptor/blob/74e20533fa782b48af7b7dc1dba5b79a1bb0aff4/grails-app/controllers/demo/OwenInterceptor.groovy.

Jeff Scott Brown

unread,
Jun 28, 2015, 10:33:28 PM6/28/15
to grails-de...@googlegroups.com

> On Jun 28, 2015, at 9:06 PM, Owen Rubel <oru...@gmail.com> wrote:
>
>
> So for the record you have to:
>
> import grails.core.GrailsApplication
>
>
>
> class ProjectInterceptor {
>
>
>
>
>
> GrailsApplication grailsApplication
>
>
>
> ...
>
>
>
> }
>

No, you should not have to do that. See https://github.com/jeffbrown/owensinterceptor/blob/74e20533fa782b48af7b7dc1dba5b79a1bb0aff4/grails-app/controllers/demo/OwenInterceptor.groovy.

Jeff Scott Brown

unread,
Jun 28, 2015, 10:36:51 PM6/28/15
to grails-de...@googlegroups.com

> On Jun 28, 2015, at 9:06 PM, Owen Rubel <oru...@gmail.com> wrote:
>
> Right but I went through alot of variations on how to do this because I am going on Grails 2.x assumptions and there is little documentation on interceptors on how to implement this properly :)

There are notes at http://grails.github.io/grails-doc/3.0.2/guide/traits.html which describes which traits are added to various artifacts. Interceptors get the grails.artefact.Interceptor trait and if you click on the corresponding link there you will see that the Interceptor trait inherits grails.web.api.WebAttributes, which defines the grailsApplication property.

I hope that helps.

Owen Rubel

unread,
Jun 28, 2015, 10:47:48 PM6/28/15
to grails-de...@googlegroups.com
Doesnt work. I need to detect traits prior so that I can match based on env variables... https://gist.github.com/orubel/778eff4ab55962379ad6

Jeff Scott Brown

unread,
Jun 28, 2015, 11:00:41 PM6/28/15
to grails-de...@googlegroups.com

> On Jun 28, 2015, at 9:47 PM, Owen Rubel <oru...@gmail.com> wrote:
>
> Doesnt work. I need to detect traits prior so that I can match based on env variables... https://gist.github.com/orubel/778eff4ab55962379ad6

The grailsApplicaiton property is injected from the spring application context. Dependency injection can’t happen until after your interceptor is instantiated so you can’t refer to injected beans inside of a property initializer like that. I am surprised that the technique you described in your earlier message works.

Jeff Scott Brown

unread,
Jun 28, 2015, 11:04:53 PM6/28/15
to grails-de...@googlegroups.com

> On Jun 28, 2015, at 10:00 PM, Jeff Scott Brown <bro...@ociweb.com> wrote:
>
>
>> On Jun 28, 2015, at 9:47 PM, Owen Rubel <oru...@gmail.com> wrote:
>>
>> Doesnt work. I need to detect traits prior so that I can match based on env variables... https://gist.github.com/orubel/778eff4ab55962379ad6
>
> The grailsApplicaiton property is injected from the spring application context. Dependency injection can’t happen until after your interceptor is instantiated so you can’t refer to injected beans inside of a property initializer like that. I am surprised that the technique you described in your earlier message works.
>
>

Can you clarify what you meant earlier when you said “So for the record you have to…” and then you show declaring a property of type GrailsApplication. Under what circumstances are you doing that and how does that behave that is different than if you don’t declare the property? I would expect them to behave exactly the same but apparently they are not.

Thanks for any clarification.

Owen Rubel

unread,
Jun 28, 2015, 11:10:36 PM6/28/15
to grails-de...@googlegroups.com
I was wrong. I thought it worked but I had to revert back to Holders to do it.

I'm doing the same thing in UrlMapping as well to set the variables. I think there I could use 'grailsApplication' but here I can't because the variables are reused and should be set outside the methods for KISS and DRY principles.

Owen Rubel

unread,
Jun 28, 2015, 11:17:42 PM6/28/15
to grails-de...@googlegroups.com
The only difference (as you can see) is that I am declaring the properties outside a method. This seems to throw massive errors. 

I've tried over and over and can't get it to work; inside the method... yes, outside... no. 

And thats where I need to set the properties first so I can use them for 'match'(in the constructor),'before' and 'after'.

Only with a holder can I set the properties.

Jeff Scott Brown

unread,
Jun 28, 2015, 11:21:27 PM6/28/15
to grails-de...@googlegroups.com

> On Jun 28, 2015, at 10:10 PM, Owen Rubel <oru...@gmail.com> wrote:
>
> I was wrong. I thought it worked but I had to revert back to Holders to do it.

There are a number of ways you could orchestrate this. You could use a bean post processor that manipulates your interceptors. You could also do something like https://github.com/jeffbrown/owensinterceptor/commit/5411c205b8e56e3de21235f40ccb44c2dafca390.

I don’t think there is going to be a good way to access config variables from inside of your interceptor before your interceptor has completed constructing though, which is what the gist you showed was attempting to do.

Owen Rubel

unread,
Jun 28, 2015, 11:50:29 PM6/28/15
to grails-de...@googlegroups.com
Ah! Ok never considered doing it there. Thanks. That solves alot if that works; need to parse by URI. I'll give that a shot. Thanks. :)

Owen Rubel

unread,
Jun 29, 2015, 12:08:15 AM6/29/15
to grails-de...@googlegroups.com
Nope sorry. I still need to pass the variables to 'before' and 'after' and if I start trying to code this all in application, I'm beginning to start recreating the handlerinterceptor :)

Great solution but the Grails 2.0 created a 'wrapper' with 'filters' which allowed me to use grailsApplication for setting the variables which the beforeHandler and afterHandler could use.

Jeff Scott Brown

unread,
Jun 29, 2015, 12:13:04 AM6/29/15
to grails-de...@googlegroups.com

> On Jun 28, 2015, at 11:08 PM, Owen Rubel <oru...@gmail.com> wrote:
>
> Nope sorry. I still need to pass the variables to 'before' and 'after' and if I start trying to code this all in application, I'm beginning to start recreating the handlerinterceptor :)

It isn’t clear why you really need to do that but assuming that you do, why can’t you initialize those properties from doWithApplicationContext along with invoking the match method? You don’t have to do it in application. You could do it from a number of places, including a bean post processor. I don’t know why you would be beginning to start recreating handlerinterceptor.

Jeff Scott Brown

unread,
Jun 29, 2015, 12:29:55 AM6/29/15
to grails-de...@googlegroups.com

> On Jun 28, 2015, at 11:13 PM, Jeff Scott Brown <bro...@ociweb.com> wrote:
>
>
>> On Jun 28, 2015, at 11:08 PM, Owen Rubel <oru...@gmail.com> wrote:
>>
>> Nope sorry. I still need to pass the variables to 'before' and 'after' and if I start trying to code this all in application, I'm beginning to start recreating the handlerinterceptor :)
>
> It isn’t clear why you really need to do that but assuming that you do, why can’t you initialize those properties from doWithApplicationContext along with invoking the match method? You don’t have to do it in application. You could do it from a number of places, including a bean post processor. I don’t know why you would be beginning to start recreating handlerinterceptor.
>


You could also use GrailsConfigurationAware to get the config into your interceptor. With that do whatever you wanted to do in your constructor in the setConfiguration method. See https://github.com/jeffbrown/owensinterceptor/commit/9a2a2d1307d0d1c0ceda969a233fbbe1de080da2.

What you are trying to do is so vague that it is hard to know what you are looking for. This thread started with a scenario that had nothing at all to do with accessing config. I want to help you, but the conversation is continually bouncing around with different concerns.

I hope this helps.

Owen Rubel

unread,
Jun 29, 2015, 12:54:19 AM6/29/15
to grails-de...@googlegroups.com
I understand you don't know WHY I am trying to do this. You are making this VERY clear, ok? :)

I'm just explaining because you just stated that I should use grailsApplication and I showed that I couldn't because you can only access it within the context of a method and while I could do that, I would have to.

I'll give GrailsApplicationAware a shot.

Jeff Scott Brown

unread,
Jun 29, 2015, 12:55:52 AM6/29/15
to grails-de...@googlegroups.com

> On Jun 28, 2015, at 11:54 PM, Owen Rubel <oru...@gmail.com> wrote:
>
>
>
> I'll give GrailsApplicationAware a shot.

Note that I was suggesting GrailsConfigurationAware, not GrailsApplicationAware. I don’t think GrailsApplicationAware is going to help you.

Baskaran Veerapathiran

unread,
Dec 10, 2015, 12:24:21 PM12/10/15
to Grails Dev Discuss
Jeff,

I tried your suggestion to get the handle of redisService in Channel Interceptor adapter. The redisService object (grails plugin) comes as not null but when i tried to use that to store a value in Redis, I am getting below error.

@Autowired
RedisService redisService=new RedisService()


---- 

redisService.foo = "bar"

 

Caused by: java.lang.NullPointerException: Cannot get property 'resource' on null object

                at org.codehaus.groovy.runtime.NullObject.getProperty(NullObject.java:57) ~[groovy-2.4.3.jar:2.4.3]

                at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:169) ~[groovy-2.4.3.jar:2.4.3]

                at org.codehaus.groovy.runtime.callsite.NullCallSite.getProperty(NullCallSite.java:44) ~[groovy-2.4.3.jar:2.4.3]

                at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:293) ~[groovy-2.4.3.jar:2.4.3]



Any suggestion ?



On Saturday, April 18, 2015 at 12:20:09 AM UTC-4, Jeff Scott Brown wrote:

> On Apr 17, 2015, at 9:20 PM, Voffka <voff...@gmail.com> wrote:
>
> Hi,
> Section 7.5 of Grails 3 documentation says that filters are replaced with interceptors because they are more superior.  
>
> However when interceptor is created under /grails-app/controllers/com.a.b.c folder  Grails does not inject services into it.
> Any ideas why it does not work? Is it intentional or I am missing something?
>
> package a.b.c
>
> class AuthInterceptor {
>
>     def authService
>
>     AuthInterceptor() {
>         matchAll()
>     }
>
>     boolean before() {
>         return authService.method1() // authService is always null here
>     }
> }
>
>

I think either of these will work...

- Instead of dynamically typing the property with "def", use a static type and mark the property with the @org.springframework.beans.factory.annotation.Autowired annotation.

- Dynamically type the property with "def" and mark the property with the @javax.annotation.Resource annotation

Let me know if those work for you.

Thanks.



JSB

--
Jeff Scott Brown
je...@jeffandbetsy.net

Jeff Scott Brown

unread,
Dec 11, 2015, 1:32:33 PM12/11/15
to grails-de...@googlegroups.com

> On Dec 10, 2015, at 11:24 AM, Baskaran Veerapathiran <bask...@gmail.com> wrote:
>
> Jeff,
>
> I tried your suggestion to get the handle of redisService in Channel Interceptor adapter. The redisService object (grails plugin) comes as not null but when i tried to use that to store a value in Redis, I am getting below error.
>
> @Autowired
> RedisService redisService=new RedisService()
>
>
>
> ----
>
> redisService.foo = "bar"
>
>
>
> Caused by: java.lang.NullPointerException: Cannot get property 'resource' on null object
>
> at org.codehaus.groovy.runtime.NullObject.getProperty(NullObject.java:57) ~[groovy-2.4.3.jar:2.4.3]
>
> at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:169) ~[groovy-2.4.3.jar:2.4.3]
>
> at org.codehaus.groovy.runtime.callsite.NullCallSite.getProperty(NullCallSite.java:44) ~[groovy-2.4.3.jar:2.4.3]
>
> at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:293) ~[groovy-2.4.3.jar:2.4.3]
>
>
>
> Any suggestion ?
>

You have not shown enough of the stack to indicate what is trying to access the null “resource” property and where that property is defined.



JSB


Jeff Scott Brown
Principal Software Engineer
Grails Development Team
Object Computing Inc.
http://www.ociweb.com/

Baskaran Veerapathiran

unread,
Dec 11, 2015, 1:46:45 PM12/11/15
to grails-de...@googlegroups.com
Please find the details below.. 


@Configuration
@EnableScheduling
@
EnableWebSocketMessageBroker
class GConfig extends AbstractSessionWebSocketMessageBrokerConfigurer<ExpiringSession> {

  
protected void configureStompEndpoints(StompEndpointRegistry registry) {
      registry.addEndpoint(
"/stomp").withSockJS().setInterceptors(new HttpSessionIdHandshakeInterceptor());
     
//registry.addEndpoint("/stomp").withSockJS()
  
}

  
@Override
  
public void configureMessageBroker(MessageBrokerRegistry registry) {

      registry.enableSimpleBroker(
"/queue/", "/topic/");
      registry.setApplicationDestinationPrefixes(
"/app");
   }


  
@Bean
  
GrailsSimpAnnotationMethodMessageHandler grailsSimpAnnotationMethodMessageHandler(
         MessageChannel clientInboundChannel,
         MessageChannel clientOutboundChannel,
         SimpMessagingTemplate brokerMessagingTemplate
   ) {
     
def handler = new GrailsSimpAnnotationMethodMessageHandler(clientInboundChannel, clientOutboundChannel, brokerMessagingTemplate)
      clientInboundChannel.addInterceptor(
new PresenceChannelInterceptor());
      handler.destinationPrefixes = [
"/app"]
      return handler
   }

}

 

------------------------------------------------------------------------------------------------ 


@Resource
RedisService redisService=new RedisService()

@Override
public Message<?> preSend(Message<?> message, MessageChannel channel) {

    println
" PresenceChannelInterceptor "

   
redisService.fooKey = " barVal"

   
MessageHeaders headers = message.getHeaders();
    SimpMessageType type = (SimpMessageType) headers.get(
"simpMessageType");
    String simpSessionId = (String) headers.get(
"simpSessionId");

   
if (type == SimpMessageType.CONNECT) {
        Principal principal = (Principal) headers.get(
"simpUser");
        println
"tes CONNECT"
   
} else if (type == SimpMessageType.DISCONNECT) {
        println
"tes DISCONNECT"
   
}

   
return message;

}
 
 
 ------------------------------------------------------------------------------------------------
compile "org.grails.plugins:grails-redis:2.0.2" [ This is the plugin I am using for redis ]

------------------------------------------------------------------------------------------------

PresenceChannelInterceptor

ERROR org.springframework.web.socket.messaging.StompSubProtocolHandler - Failed to send client message to application via MessageChannel in session e7spulgf. Sending STOMP ERROR to client.

org.springframework.messaging.MessageDeliveryException: Failed to send message to ExecutorSubscribableChannel[clientInboundChannel]; nested exception is java.lang.NullPointerException: Cannot get property 'resource' on null object

                at org.springframework.messaging.support.AbstractMessageChannel.send(AbstractMessageChannel.java:127) ~[spring-messaging-4.1.7.RELEASE.jar:4.1.7.RELEASE]

                at org.springframework.messaging.support.AbstractMessageChannel.send(AbstractMessageChannel.java:104) ~[spring-messaging-4.1.7.RELEASE.jar:4.1.7.RELEASE]

                at org.springframework.web.socket.messaging.StompSubProtocolHandler.handleMessageFromClient(StompSubProtocolHandler.java:263) ~[spring-websocket-4.1.7.RELEASE.jar:4.1.7.RELEASE]

                at org.springframework.web.socket.messaging.SubProtocolWebSocketHandler.handleMessage(SubProtocolWebSocketHandler.java:309) [spring-websocket-4.1.7.RELEASE.jar:4.1.7.RELEASE]

                at org.springframework.web.socket.handler.WebSocketHandlerDecorator.handleMessage(WebSocketHandlerDecorator.java:75) [spring-websocket-4.1.7.RELEASE.jar:4.1.7.RELEASE]

                at org.springframework.web.socket.handler.WebSocketHandlerDecorator.handleMessage(WebSocketHandlerDecorator.java:75) [spring-websocket-4.1.7.RELEASE.jar:4.1.7.RELEASE]

                at org.springframework.web.socket.handler.LoggingWebSocketHandlerDecorator.handleMessage(LoggingWebSocketHandlerDecorator.java:56) [spring-websocket-4.1.7.RELEASE.jar:4.1.7.RELEASE]

                at org.springframework.web.socket.handler.ExceptionWebSocketHandlerDecorator.handleMessage(ExceptionWebSocketHandlerDecorator.java:72) [spring-websocket-4.1.7.RELEASE.jar:4.1.7.RELEASE]

                at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession.delegateMessages(AbstractSockJsSession.java:385) [spring-websocket-4.1.7.RELEASE.jar:4.1.7.RELEASE]

                at org.springframework.web.socket.sockjs.transport.session.WebSocketServerSockJsSession.handleMessage(WebSocketServerSockJsSession.java:194) [spring-websocket-4.1.7.RELEASE.jar:4.1.7.RELEASE]

                at org.springframework.web.socket.sockjs.transport.handler.SockJsWebSocketHandler.handleTextMessage(SockJsWebSocketHandler.java:92) [spring-websocket-4.1.7.RELEASE.jar:4.1.7.RELEASE]

                at org.springframework.web.socket.handler.AbstractWebSocketHandler.handleMessage(AbstractWebSocketHandler.java:43) [spring-websocket-4.1.7.RELEASE.jar:4.1.7.RELEASE]

                at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.handleTextMessage(StandardWebSocketHandlerAdapter.java:112) [spring-websocket-4.1.7.RELEASE.jar:4.1.7.RELEASE]

                at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.access$000(StandardWebSocketHandlerAdapter.java:42) [spring-websocket-4.1.7.RELEASE.jar:4.1.7.RELEASE]

                at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter$3.onMessage(StandardWebSocketHandlerAdapter.java:82) [spring-websocket-4.1.7.RELEASE.jar:4.1.7.RELEASE]

                at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter$3.onMessage(StandardWebSocketHandlerAdapter.java:79) [spring-websocket-4.1.7.RELEASE.jar:4.1.7.RELEASE]

                at org.apache.tomcat.websocket.WsFrameBase.sendMessageText(WsFrameBase.java:393) [tomcat-embed-websocket-8.0.23.jar:8.0.23]

                at org.apache.tomcat.websocket.WsFrameBase.processDataText(WsFrameBase.java:494) [tomcat-embed-websocket-8.0.23.jar:8.0.23]

                at org.apache.tomcat.websocket.WsFrameBase.processData(WsFrameBase.java:289) [tomcat-embed-websocket-8.0.23.jar:8.0.23]

                at org.apache.tomcat.websocket.WsFrameBase.processInputBuffer(WsFrameBase.java:130) [tomcat-embed-websocket-8.0.23.jar:8.0.23]

                at org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:60) [tomcat-embed-websocket-8.0.23.jar:8.0.23]

                at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler$WsReadListener.onDataAvailable(WsHttpUpgradeHandler.java:203) [tomcat-embed-websocket-8.0.23.jar:8.0.23]

                at org.apache.coyote.http11.upgrade.AbstractServletInputStream.onDataAvailable(AbstractServletInputStream.java:198) [tomcat-embed-core-8.0.23.jar:8.0.23]

                at org.apache.coyote.http11.upgrade.AbstractProcessor.upgradeDispatch(AbstractProcessor.java:96) [tomcat-embed-core-8.0.23.jar:8.0.23]

                at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:663) [tomcat-embed-core-8.0.23.jar:8.0.23]

                at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1521) [tomcat-embed-core-8.0.23.jar:8.0.23]

                at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1478) [tomcat-embed-core-8.0.23.jar:8.0.23]

                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_40]

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_40]

                at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.0.23.jar:8.0.23]

                at java.lang.Thread.run(Thread.java:745) [na:1.8.0_40]

Caused by: java.lang.NullPointerException: Cannot get property 'resource' on null object

                at org.codehaus.groovy.runtime.NullObject.getProperty(NullObject.java:57) ~[groovy-2.4.3.jar:2.4.3]

                at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:169) ~[groovy-2.4.3.jar:2.4.3]

                at org.codehaus.groovy.runtime.callsite.NullCallSite.getProperty(NullCallSite.java:44) ~[groovy-2.4.3.jar:2.4.3]

                at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:293) ~[groovy-2.4.3.jar:2.4.3]

                at grails.plugins.redis.RedisService.withRedis(RedisService.groovy:100) ~[grails-redis-2.0.2.jar:na]

                at grails.plugins.redis.RedisService$withRedis.callCurrent(Unknown Source) ~[na:na]

                at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49) ~[groovy-2.4.3.jar:2.4.3]

                at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:151) ~[groovy-2.4.3.jar:2.4.3]

                at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:163) ~[groovy-2.4.3.jar:2.4.3]

                at grails.plugins.redis.RedisService.propertyMissing(RedisService.groovy:88) ~[grails-redis-2.0.2.jar:na]

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_40]

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_40]

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_40]

                at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_40]

                at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1270) ~[springloaded-1.2.3.RELEASE.jar:1.2.3.RELEASE]

                at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) ~[groovy-2.4.3.jar:2.4.3]

                at groovy.lang.MetaClassImpl.invokeMissingProperty(MetaClassImpl.java:877) ~[groovy-2.4.3.jar:2.4.3]

                at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:2721) ~[groovy-2.4.3.jar:2.4.3]

                at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:3746) ~[groovy-2.4.3.jar:2.4.3]

                at grails.plugins.redis.RedisService.setProperty(RedisService.groovy) ~[grails-redis-2.0.2.jar:na]

                at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.setGroovyObjectProperty(ScriptBytecodeAdapter.java:530) ~[groovy-2.4.3.jar:2.4.3]

                at com.ofi.config.PresenceChannelInterceptor.preSend(PresenceChannelInterceptor.groovy:27) ~[main/:na]

                at org.springframework.messaging.support.AbstractMessageChannel$ChannelInterceptorChain.applyPreSend(AbstractMessageChannel.java:158) ~[spring-messaging-4.1.7.RELEASE.jar:4.1.7.RELEASE]

                at org.springframework.messaging.support.AbstractMessageChannel.send(AbstractMessageChannel.java:113) ~[spring-messaging-4.1.7.RELEASE.jar:4.1.7.RELEASE]

                ... 30 common frames omitted

 

Thanks,
Baskaran.V



--
You received this message because you are subscribed to a topic in the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/grails-dev-discuss/eGJctiOThFc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to grails-dev-disc...@googlegroups.com.
To post to this group, send email to grails-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/3680DC18-0232-44C5-9D33-A269F46C5189%40ociweb.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages