groovy - Clojure 1.2.1/1.3/1.4 'proxy generated in Grails 2.0.0 runtime fails. 1.2.0 is fine

I'm working on extending the Grails Clojure plugin in Grails 2.0.0 (and 2.1.0-SNAPSHOT) and I wanted to update it to Clojure 1.3.0 and add Clojure throws an exception during compilation of a proxy of a ByteArrayOutputStream in's log-stream function: ClassCastException: clojure.asm.Type cannot be cast to clojure.lang.IFn( )I went and removed and wrote a stripped down proxy of Object: (proxy [java.lang.Object] [] (toString [] "proxy's t...Read more

groovy - Grails - multiple belongsTo of same class with cascading deletion

This one is for the Grails users here. I asked it on the grails - user mailing list, but I figured since I've been fighting this for a couple of days I should cast as wide a net as possible.I'm having some difficulty with trying to model relationships between twoobjects of the same type in another object (different type) referencing thetwo objects.As an example of what I'm trying to do, supposeyou're modeling relationships among family members. Any given relationship"belongsTo" two different family members. So:class Person { hasMany[relati...Read more

groovy - Grails issue with unique/save/update

I'm having an issue with grails. I have a domain that looks like:class Book { static belongsTo = Author String toString() { title } Author bookAuthor String title String currentPage static constraints = { bookAuthor() title(unique:true) currentPage() }}The main thing to note is that I have title(unique:true) to avoid from adding the same book twice. However, this is causing issues. In the controller I have created:def populate = { def bookInstance = new Book() def dir = 'C:/currentBooks.txt' de...Read more

groovy - GORM issues with Grails 2.0.M1

I'm having trouble with my domain object saving when I have a complex relationship. the offending class NativeEntryEntityPersister is in the jar grails-datastore-core-1.0.0.M7.jar. Does anybody know where I could get a hold of the sources for this?My grails installation's src folder doesn't have the sources....Read more

groovy - Grails data not saving

In the basic CRUD model, from the create view, I have the following code to save an item:println paramsdef newItem = new ProgressItem(name:, comment: params.comment, status: params.status, itemsGroup: params.itemsGroup); //add itemsGroup: based on'project', action:'show', //change '1'But it doesn't work, that is, when I am back at the project page there isn't another progress item added. Here are the params that print out:[status:FAILED, name:FF FF FF FF FF FF ...Read more

groovy - Specifying implementation at deploy time in grails

This issue specifically stems from specifying an XMLOutputFactory implementation in a grails app, but I was looking for a more generic grails way to do this. So here goes.In our grails app, we use the XMLOutputFactory to build XMLWriters that render out documents. Now the XMLOutputFactory implementation that we were looking for is present in the Sun's implementation of this class which is So to use this, we added it as a system property in Glassfish, which we use as our app server and that works...Read more

groovy - Grails .save(flush: true) behaves the same with .save()

we have been testing a different way of saving. However, the results weren't as we expected. We have create-survey method, and each survey has multiple questions. We tested few cases and they all committed the queries the same way. @Transactional class Service { Survey createNewSurvey(NewSurveyCommand command) { Survey survey = new Survey()[] = true, failOnError: true) //save survey and flush for (NewQuestionCommand questionCommand : command.questions) { ...Read more

grails - How would I overwrite a method in a taglib bean?

I am trying to migrate the grails-timezone-detection grails plugin to Grails 3.In the original code there is the following method:private def getDefaultFormTagLib() { return grailsApplication.mainContext.getBean('org.codehaus.groovy.grails.plugins.web.taglib.FormTagLib')}I rewrote it as follows:private def getDefaultFormTagLib() { return grailsApplication.mainContext.getBean('org.grails.plugins.web.taglib.FormTagLib')}Running the test, I get the following error:org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named...Read more

Grails 3 Cookie plugin not found

I want to use the Grails 3 Cookie plugin ( In my build.gradle I have these entries here:repositories { mavenLocal() maven { url "" } mavenCentral()}dependencies { [...] compile 'org.grails.plugins:grails-cookie:2.0.5' [...]}But when running gradle build, he's got problems looking up that dependency:> Could not resolve all dependencies for configuration ':runtime'. > Could not find org.grails.plugins:grails-cookie:2.0.5. Searched...Read more

grails - How to test with DomainUnitTest when multiTenancy

How do test domain classes when I use multiTenancy?I can see that I need to extend with HibernateSpec and overwrite getConfiguration.This goes okay when I use ServiceUnitTest but not for DomainUnitTestSimple example:application.yml is setup with:grails: gorm: multiTenancy: mode: DISCRIMINATOR tenantResolverClass: security.CompanyTenantResolverMy test:class TestSpec extends HibernateSpec implements DomainUnitTest<Test>{ void "expect ok test"() { expect: true } def setup() { Syst...Read more

gorm - Grails throw exertion when I use MultiTenant on domain file

When I doing below example which ends up in a exception: I have tried to copy paste the build.gradle file and application.yml from original project in the example. I can really not figure out why exception? I am using grails Version 3.3.2I narrowed the error down to if I remove MultiTenant it works,class Address implements MultiTenant<Address> { String street static constraints = { street nullable: false, blank: false }}Log:Con...Read more

grails - How to use datasoure in ng2-ya-table?

In the documentation of ng2-ya-table the datasource function is written in this way :public datasource: any = (request: any): Observable<any> => {return this.service.getUsers(request);}And used like this :<ng2-ya-table [options]="options" [columns]="columns" [datasource]="datasource" [paging]="paging"></ng2-ya-table>I don't want to use this function in this way because I have static data = [ { name: 'Patricia', email: '', username: 'Yes', }, { name: 'Chelsey Diet...Read more

groovy - Grails Mocking: Supply any argument to demand closure

I have a service that I'm trying to test. Inside this service is another UserAPIService that I want to mock. To mock it I'm doing the following: given: def userAPIServiceMock = mockFor(UserAPIService) userAPIServiceMock.demand.createUser { def apiToken, firstname, lastname, email -> return true } service.userAPIService = userAPIServiceMock.createMock()In the demand closure, I don't really care what arguments are passed to the createUser method. Is there a way I can say "regardless of the arguments passed to the createUser met...Read more

grails - hystrix Fallback is not getting called for invidiual Item in Collection

I had to call falback for each item in the list in case of any error and continue processing other items, is it possible?@Subscriber('dupe-user-check')@HystrixCommand(fallbackMethod = "subscriptionSearchFallback")void duplicateUserCheck(Object payload) {// call to other microservice//Validate response and see if user already exist for this item//If yesthrow new DuplicateUserException("User Already Exist. Response Payload ${response.json.toString()}").........................................................}void subsc...Read more

grails - Method arguments with and without def keyword

Suppose we have the following method:def myMethodWithParameters(param1, def param2, Object param3) { ...}What are the differences between using the def keyword and using Object as type for an argument?What are the differences between using the def keyword and not using any type/keyword for an argument?What I know so far and does not completely answer the question:def keyword is used to allow dynamic types.So you can even put an Object[] in it.def keyword can be used to make variables available only in current scope instead of globally...Read more