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

Incompatible with JPMS #569

Open
micheljung opened this issue Mar 21, 2024 · 1 comment
Open

Incompatible with JPMS #569

micheljung opened this issue Mar 21, 2024 · 1 comment
Assignees
Labels
type: bug A general bug

Comments

@micheljung
Copy link

micheljung commented Mar 21, 2024

Same issue as in: spring-projects/spring-data-mongodb#4237

Reproducer: https://github.com/micheljung/spring-data-keyvalue-569

@SpringBootApplication
@EnableMapRepositories
class DemoApplication

fun main(args: Array<String>) {
    val context = runApplication<DemoApplication>(*args)
}

interface WebsiteRepository : CrudRepository<Website, String>

@KeySpace("website")
data class Website(
    @Id
    val id: String,
    val url: URL,
)

Output:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'websiteRepository' defined in com.example.demo.WebsiteRepository defined in @EnableMapRepositories declared on DemoApplication: Unable to make field private java.lang.String java.net.URL.protocol accessible: module java.base does not "opens java.net" to unnamed module @139982de
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1786) ~[spring-beans-6.1.5.jar:6.1.5]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:600) ~[spring-beans-6.1.5.jar:6.1.5]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522) ~[spring-beans-6.1.5.jar:6.1.5]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.1.5.jar:6.1.5]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.5.jar:6.1.5]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.1.5.jar:6.1.5]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.1.5.jar:6.1.5]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:969) ~[spring-beans-6.1.5.jar:6.1.5]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:962) ~[spring-context-6.1.5.jar:6.1.5]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:624) ~[spring-context-6.1.5.jar:6.1.5]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-3.2.4.jar:3.2.4]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[spring-boot-3.2.4.jar:3.2.4]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:334) ~[spring-boot-3.2.4.jar:3.2.4]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354) ~[spring-boot-3.2.4.jar:3.2.4]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-3.2.4.jar:3.2.4]
	at com.example.demo.DemoApplicationKt.main(DemoApplication.kt:27) ~[main/:na]
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private java.lang.String java.net.URL.protocol accessible: module java.base does not "opens java.net" to unnamed module @139982de
	at java.base/java.lang.reflect.AccessibleObject.throwInaccessibleObjectException(AccessibleObject.java:391) ~[na:na]
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:367) ~[na:na]
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:315) ~[na:na]
	at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:183) ~[na:na]
	at java.base/java.lang.reflect.Field.setAccessible(Field.java:177) ~[na:na]
	at org.springframework.util.ReflectionUtils.makeAccessible(ReflectionUtils.java:804) ~[spring-core-6.1.5.jar:6.1.5]
	at org.springframework.data.mapping.context.AbstractMappingContext$PersistentPropertyCreator.doWith(AbstractMappingContext.java:572) ~[spring-data-commons-3.2.4.jar:3.2.4]
	at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:728) ~[spring-core-6.1.5.jar:6.1.5]
	at org.springframework.data.mapping.context.AbstractMappingContext.doAddPersistentEntity(AbstractMappingContext.java:427) ~[spring-data-commons-3.2.4.jar:3.2.4]
	at org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:383) ~[spring-data-commons-3.2.4.jar:3.2.4]
	at org.springframework.data.mapping.context.AbstractMappingContext$PersistentPropertyCreator.lambda$createAndRegisterProperty$3(AbstractMappingContext.java:627) ~[spring-data-commons-3.2.4.jar:3.2.4]
	at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
	at org.springframework.data.mapping.context.AbstractMappingContext$PersistentPropertyCreator.createAndRegisterProperty(AbstractMappingContext.java:624) ~[spring-data-commons-3.2.4.jar:3.2.4]
	at org.springframework.data.mapping.context.AbstractMappingContext$PersistentPropertyCreator.doWith(AbstractMappingContext.java:578) ~[spring-data-commons-3.2.4.jar:3.2.4]
	at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:728) ~[spring-core-6.1.5.jar:6.1.5]
	at org.springframework.data.mapping.context.AbstractMappingContext.doAddPersistentEntity(AbstractMappingContext.java:427) ~[spring-data-commons-3.2.4.jar:3.2.4]
	at org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:383) ~[spring-data-commons-3.2.4.jar:3.2.4]
	at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:279) ~[spring-data-commons-3.2.4.jar:3.2.4]
	at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:205) ~[spring-data-commons-3.2.4.jar:3.2.4]
	at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:92) ~[spring-data-commons-3.2.4.jar:3.2.4]
	at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$6(RepositoryFactoryBeanSupport.java:282) ~[spring-data-commons-3.2.4.jar:3.2.4]
	at java.base/java.util.Optional.ifPresent(Optional.java:178) ~[na:na]
	at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:282) ~[spring-data-commons-3.2.4.jar:3.2.4]
	at org.springframework.data.keyvalue.repository.support.KeyValueRepositoryFactoryBean.afterPropertiesSet(KeyValueRepositoryFactoryBean.java:123) ~[spring-data-keyvalue-3.2.4.jar:3.2.4]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1833) ~[spring-beans-6.1.5.jar:6.1.5]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1782) ~[spring-beans-6.1.5.jar:6.1.5]
	... 15 common frames omitted
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 21, 2024
@christophstrobl christophstrobl self-assigned this Mar 25, 2024
@christophstrobl christophstrobl added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 25, 2024
@christophstrobl
Copy link
Member

I think the key-value module should not try to inspect anything coming from the java. namespace.

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

No branches or pull requests

3 participants