I added rendering plugin as dependency in build.gradle for my grails 3 project as mentioned in https://grails.org/plugin/rendering
compile ":rendering:1.0.0"
When I execute 'gradle dependencies',it says failed. It did not give me any error message but it says failed when the dependencies are listed.
These are the default repositories generated with project
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
}
I tried even this way but did not work
compile "rendering:rendering:1.0.0"
Let me know if I am missing anything or the syntax is wrong.
Version 1.0.0 of rendering plugin is not compatible with Grails 3. Compatible version is 2.0.0-SNAPSHOT and above.
compile "org.grails.plugins:rendering:2.0.0-SNAPSHOT"
in build.gradle should be good with the repository that is currently present.
With Grails 2.*, yes you would need to use this repo: http://repo.grails.org/grails/plugins/org/grails/plugins/rendering/1.0.0/.
maven { url "https://repo.grails.org/grails/plugins" }
We could resolve the dependency injection issue. There was some issue with the project we were working on.So, created a new project and it is working fine. Thankyou.
But we are still having issue with render method.We are calling the render method as below to get the generate the pdf. 'pdf' template is located atviews/render/_pdf.gsp
ByteArrayOutputStream baos = new ByteArrayOutputStream();
pdfRenderingService.render([template: '/render/pdf', model: [form:"Hello text"]],baos)
It is throwing the below exception. Can anyone let us know if we are calling render method in wrong way.
Line | Method
->> 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 617 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run . . . in java.lang.Thread
Caused by NullPointerException: null
->> 1337 | getPublicDeclaredMethods in java.beans.Introspector
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1197 | getTargetMethodInfo in ''
| 426 | getBeanInfo in ''
| 173 | getBeanInfo in ''
| 31 | init . . in grails.plugins.rendering.document.RenderEnvironment
| 68 | with in ''
| 60 | with . . in ''
| 65 | generateXhtml in grails.plugins.rendering.document.XhtmlDocumentService
| 35 | createDocument in ''
| 36 | render in grails.plugins.rendering.RenderingService
| 43 | buildPdf in RenderController.groovy
Related
I'm using the spring-security-ldap:2.0-RC2 plugin with Grails 2.3.2. I'm trying to connect to an Active Directory server. I've configured the plugin as follows in config.groovy
grails.plugins.springsecurity.ldap.context.server = 'ldap://[ip]:389'
grails.plugins.springsecurity.ldap.context.managerDn = '[DN]'
grails.plugins.springsecurity.ldap.context.managerPassword = '[password]'
grails.plugins.springsecurity.ldap.authorities.ignorePartialResultException = true
grails.plugins.springsecurity.ldap.authorities.retrieveDatabaseRoles = true
grails.plugins.springsecurity.ldap.search.filter = '(sAMAccountName={0})'
grails.plugins.springsecurity.ldap.search.base = [searchbase]
grails.plugins.springsecurity.ldap.search.searchSubtree = true
grails.plugins.springsecurity.ldap.auth.hideUserNotFoundExceptions = false
grails.plugins.springsecurity.ldap.search.attributesToReturn = ['name', 'mail']
I get a connection error. However, the connection is listed as localhost:389, not the AD server I've specified.
Caused by CommunicationException: localhost:389; nested exception is
javax.naming.CommunicationException: localhost:389 [Root exception is java.net.ConnectException:
Connection refused: connect]
->> 76 | attemptAuthentication in
grails.plugin.springsecurity.web.authentication.RequestHolderAuthenticationFilter
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 49 | doFilter in ''
| 82 | doFilter . . . . . . in
grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Note: I've tried connecting (in a separate Groovy project) with Groovy-Ldap.jar
I make a connection with:
ldap = LDAP.newInstance('ldap://[ip]:389', '[DN]', '[password]')
and this works fine. I can connect to the AD.
Any idea what can be wrong and why localhost:389 is tried and the AD I specified?
Note: in my Grails project I am using a ProxySettings.groovy file with several entries in http.nonProxyHosts (all servers that need to be accessed in the internal network). I've tried including the AD server in the nonProxyHosts but this makes no difference.
Regards,
Jan-Willem Klomp
You should be getting a warning in the output telling you that you're using grails.plugins.springsecurity as the property prefix but that it's been changed in 2.0 to grails.plugin.springsecurity. Your custom properties are being ignored and only the defaults are being used.
I'm new using splunk and the java sdk api.
I combined a grails environnement with that api and getting an error on the simplest search, giving into the doc exemple :
Here is my code :
package fr.ftprod.splunk
import com.splunk.Job
import com.splunk.JobCollection
import com.splunk.Service
class LoginController {
def index() {
//connect and login
def connectionParameters = [host: 'localhost', username: 'username' ,password: 'password']
Service service = Service.connect(connectionParameters)
String myQuery = 'source="source" get status=200'
// Retrieves the collection of search jobs
def jobs = service.getJobs()
}
}
Here is my grails stacktrace :
| Error 2013-06-24 14:15:10,689 [http-bio-8080-exec-10] ERROR
errors.GrailsExceptionResolver - UnsupportedOperationException
occurred when processing request: [GET] /splunk/ Stacktrace follows:
Message: null
Line | Method
->> 159 | entrySet in com.splunk.ResourceCollection
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 621 | putAll in java.util.HashMap | 195 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter | 63 |
doFilter in grails.plugin.cache.web.filter.AbstractFilter | 1145 |
runWorker in java.util.concurrent.ThreadPoolExecutor | 615 | run
in java.util.concurrent.ThreadPoolExecutor$Worker ^ 722 | run . . .
in java.lang.Thread
Any idea ?
Thanks
I can't tell what's causing the error but what is it that you are trying to do? Because in the code you posted, you are not running any searches or executing any job. I am new to grails but I set up a hello world like example and it appears to be working.
Code Sample:
package helloworld
import com.splunk.Service
class HelloController {
def index() {
render "Hello World"
def connectionParameters = [host: 'localhost', username: 'admin' ,password: 'changeme']
def service = Service.connect(connectionParameters)
render "<br>"
render service.getToken()
def jobs = service.getJobs()
render "<br>"
render jobs.size()
}
}
Output:
Hello World
Splunk 1d1f464ac1b4051089ab3388aac60c5d
4
Try to copy/paste the code, run it and tell us what happens and where exactly it chokes.
I tried this with Grails 2.3.3, Splunk 5.0.2, Splunk Java SDK 1.1 and Java 1.6. What versions are you on?
| Error 2012-10-29 14:51:19,847 [http-bio-8443-exec-3] ERROR http11.Http11Processor - Error processing request
Message: An attempt was made to write more data to the response headers than there was room available in the buffer. Increase maxHttpHeaderSize on the connector or write less data into the response headers.
Line | Method
->> 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 908 | run in ''
^ 680 | run . . in java.lang.Thread
| Error 2012-10-29 14:51:19,850 [http-bio-8443-exec-3] ERROR http11.Http11Processor - Error finishing response
Message: An attempt was made to write more data to the response headers than there was room available in the buffer. Increase maxHttpHeaderSize on the connector or write less data into the response headers.
Line | Method
->> 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 908 | run in ''
^ 680 | run . . in java.lang.Thread
This happens very randomly in my local development environment (grails run-app -https). No matter what the browser is.
I'm running Grails 2.1.0 on Mac OSX with the following plugins:
aws-sdk 1.3.12 -- AWS SDK Grails Plugin
cookie-session 0.1.2 -- Cookie Session Plugin
hibernate 2.1.0 -- Hibernate for Grails
jquery 1.7.1 -- JQuery for Grails
jquery-ui 1.8.15 -- jQuery UI resources
mail 1.0 -- Provides Mail support to a running Grails application
newrelic 0.1 -- Newrelic Plugin
qrcode 0.3 -- QR Code plugin
quartz 1.0-RC2 -- Quartz plugin for Grails
resources 1.1.6 -- Resources
spring-security-core1.2.7.3 -- Spring Security Core Plugin
tomcat 2.1.0 -- Apache Tomcat plugin for Grails
webxml 1.4.1 -- WebXmlConfig
Any ideas what could cause this?
EDIT:
Noticed that this seems to happen after logging in (Spring security login form) when the browser is forwarded to j_spring_security_check. With Chrome & Firefox it's possible to stop this happening for a while by reseting the browser. IE doesn't behave similarly, instead just keeps giving this error (the error is shown only in grails console).
There's something that fills the headers. Possibly the cookie-session plugin?
This code adds getBean() methods to the classes we are using:
clazz.metaClass.getBean = { String name ->
return VaadinUtils.getBean(name)
}
clazz.metaClass.getBean = { Class type ->
return VaadinUtils.getBean(type)
}
It works without problem when the application is started and it also survives few recompilations. Recompilation is done like this:
def reloadedClass = application.classLoader.loadClass(vaadinGrailsClass.clazz.name)
After few recompilations, it says that getBean() method is missing and the exception is thrown (so one has to restart and redeploy the application under development).
Caused by MissingMethodException: No signature of method:
com.myapp.SaveIssueDetailListener.getBean() is applicable for argument types:
(java.lang.Class) values: [class agiletool.core.IssueService]
Possible solutions: getClass(), getForm(), getAt(java.lang.String)
->> 30 buttonClick in com.myapp.SaveIssueDetailListener$$ENRHmYFM
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
512 receiveEvent in com.vaadin.event.ListenerMethod
164 fireEvent . . . . . in com.vaadin.event.EventRouter
1219 fireEvent in com.vaadin.ui.AbstractComponent
550 fireClick . . . . . in com.vaadin.ui.Button
217 changeVariables in ''
1451 changeVariables . . in com.vaadin.terminal.gwt.server.AbstractCommunicationManager
1399 handleVariableBurst in ''
1318 handleVariables . . in ''
763 doHandleUidlRequest in ''
296 handleUidlRequest . in com.vaadin.terminal.gwt.server.CommunicationManager
501 service in com.vaadin.terminal.gwt.server.AbstractApplicationServlet
191 service . . . . . . in com.vaadin.terminal.gwt.server.GrailsAwareApplicationServlet
886 runTask in java.util.concurrent.ThreadPoolExecutor$Worker
908 run . . . . . . . . in ''
680 run in java.lang.Thread
This is how we call the getBean() method:
public void buttonClick(ClickEvent event) {
UserService userService = getBean(UserService) //...
Any idea what might be wrong?
The problem occurs only in old versions of plugin for Vaadin 6. Vaadin plugin (for Vaadin 7) for Grails has been done from scratch and this issue doesn't exist there.
More info can be found in related JIRA issue.
More details about new Vaadin can be found on http://vaadinongrails.com/
I'm upgrading my application to Grails 2.0.0 RC3.
Now, I want to downgrade my application to Grails 2.0.0 RC1 but when I run it I have this error:
Error 500: Internal Server Error
URI
/directory/
Class
java.lang.IllegalStateException
Message
No thread-bound request found: Are you referring to request attributes outside of an actual web
request, or processing a request outside of the originally receiving thread? If you are actually
operating within a web request and still receive this message, your code is probably running
outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or
RequestContextFilter to expose the current request.
Trace
Line | Method
->> 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 908 | run in ''
^ 662 | run . . in java.lang.Thread
I have no idea how to get rid of it.