Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to marshall domain instance Reference #178

Open
nazarchaparov opened this issue Jul 31, 2022 · 0 comments
Open

Failed to marshall domain instance Reference #178

nazarchaparov opened this issue Jul 31, 2022 · 0 comments

Comments

@nazarchaparov
Copy link

nazarchaparov commented Jul 31, 2022

Hello,
I have 3 domain classes:

class Song extends AuditSection implements Serializable {

	static searchable = {
        artist reference: true
        songArtists component: true
    }
	
	Artist artist

	static hasMany = [songArtists: SongArtist]
					  
}

class SongArtist implements Serializable {

	static searchable = {
        only = ["artist", "sortOrder"]
        root false
        artist reference: true
    }
	
	Artist artist
    Song song
    Integer sortOrder

}

class Artist extends AuditSection implements Serializable {

	static searchable = {
		except = ["songArtists", "songs"]
	}
	
	static hasMany = [songArtists: SongArtist, songs: Song]

}

When I index the main song class I get an error (i think, plugin incorrectly finds the ref class) :
`2022-07-31 13:40:33.789 ERROR --- [nio-8282-exec-4] g.p.e.index.IndexRequestQueue : Error Indexing class com.tm.aydym.Song (index: com.tm.aydym.song_write , type: song) of id 9529

grails.plugins.elasticsearch.exception.IndexException: Failed to marshall domain instance [Ömrüme (ýyldyz artistler toplumy)]
Caused by: java.lang.AssertionError: Marshalled object com.tm.aydym.artist.SongArtist : 730429 is not [class com.tm.aydym.artist.Artist].. Expression: refClass.isAssignableFrom(object.getClass())
at org.codehaus.groovy.runtime.InvokerHelper.assertFailed(InvokerHelper.java:422)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.assertFailed(ScriptBytecodeAdapter.java:663)
at grails.plugins.elasticsearch.conversion.marshall.SearchableReferenceMarshaller.doMarshall(SearchableReferenceMarshaller.groovy:37)
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:498)`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant