How to use MQTT with Tomcat - mqtt

I'd like to use MQTT in tomcat8 in order to publish messages via MQTT. I use the Paho library version 3.1.1. When I try to instantiate the client using
String clientId = Mqtt.generateClientId();
MqttClient client = new MqttClient("tcp://localhost:1883", clientId);
I get an MqttException(0).
Below you'll find the details of the error message and the stacktrace:
reason 0
msg MqttException
loc MqttException
cause null
excep MqttException (0)
MqttException (0)
at org.eclipse.paho.client.mqttv3.persist.MqttDefaultFilePersistence.open(MqttDefaultFilePersistence.java:80)
at org.eclipse.paho.client.mqttv3.MqttAsyncClient.<init>(MqttAsyncClient.java:304)
at org.eclipse.paho.client.mqttv3.MqttAsyncClient.<init>(MqttAsyncClient.java:185)
at org.eclipse.paho.client.mqttv3.MqttClient.<init>(MqttClient.java:226)
at org.eclipse.paho.client.mqttv3.MqttClient.<init>(MqttClient.java:138)
at de.rz.homeautomation.service.HomeAutomationService.publishSensorData(HomeAutomationService.java:807)
at de.rz.homeautomation.service.HomeAutomationService.postSensorData(HomeAutomationService.java:857)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:151)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:171)
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:152)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:104)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:387)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:331)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:103)
at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:297)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:254)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1030)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:373)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:381)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:344)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:221)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1580)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1537)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
The same code works fine in a command line program, so I guess I have to do some kind of configuration of MQTT and/or tomcat. I also don't know if I need additional libraries. I just copied the paho library in the lib-folder of WEB-INF.
Just right now I am only guessing what could be the problem.
Can somebody explain me how I have to configure tomcat or where I have to move the library?
Thanks a lot,
Rudi

The exception is being thrown when the MQTT Client tries to open the persistence file, I will assume it is probably a permisions error for the default location and the user running Tomcat.
You probably need to set the path by passing in a MQTTDefaultFilePersistence object to the MQTTClient() constructor after the client ID or pass in a MemoryPersistence to remove the need to store to disk at all (this will potentially loose messages if Tomcat crashes).

Related

Rest Assured Output : print URL

I would like to see which URL Rest assured has constructed for test.
My code is pretty vanilla.
ValidatableResponse response = given().
auth().preemptive().basic("User", "Passwd").
contentType(MediaType.APPLICATION_JSON).
log().all().
when().
get("/ping").
then().
statusCode(200);
But the output is a heck of a stack trace which does not even tell me what was the target URL.
checkServer
"java.lang.AssertionError: 1 expectation failed.
Expected status code <200> doesn't match actual status code <500>.
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrap.callConstructor(ConstructorSite.java:84)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:247)
at com.jayway.restassured.internal.ResponseSpecificationImpl$HamcrestAssertionClosure.validate(ResponseSpecificationImpl.groovy:598)
at com.jayway.restassured.internal.ResponseSpecificationImpl$HamcrestAssertionClosure$validate$1.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at com.jayway.restassured.internal.ResponseSpecificationImpl.validateResponseIfRequired(ResponseSpecificationImpl.groovy:760)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
at com.jayway.restassured.internal.ResponseSpecificationImpl.statusCode(ResponseSpecificationImpl.groovy:120)
at com.jayway.restassured.specification.ResponseSpecification$statusCode$0.callCurrent(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
at com.jayway.restassured.internal.ResponseSpecificationImpl.statusCode(ResponseSpecificationImpl.groovy:128)
at com.jayway.restassured.internal.ValidatableResponseOptionsImpl.statusCode(ValidatableResponseOptionsImpl.java:117)
at org.mystuff.EnvironmentCheck.checkServer(EnvironmentCheck.java:43)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:281)
at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:121)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)
... Removed 31 stack frames
How would I go about that?
It looks like your request is using the default host and port number. From https://github.com/jayway/rest-assured/wiki/Usage#default-values: "By default REST assured assumes host localhost and port 8080 when doing a request."
If you want to actually see what RESTAssured is sending, rather than just inferring, see https://github.com/jayway/rest-assured/wiki/Usage#request-logging, which refers one to http://hc.apache.org/httpcomponents-client-ga/logging.html to see "what's actually sent on the wire." That document, under "Configuration Examples", has different options for enabling HttpClient communications logging.
From that document, the quick solution best suited to your question send to be the "Enable header wire + context logging - Best for Debugging" set of JVM system properties:
-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
-Dorg.apache.commons.logging.simplelog.showdatetime=true
-Dorg.apache.commons.logging.simplelog.log.org.apache.http=DEBUG
-Dorg.apache.commons.logging.simplelog.log.org.apache.http.wire=ERROR`

RESTful web service on TIBCO BW6.3 and Swagger UI tool

I recently started to use TIBCO BW6.3
I've created a RESTful web service that invokes another SOAP Web service, Hopefully until now.
I want to use a user-friendly tool, called Swagger UI, included in TIBCO BW6.3, in order to test my RESTful web service, when i start my application (process that represent my RESTful Web service), i get an exception in the console, and i cannot access the Swagger interface !
The console shows me at the end a message that the application has successfully started, but when i try to use Swagger UI to test my RESTful web service, it doesn't work !!
The followwing is the error :
!MESSAGE [com.tibco.bw.binding.rest.swagger.runtime(76)] The addSwaggerHostingConfig method has thrown an exception
!STACK 0
java.lang.NullPointerException
at java.lang.String.replace(Unknown Source)
at com.tibco.bw.rest.swagger.service.impl.SwaggerHostingConfigurationConsumer.addSwaggerHostingConfig(SwaggerHostingConfigurationConsumer.java:159)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:222)
at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:37)
at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:615)
at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:499)
at org.apache.felix.scr.impl.helper.BindMethod.invoke(BindMethod.java:41)
at org.apache.felix.scr.impl.manager.DependencyManager.doInvokeBindMethod(DependencyManager.java:1605)
at org.apache.felix.scr.impl.manager.DependencyManager.invokeBindMethod(DependencyManager.java:1581)
at org.apache.felix.scr.impl.manager.SingleComponentManager.invokeBindMethod(SingleComponentManager.java:369)
at org.apache.felix.scr.impl.manager.DependencyManager$MultipleDynamicCustomizer.addedService(DependencyManager.java:322)
at org.apache.felix.scr.impl.manager.DependencyManager$MultipleDynamicCustomizer.addedService(DependencyManager.java:298)
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1492)
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1413)
at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.trackAdding(ServiceTracker.java:1222)
at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.track(ServiceTracker.java:1158)
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:1444)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:109)
at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:914)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:862)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:801)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:127)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:225)
at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:464)
at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:482)
at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:998)
at com.tibco.bw.binding.rest.runtime.core.RestServiceBT.init(RestServiceBT.java:373)
at com.tibco.bw.frwk.BWComponentImpl.initializeComponent(BWComponentImpl.java:537)
at com.tibco.bw.frwk.BWComponentImpl.doStart(BWComponentImpl.java:393)
at com.tibco.bw.frwk.BWApplicationModuleImpl.startApplication(BWApplicationModuleImpl.java:390)
at com.tibco.bw.frwk.BWApplicationModuleImpl.onResolved(BWApplicationModuleImpl.java:144)
at com.tibco.bw.thor.runtime.api.DependencyDescriptor.onStateChange(DependencyDescriptor.java:83)
at com.tibco.bw.thor.runtime.api.ConstituentStateDependency.o00000(ConstituentStateDependency.java:105)
at com.tibco.bw.thor.runtime.api.ConstituentStateDependency.onStateChange(ConstituentStateDependency.java:71)
at com.tibco.bw.thor.runtime.model.Constituent.setConstituentState(Constituent.java:124)
at com.tibco.bw.frwk.BWSharedModuleImpl.onResolved(BWSharedModuleImpl.java:67)
at com.tibco.bw.thor.runtime.api.DependencyDescriptor.start(DependencyDescriptor.java:120)
at com.tibco.bw.frwk.BWModuleEventHandler.deployModule(BWModuleEventHandler.java:562)
at com.tibco.bw.frwk.BWModuleEventHandler.handleBundleEvent(BWModuleEventHandler.java:411)
at com.tibco.bw.thor.runtime.ApplicationHandler.addingBundle(ApplicationHandler.java:254)
at com.tibco.bw.thor.runtime.ApplicationHandler.addingBundle(ApplicationHandler.java:1)
at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:469)
at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:1)
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)
at org.osgi.util.tracker.BundleTracker.open(BundleTracker.java:156)
at com.tibco.bw.thor.runtime.ApplicationHandler.onResolved(ApplicationHandler.java:187)
at com.tibco.bw.thor.runtime.api.DependencyDescriptor.start(DependencyDescriptor.java:120)
at com.tibco.bw.thor.runtime.ApplicationHandler.handleBundleEvent(ApplicationHandler.java:1568)
at com.tibco.bw.thor.runtime.Deployer.addingBundle(Deployer.java:485)
at com.tibco.bw.thor.runtime.Deployer.addingBundle(Deployer.java:1)
at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:469)
at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:1)
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)
at org.osgi.util.tracker.BundleTracker.open(BundleTracker.java:156)
at com.tibco.bw.thor.runtime.Deployer$1.frameworkEvent(Deployer.java:297)
at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:926)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
!ENTRY com.tibco.bw.binding.rest.swagger.runtime 4 0 2016-05-16 15:09:48.782
!MESSAGE [com.tibco.bw.binding.rest.swagger.runtime(76)] The addSwaggerHostingConfig method has thrown an exception
!STACK 0
java.lang.NullPointerException
at java.lang.String.replace(Unknown Source)
at com.tibco.bw.rest.swagger.service.impl.SwaggerHostingConfigurationConsumer.addSwaggerHostingConfig(SwaggerHostingConfigurationConsumer.java:159)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:222)
at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:37)
at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:615)
at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:499)
at org.apache.felix.scr.impl.helper.BindMethod.invoke(BindMethod.java:41)
at org.apache.felix.scr.impl.manager.DependencyManager.doInvokeBindMethod(DependencyManager.java:1605)
at org.apache.felix.scr.impl.manager.DependencyManager.invokeBindMethod(DependencyManager.java:1581)
at org.apache.felix.scr.impl.manager.SingleComponentManager.invokeBindMethod(SingleComponentManager.java:369)
at org.apache.felix.scr.impl.manager.DependencyManager$MultipleDynamicCustomizer.addedService(DependencyManager.java:322)
at org.apache.felix.scr.impl.manager.DependencyManager$MultipleDynamicCustomizer.addedService(DependencyManager.java:298)
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1492)
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1413)
at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.trackAdding(ServiceTracker.java:1222)
at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.track(ServiceTracker.java:1158)
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:1444)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:109)
at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:914)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:862)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:801)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:127)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:225)
at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:464)
at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:482)
at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:998)
at com.tibco.bw.binding.rest.runtime.core.RestServiceBT.init(RestServiceBT.java:373)
at com.tibco.bw.frwk.BWComponentImpl.initializeComponent(BWComponentImpl.java:537)
at com.tibco.bw.frwk.BWComponentImpl.doStart(BWComponentImpl.java:393)
at com.tibco.bw.frwk.BWApplicationModuleImpl.startApplication(BWApplicationModuleImpl.java:390)
at com.tibco.bw.frwk.BWApplicationModuleImpl.onResolved(BWApplicationModuleImpl.java:144)
at com.tibco.bw.thor.runtime.api.DependencyDescriptor.onStateChange(DependencyDescriptor.java:83)
at com.tibco.bw.thor.runtime.api.ConstituentStateDependency.o00000(ConstituentStateDependency.java:105)
at com.tibco.bw.thor.runtime.api.ConstituentStateDependency.onStateChange(ConstituentStateDependency.java:71)
at com.tibco.bw.thor.runtime.model.Constituent.setConstituentState(Constituent.java:124)
at com.tibco.bw.frwk.BWSharedModuleImpl.onResolved(BWSharedModuleImpl.java:67)
at com.tibco.bw.thor.runtime.api.DependencyDescriptor.start(DependencyDescriptor.java:120)
at com.tibco.bw.frwk.BWModuleEventHandler.deployModule(BWModuleEventHandler.java:562)
at com.tibco.bw.frwk.BWModuleEventHandler.handleBundleEvent(BWModuleEventHandler.java:411)
at com.tibco.bw.thor.runtime.ApplicationHandler.addingBundle(ApplicationHandler.java:254)
at com.tibco.bw.thor.runtime.ApplicationHandler.addingBundle(ApplicationHandler.java:1)
at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:469)
at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:1)
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)
at org.osgi.util.tracker.BundleTracker.open(BundleTracker.java:156)
at com.tibco.bw.thor.runtime.ApplicationHandler.onResolved(ApplicationHandler.java:187)
at com.tibco.bw.thor.runtime.api.DependencyDescriptor.start(DependencyDescriptor.java:120)
at com.tibco.bw.thor.runtime.ApplicationHandler.handleBundleEvent(ApplicationHandler.java:1568)
at com.tibco.bw.thor.runtime.Deployer.addingBundle(Deployer.java:485)
at com.tibco.bw.thor.runtime.Deployer.addingBundle(Deployer.java:1)
at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:469)
at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:1)
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)
at org.osgi.util.tracker.BundleTracker.open(BundleTracker.java:156)
at com.tibco.bw.thor.runtime.Deployer$1.frameworkEvent(Deployer.java:297)
at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:926)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
15:09:49.585 INFO [bwEngThread:In-Memory Process Worker-2] c.t.b.p.g.Log.ACMEAppModule.Log - Received Lookup request for OrderID : TESTORDER123
15:09:49.834 INFO [Thread-30] com.tibco.thor.frwk.Application - TIBCO-THOR-FRWK-300006: Started BW Application [ACMEApp:1.0]
15:09:49.835 INFO [Framework Event Dispatcher: Equinox Container: f0806ac5-6f1b-0016-1355-e14504be535b] com.tibco.thor.frwk.Application - Started by BusinessStudio, ignoring .enabled settings.
Could you help me to solve this issue, thanks a lot.
You will need to change the default port for Swagger in TIBCO. Add a JVM argument to point to the correct port number like this:
-Dbw.rest.docport=<your_port>
For more details refer to this link:
https://community.tibco.com/questions/i-am-getting-below-error-opening-swagger-document-server-bw6-even-after-i-changed-http

Having trouble with gpc rendering plugin for a grails 3 app

I am trying to migrate an old grails app to grails 3. I am using grails 3.0.10. I was using the rendering plugin in my old app to generate PDFs and have a bunch of PDFs built this way which I would like to keep intact, so I'm trying to get this rendering plugin installed in my grails 3 app. As suggested, I have added the following line to my build.gradle under the dependencies:
compile "org.grails.plugins:rendering:2.0.0-SNAPSHOT"
This seems to correctly pull this plugin .jar file and the run-app works. However, when I try to render a gsp as a PDF through my controller I'm getting a NullPointerException that is being thrown by some code in the rendering plugin.
Here's my code to generate a PDF from a controller method:
renderPdf(template: "/pdfs/test", model: [name : 'Amarish'], filename: 'Hello-There.pdf')
Since the above did not work, I also tried it separately a different way by including the pdfRenderingService in the controller through dependency injection and then tried the following:
ByteArrayOutputStream bytes = pdfRenderingService.render(template: "/pdfs/test", model: [name: 'Amarish'])
response.setContentLength(bytes.length)
response.setContentType('application/pdf')
response.outputStream.write(bytes)
I am including the stack trace below. Can you please let me know how I could correct this issue?
ERROR org.grails.web.errors.GrailsExceptionResolver - NullPointerException occurred when processing request: [GET] /test/testPDF
Stacktrace follows:
java.lang.reflect.InvocationTargetException: null
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) ~[na:1.7.0_79]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) ~[na:1.7.0_79]
at java.lang.Thread.run(Thread.java:745) [na:1.7.0_79]
Caused by: java.lang.NullPointerException: null
at java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1281) ~[na:1.7.0_79]
at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1141) ~[na:1.7.0_79]
at java.beans.Introspector.getBeanInfo(Introspector.java:416) ~[na:1.7.0_79]
at java.beans.Introspector.getBeanInfo(Introspector.java:163) ~[na:1.7.0_79]
at grails.plugins.rendering.document.RenderEnvironment.init(RenderEnvironment.groovy:31) ~[rendering-2.0.0-SNAPSHOT.jar:na]
at grails.plugins.rendering.document.RenderEnvironment.with(RenderEnvironment.groovy:68) ~[rendering-2.0.0-SNAPSHOT.jar:na]
at grails.plugins.rendering.document.RenderEnvironment.with(RenderEnvironment.groovy:60) ~[rendering-2.0.0-SNAPSHOT.jar:na]
at grails.plugins.rendering.document.XhtmlDocumentService.generateXhtml(XhtmlDocumentService.groovy:65) ~[rendering-2.0.0-SNAPSHOT.jar:na]
at grails.plugins.rendering.document.XhtmlDocumentService.createDocument(XhtmlDocumentService.groovy:35) ~[rendering-2.0.0-SNAPSHOT.jar:na]
at grails.plugins.rendering.RenderingService.render(RenderingService.groovy:36) ~[rendering-2.0.0-SNAPSHOT.jar:na]
at grails.plugins.rendering.RenderingService.render(RenderingService.groovy:35) ~[rendering-2.0.0-SNAPSHOT.jar:na]
at grails.plugins.rendering.RenderingService.render(RenderingService.groovy:65) ~[rendering-2.0.0-SNAPSHOT.jar:na]
at grails.plugins.rendering.RenderingTrait$Trait$Helper.renderPdf(RenderingTrait.groovy:47) ~[rendering-2.0.0-SNAPSHOT.jar:na]
at com.svp.controller.TestController$_closure1.doCall(TestController.groovy:14) ~[main/:na]
... 3 common frames omitted
What you need in your build.gradle dependencies is
runtime "org.springframework:spring-test:4.2.1.RELEASE"
and your code will just work just fine. Good luck!
You can also add the latest version from here

Intermittent EntityNotFoundException with Spring Data Neo4j

I'm using Neo4j 2.1.6 and Spring Data Neo4j 3.2.1. I've been using Neo4j 2.1.6 the whole time (i.e. haven't migrated from an earlier version of Neo).
I'm running into an intermittent issue where when I try to do a MATCH statement, e.g.
MATCH (p:Profile) WHERE p.username = 'abc123' RETURN p
I'm getting an EntityNotFoundException, saying things like,
Node with id 25393
A couple similar MATCH queries return similar results.
I'm noticing that the ids that aren't found are greater than the max internal node ID in the database.
I'm not exactly sure what's going on as it's intermittent.
Any help on the matter would be greatly appreciated.
Example stack trace follows:
</pre><p><b>root cause</b></p><pre>org.neo4j.graphdb.NotFoundException: Node 25393 not found
org.neo4j.kernel.impl.core.NodeManager.getNodeById(NodeManager.java:323)
org.neo4j.kernel.InternalAbstractGraphDatabase.getNodeById(InternalAbstractGraphDatabase.java:1177)
org.neo4j.cypher.internal.spi.v2_1.TransactionBoundQueryContext$NodeOperations.getById(TransactionBoundQueryContext.scala:161)
org.neo4j.cypher.internal.spi.v2_1.TransactionBoundQueryContext$$anonfun$getNodesByLabel$1.apply(TransactionBoundQueryContext.scala:135)
org.neo4j.cypher.internal.spi.v2_1.TransactionBoundQueryContext$$anonfun$getNodesByLabel$1.apply(TransactionBoundQueryContext.scala:135)
org.neo4j.cypher.internal.helpers.JavaConversionSupport$$anon$2.next(JavaConversionSupport.scala:33)
scala.collection.Iterator$$anon$11.next(Iterator.scala:328)
scala.collection.Iterator$$anon$13.next(Iterator.scala:372)
scala.collection.Iterator$$anon$14.hasNext(Iterator.scala:389)
scala.collection.Iterator$class.foreach(Iterator.scala:727)
scala.collection.AbstractIterator.foreach(Iterator.scala:1157)
org.neo4j.cypher.internal.compiler.v2_1.pipes.EagerAggregationPipe.internalCreateResults(EagerAggregationPipe.scala:78)
org.neo4j.cypher.internal.compiler.v2_1.pipes.PipeWithSource.createResults(Pipe.scala:105)
org.neo4j.cypher.internal.compiler.v2_1.pipes.PipeWithSource.createResults(Pipe.scala:102)
org.neo4j.cypher.internal.compiler.v2_1.pipes.PipeWithSource.createResults(Pipe.scala:102)
org.neo4j.cypher.internal.compiler.v2_1.pipes.PipeWithSource.createResults(Pipe.scala:102)
org.neo4j.cypher.internal.compiler.v2_1.executionplan.ExecutionPlanBuilder$$anonfun$getExecutionPlanFunction$1$$anonfun$apply$2.apply(ExecutionPlanBuilder.scala:120)
org.neo4j.cypher.internal.compiler.v2_1.executionplan.ExecutionPlanBuilder$$anonfun$getExecutionPlanFunction$1$$anonfun$apply$2.apply(ExecutionPlanBuilder.scala:119)
org.neo4j.cypher.internal.compiler.v2_1.executionplan.ExecutionWorkflowBuilder.runWithQueryState(ExecutionPlanBuilder.scala:168)
org.neo4j.cypher.internal.compiler.v2_1.executionplan.ExecutionPlanBuilder$$anonfun$getExecutionPlanFunction$1.apply(ExecutionPlanBuilder.scala:118)
org.neo4j.cypher.internal.compiler.v2_1.executionplan.ExecutionPlanBuilder$$anonfun$getExecutionPlanFunction$1.apply(ExecutionPlanBuilder.scala:103)
org.neo4j.cypher.internal.compiler.v2_1.executionplan.ExecutionPlanBuilder$$anon$1.execute(ExecutionPlanBuilder.scala:68)
org.neo4j.cypher.internal.compiler.v2_1.executionplan.ExecutionPlanBuilder$$anon$1.execute(ExecutionPlanBuilder.scala:67)
org.neo4j.cypher.internal.ExecutionPlanWrapperForV2_1.execute(CypherCompiler.scala:159)
org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:76)
org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:71)
org.neo4j.cypher.javacompat.ExecutionEngine.execute(ExecutionEngine.java:84)
org.springframework.data.neo4j.support.query.CypherQueryEngineImpl.parseAndExecuteQuery(CypherQueryEngineImpl.java:70)
org.springframework.data.neo4j.support.query.CypherQueryEngineImpl.query(CypherQueryEngineImpl.java:58)
org.springframework.data.neo4j.repository.query.GraphRepositoryQuery.dispatchQuery(GraphRepositoryQuery.java:107)
org.springframework.data.neo4j.repository.query.GraphRepositoryQuery$1.doWithGraph(GraphRepositoryQuery.java:89)
org.springframework.data.neo4j.support.Neo4jTemplate.doExecute(Neo4jTemplate.java:457)
org.springframework.data.neo4j.support.Neo4jTemplate.access$000(Neo4jTemplate.java:87)
org.springframework.data.neo4j.support.Neo4jTemplate$2.doInTransaction(Neo4jTemplate.java:471)
org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
org.springframework.data.neo4j.support.Neo4jTemplate.exec(Neo4jTemplate.java:468)
org.springframework.data.neo4j.repository.query.GraphRepositoryQuery.execute(GraphRepositoryQuery.java:83)
org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:421)
org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:381)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98)
org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
com.sun.proxy.$Proxy78.usernameExists(Unknown Source)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201)
com.sun.proxy.$Proxy79.usernameExists(Unknown Source)
com.theapp.dao.impl.UserDAOImpl.usernameExists(UserDAOImpl.java:181)
com.theapp.service.impl.RegistrationServiceImpl.registerUserAccount(RegistrationServiceImpl.java:45)
com.theapp.facade.impl.UserFacadeImpl.registerUser(UserFacadeImpl.java:137)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98)
org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
com.sun.proxy.$Proxy171.registerUser(Unknown Source)
com.theapp.controllers.AuthController.registration(AuthController.java:57)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)
org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:781)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:721)
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868)
javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)
com.theapp.security.CustomAuthenticationProcessingFilter.doFilter(CustomAuthenticationProcessingFilter.java:101)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter.doFilter(AbstractPreAuthenticatedProcessingFilter.java:94)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
It seems you have no index on :Profile(username)
So Neo (Cypher) has to scan over all :Profile nodes some of which might have been removed concurrently. So Cypher reads the id from the index, after that the node is deleted and only later it tries to load the node with that id for property comparison but it already has gone.
I think it's addressed in a more current version of Neo4j but I'm not sure.
We ran into a similar problem on Neo4j 2.2.3 and Spring Data 3.3.1.
Based on your comment to Michael's answer, it sounds like you have an index on the username property. We verified that we have a schema index against "username" using :schema in the Neo4j browser.
It seems the index is somehow corrupted. I verified this by running the same query but with a couple of twists to bypass the index:
MATCH (p:Profile) USING SCAN p:Profile WHERE p.username = 'abc123' RETURN p
MATCH (p:Profile) WITH p WHERE p.username = 'abc123' RETURN p
The above queries would work, but the original query you gave failed as described. Sometimes queries would fail by returning no results (when they should have results), and sometimes we saw some Neo4j error about a missing ID. This means the queries only work when not hitting the index.
Then running
DROP INDEX ON :Profile(username)
CREATE INDEX ON :Profile(username)
seemed to fix it, confirming that the index is corrupt. However, the whole time Neo4j claimed the username index was ONLINE. This happened multiple times, but we have no steps to reproduce.
This is likely a bug in Neo4j. My recommendation is to avoid (drop all) schema property indexes until it is fixed.

Grails Inline Plugins And Spring Security

I'm breaking my grails application into modules by using plugins and then adding the inline plugin locations to BuildConfig.groovy. Right now I have a grails application called 'admin' and a plugin called 'common'.
'common' plugin contains all my shared domain objects and also has the spring-security-core plugin installed. As I understand it, I also needed to install the spring-security-core plugin into 'admin' so I've done that.
I ran s2-quickstart on 'common' and it contains the Domain mappings for User and Role inside Config.groovy. When I run the application, it redirect appropriately on secured content (via the #Secured annotation). However, when I attempt to authenticate, it is still trying to query for Person instead of User.
I added the domain mappings from 'common' Config.groovy into 'admin' and the query now works, but it can't find the additional properties I've added to the User domain that exists in the 'common' plugin.
Am I missing something here? I'd rather not have to put User and Role in the 'admin' application since I want to be able to reuse User and Role in another app that also uses the 'common' plugin.
UPDATE: I realized I had conflicting spring-security-core plugins installed (copy and paste issue). I resolved that which cleaned up the issue with it trying to find Person instead of User. Now, however, I am getting the following stacktrace
java.lang.NullPointerException: Cannot get property 'clazz' on null object
at org.codehaus.groovy.runtime.NullObject.getProperty(NullObject.java:56)
at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:156)
at org.codehaus.groovy.runtime.callsite.NullCallSite.getProperty(NullCallSite.java:44)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:235)
at org.codehaus.groovy.grails.plugins.springsecurity.GormUserDetailsService.loadUser(GormUserDetailsService.groovy:80)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:266)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:51)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:153)
at org.codehaus.groovy.grails.plugins.springsecurity.GormUserDetailsService.loadUserFromSession(GormUserDetailsService.groovy:72)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:88)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1058)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1070)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1003)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1070)
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.AbstractCallSite.callCurrent(AbstractCallSite.java:157)
at org.codehaus.groovy.grails.plugins.springsecurity.GormUserDetailsService$_loadUserByUsername_closure1.doCall(GormUserDetailsService.groovy:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:88)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1058)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1070)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
at groovy.lang.Closure.call(Closure.java:276)
at org.codehaus.groovy.runtime.ConvertedClosure.invokeCustom(ConvertedClosure.java:51)
at org.codehaus.groovy.runtime.ConversionHandler.invoke(ConversionHandler.java:79)
at $Proxy17.doInTransaction(Unknown Source)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSite.invoke(PojoMetaMethodSite.java:188)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124)
at org.codehaus.groovy.grails.plugins.springsecurity.GormUserDetailsService.loadUserByUsername(GormUserDetailsService.groovy:59)
at org.codehaus.groovy.grails.plugins.springsecurity.GrailsUserDetailsService$loadUserByUsername.callCurrent(Unknown Source)
at org.codehaus.groovy.grails.plugins.springsecurity.GormUserDetailsService.loadUserByUsername(GormUserDetailsService.groovy:68)
at org.springframework.security.authentication.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:86)
at org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:129)
at org.springframework.security.authentication.ProviderManager.doAuthentication(ProviderManager.java:130)
at org.springframework.security.authentication.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:48)
at org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter.attemptAuthentication(UsernamePasswordAuthenticationFilter.java:97)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)
at org.codehaus.groovy.grails.plugins.springsecurity.RequestHolderAuthenticationFilter.doFilter(RequestHolderAuthenticationFilter.java:40)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
at org.codehaus.groovy.grails.plugins.springsecurity.MutableLogoutFilter.doFilter(MutableLogoutFilter.java:79)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:167)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.codehaus.groovy.grails.web.servlet.filter.GrailsReloadServletFilter.doFilterInternal(GrailsReloadServletFilter.java:104)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequestFilter.doFilterInternal(GrailsWebRequestFilter.java:69)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.codehaus.groovy.grails.web.filters.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:65)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:680)
So taking Burt's advice, I added the following in my CommonGrailsPlugin.groovy..
def doWithApplicationContext = { applicationContext ->
SpringSecurityUtils.securityConfig.userLookup.userDomainClassName = 'com.wbr.common.security.User'
SpringSecurityUtils.securityConfig.userLookup.authorityJoinClassName = 'com.wbr.common.security.UserRole'
SpringSecurityUtils.securityConfig.authority.className = 'com.wbr.common.security.Role'
}
This keeps me from having to copy this config into all of the application that depend on this plugin. And since those applications don't need to customize this configuration, it works great! Thanks Burt!
Just make sure the following lines match your package and domain object names in conf/Config.groovy. Change the package and object names accordingly
// Added by the Spring Security Core plugin:
grails.plugins.springsecurity.userLookup.userDomainClassName = 'THIS.IS.THE PACKAGE.Person'
grails.plugins.springsecurity.userLookup.authorityJoinClassName = 'THIS.IS.THE.PACKAGE.PersonAuthority'
grails.plugins.springsecurity.authority.className = 'THIS.IS.THE.PACKAGE.Authority'
Here's what's happening.
For flexibility, the security plugin lets you define the class you use for security in conf/Config.gs. It then dynamically loads that class by doing
def User = AH.application.getDomainClass( SpringSecurityUtils.securityConfig.userLookup.userDomainClassName).clazz )
and using the User class. If you've changed the class name and didn't change the config you'll get this error.

Resources