mail {
host = "smtp.1und1.de"
port = 465
username = "pt8100853-1"
password = "xxxxxxxx"
props = ["mail.smtp.auth":"true",
"mail.smtp.socketFactory.port":"465",
"mail.smtp.socketFactory.class":"javax.net.ssl.SSLSocketFactory",
"mail.smtp.socketFactory.fallback":"false"]
}
is the contents of config groovy. My controller contains
sendMail {
to "gaby#strotmann.org"
subject "Hello Fred"
body 'How are you?'
}
After activating sendMail I get:
Error 2015-02-25 21:19:25,883 [http-bio-8080-exec-8] ERROR errors.GrailsExceptionResolver - MailSendException occurred when processing request: [GET] /Partner/kommunikation/eMail
Failed messages: com.sun.mail.smtp.SMTPSendFailedException: 501 Syntax error in parameters or arguments
;
nested exception is:
com.sun.mail.smtp.SMTPSenderFailedException: 501 Syntax error in parameters or arguments
. Stacktrace follows:
Message: Failed messages: com.sun.mail.smtp.SMTPSendFailedException: 501 Syntax error in parameters or arguments
;
nested exception is:
com.sun.mail.smtp.SMTPSenderFailedException: 501 Syntax error in parameters or arguments
Line | Method
->> 131 | sendMessage in grails.plugin.mail.MailMessageBuilder
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 55 | sendMail in grails.plugin.mail.MailService
| 59 | sendMail . in ''
| 165 | doCall in MailGrailsPlugin$_configureSendMail_closure6
| 37 | eMail . . . in org.strotmann.partner.KommunikationController
| 198 | 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
^ 745 | run in java.lang.Thread
I'm somewhat confused to get a syntax error, as I copied the original code directly from the plugin documentation.
How can I escape that problem?
Related
I am working on Grails 2.3.11 and am using MongoDb plugin mongodb:3.0.3.
My code looks like this:
def home() {
List abcs = ABC.list()
println abcs.unique { it.parent }
}
The code breaks while accessing unique closure.
The exception says:
ERROR errors.GrailsExceptionResolver- UnsupportedOperationException occurred when processing request: [GET] /MongoAppInEcomEnv/product/home
Stacktrace follows:
Message: null
Line | Method
->> 148 | add in java.util.AbstractList
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 108 | add in ''
| 342 | addAll . in java.util.AbstractCollection
| 120 | $tt__home in com.test.aitm.ProductController$$EPCH6LtA
| 198 | 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
^ 744 | run . . . in java.lang.Thread
Looks like the list is empty.
Also you could try
abcs.parent.unique()
I am using the spring security facebook plugin to implement login in my grails application. I am using the 0.14.5 version of spring security facebook plugin. It was working fine until couple of months ago, now I cannot login to my application. I get the following error:
2014-12-12 16:52:50,197 [http-bio-8080-exec-1] ERROR [/testApp].[default] - Servlet.service() for servlet [default] in context with path [/testApp] threw exception [Filter execution threw an exception] with root cause
Message: org.codehaus.jackson.JsonNode
Line | Method
->> 175 | findClass in org.codehaus.groovy.tools.RootLoader
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 423 | loadClass in java.lang.ClassLoader
| 147 | loadClass . . . . . . . . in org.codehaus.groovy.tools.RootLoader
| 356 | loadClass in java.lang.ClassLoader
| 2451 | privateGetDeclaredMethods in java.lang.Class
| 1810 | getDeclaredMethods in ''
| 46 | getLocked . . . . . . . . in org.codehaus.groovy.util.LazyReference
| 33 | get in ''
| 59 | create . . . . . . . . . in testApp.user.FacebookAuthService
| 118 | create in com.the6hours.grails.springsecurity.facebook.DefaultFacebookAuthDao
| 67 | authenticate . . . . . . in com.the6hours.grails.springsecurity.facebook.FacebookAuthProvider
| 40 | attemptAuthentication in com.the6hours.grails.springsecurity.facebook.FacebookAuthRedirectFilter
| 1145 | runWorker . . . . . . . . in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run . . . . . . . . . . . in java.lang.Thread
I tried to upgrade the plugin but that did not help. During debuggin I found that I was getting access token from facebook and the error was occurring in following line
Facebook facebook = new FacebookTemplate(token.accessToken.accessToken)
recently, I am working in a grails project and intend to use mongodb as our nosql database, besides mysql.
I added mongodb plugin, do a test with a domain and it work well (show/edit/save...):
compile ':mongodb:3.0.1'
and try another method using gmongo plugin, which is useful in case I want to use mongodb low level API (or using mapReduce for example)
runtime "org.mongodb:mongo-java-driver:2.11.3"
compile "org.mongodb:mongo-java-driver:2.11.3"
runtime "com.gmongo:gmongo:1.3"
try to test with a simple query find(), it works well too
Now I want to combine 2 method and here is the error:
| Error 2014-05-13 17:52:07,197 [localhost-startStop-1] ERROR plugins.DefaultGrailsPluginManager - Error configuring dynamic methods for plugin [mongodb:3.0.1]: com/mongodb/AggregationOptions
Message: com/mongodb/AggregationOptions
Line | Method
->> 2531 | privateGetDeclaredMethods in java.lang.Class
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1855 | getDeclaredMethods in ''
| 46 | getLocked . . . . . . . . in org.codehaus.groovy.util.LazyReference
| 33 | get in ''
| 98 | createGormStaticApi . . . in org.grails.datastore.gorm.mongo.plugin.support.MongoMethodsConfigurer
| 65 | configure in org.grails.datastore.gorm.plugin.support.DynamicMethodsConfigurer
| 49 | configure . . . . . . . . in org.grails.datastore.gorm.mongo.plugin.support.MongoMethodsConfigurer
| 76 | doCall in MongodbGrailsPlugin$_closure2
| 262 | run . . . . . . . . . . . in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by ClassNotFoundException: com.mongodb.AggregationOptions
->> 366 | run in java.net.URLClassLoader$1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 355 | run in ''
| 354 | findClass . . . . . . . . in java.net.URLClassLoader
| 425 | loadClass in java.lang.ClassLoader
| 2531 | privateGetDeclaredMethods in java.lang.Class
| 1855 | getDeclaredMethods in ''
| 46 | getLocked . . . . . . . . in org.codehaus.groovy.util.LazyReference
| 33 | get in ''
| 98 | createGormStaticApi . . . in org.grails.datastore.gorm.mongo.plugin.support.MongoMethodsConfigurer
| 65 | configure in org.grails.datastore.gorm.plugin.support.DynamicMethodsConfigurer
| 49 | configure . . . . . . . . in org.grails.datastore.gorm.mongo.plugin.support.MongoMethodsConfigurer
| 76 | doCall in MongodbGrailsPlugin$_closure2
| 262 | run . . . . . . . . . . . in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
I don't know how to fix it actually!
Mongodb Plugin is a wrapper over GMongo with the power of GORM features. You can definitely use GMongo or lower level API directly from the plugin instead of adding those dependencies explicitly.
Have a look at the build.gradle where they are included. Most likely the error is due to conflicting dependencies when both of them are used simultaneously.
I'm new to Grails. I'm trying to connect postgresql 9.0 database server with grails 2.3.4. I have added postgresql-9.0-801.jdbc3.jar file into the lib folder of grails application.When i'm running the application on Intellij editor then getting following error.
Where i'm doing wrong?
|Running Grails application Error | 2013-12-08 18:44:55,837 [localhost-startStop-1] ERROR pool.ConnectionPool - Unable to create initial connections of pool. Message: Driver:org.postgresql.Driver#7c3b99 returned null for URL:jdbc:postgres://localhost/clientpro Line | Method ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
| 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Error | 2013-12-08 18:44:55,877 [localhost-startStop-1] ERROR pool.ConnectionPool - Unable to create initial connections of pool. Message: Driver:org.postgresql.Driver#1ab5d6d returned null for URL:jdbc:postgres://localhost/clientpro Line | Method ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
| 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Error | 2013-12-08 18:44:56,160 [localhost-startStop-1] ERROR pool.ConnectionPool - Unable to create initial connections of pool. Message: Driver:org.postgresql.Driver#6bf551 returned null for URL:jdbc:postgres://localhost/clientpro Line | Method ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
| 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Error | 2013-12-08 18:44:56,174 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error initializing the application: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'lobHandlerDetector' while setting bean property 'lobHandler'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lobHandlerDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: Driver:org.postgresql.Driver#6bf551 returned null for URL:jdbc:postgres://localhost/clientpro Message: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'lobHandlerDetector' while setting bean property 'lobHandler'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lobHandlerDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: Driver:org.postgresql.Driver#6bf551 returned null for URL:jdbc:postgres://localhost/clientpro Line | Method ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
| 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Caused by BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'lobHandlerDetector' while setting bean property 'lobHandler'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lobHandlerDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: Driver:org.postgresql.Driver#6bf551 returned null for URL:jdbc:postgres://localhost/clientpro ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
| 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Caused by BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'lobHandlerDetector' while setting bean property 'lobHandler'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lobHandlerDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: Driver:org.postgresql.Driver#6bf551 returned null for URL:jdbc:postgres://localhost/clientpro ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
| 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Caused by BeanCreationException: Error creating bean with name 'lobHandlerDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: Driver:org.postgresql.Driver#6bf551 returned null for URL:jdbc:postgres://localhost/clientpro ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
| 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Caused by MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: Driver:org.postgresql.Driver#6bf551 returned null for URL:jdbc:postgres://localhost/clientpro ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
| 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Caused by SQLException: Driver:org.postgresql.Driver#6bf551 returned null for URL:jdbc:postgres://localhost/clientpro ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
| 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Error | Forked Grails VM exited with error Process finished with exit code 1
DataSource file :-
dataSource {
pooled = true
driverClassName = "org.postgresql.Driver"
dialect = org.hibernate.dialect.PostgreSQLDialect
username = "postgres"
password = "password"
}
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = true
cache.provider_class='org.hibernate.cache.EhCacheProvider'
}
// environment specific settings
environments {
development {
dataSource {
dbCreate = "update"
url = "jdbc:postgres://localhost/clientpro"
username = "postgres"
password = "password"
}
}
test {
dataSource {
dbCreate = "update"
url = "jdbc:postgres://localhost/clientpro"
username = "postgres"
password = "password"
}
}
production {
dataSource {
dbCreate = "update"
url = "jdbc:postgres://localhost/clientpro"
username = "postgres"
password = "password"
}
}
}
Try with a different prefix:
url = "jdbc:postgresql://localhost/clientpro"
I create a new grails app and do grails install-plugin rest. App builds. Now I add exactly the example from the plugin page: http://grails.org/plugin/rest into the bootstrap and have:
import l2http.*
class BootStrap {
def init = { servletContext ->
withHttp(uri: "http://www.google.com") {
def html = get(path : '/search', query : [q:'Groovy'])
assert html.HEAD.size() == 1
assert html.BODY.size() == 1
}
}
def destroy = {
}
}
This crashes with the following error:
| Loading Grails 2.0.0
| Configuring classpath.
| Environment set to development.....
| Packaging Grails application.....
| Compiling 1 source files.....
| Running Grails application
| Error 2012-03-26 11:41:07,823 [Thread-8] ERROR context.GrailsContextLoader - Error executing bootstraps: groovy.lang.MissingMethodException: No signature of method: grails.util.Environment.withHttp() is applicable for argument types: (java.util.LinkedHashMap, BootStrap$_closure1_closure3) values: [[uri:http://www.google.com], BootStrap$_closure1_closure3#299cc074]
Message: groovy.lang.MissingMethodException: No signature of method: grails.util.Environment.withHttp() is applicable for argument types: (java.util.LinkedHashMap, BootStrap$_closure1_closure3) values: [[uri:http://www.google.com], BootStrap$_closure1_closure3#299cc074]
Line | Method
->> 290 | evaluateEnvironmentSpecificBlock in grails.util.Environment
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 283 | executeForEnvironment in ''
| 259 | executeForCurrentEnvironment . . in ''
| 334 | innerRun in java.util.concurrent.FutureTask$Sync
| 166 | run . . . . . . . . . . . . . . in java.util.concurrent.FutureTask
| 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 603 | run . . . . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run in java.lang.Thread
Caused by MissingMethodException: No signature of method: grails.util.Environment.withHttp() is applicable for argument types: (java.util.LinkedHashMap, BootStrap$_closure1_closure3) values: [[uri:http://www.google.com], BootStrap$_closure1_closure3#299cc074]
->> 345 | methodMissing in grails.util.Environment$EnvironmentBlockEvaluator
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 4 | doCall in BootStrap$_closure1
| 290 | evaluateEnvironmentSpecificBlock in grails.util.Environment
| 283 | executeForEnvironment in ''
| 259 | executeForCurrentEnvironment . . in ''
| 334 | innerRun in java.util.concurrent.FutureTask$Sync
| 166 | run . . . . . . . . . . . . . . in java.util.concurrent.FutureTask
| 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 603 | run . . . . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run in java.lang.Thread
The withHttp or any method added by the rest-plugin is injected to the Controllers and Services not to the BootStrap class. Please try it within Services or Controllers.
Cheers.
Bernardo