gpt4 book ai didi

java - 如何在代码中查找语义格式错误的参数化类型的位置。 JBoss Weld 抛出 java.lang.reflect.MalformedParameterizedTypeException

转载 作者:太空宇宙 更新时间:2023-11-04 06:36:54 27 4
gpt4 key购买 nike

显然,我在代码中的某处放置了格式错误的参数化类型,但位置未知,因为我的 IDE 未生成警告,并且堆栈跟踪未显示遇到错误的位置。任何有关如何进行的建议将不胜感激。我被难住了。

11:04:14,476 WARN  [org.jboss.weld.Event] (MSC service thread 1-3) WELD-000411: Observer method [BackedAnnotatedMethod] public org.omnifaces.VetoAnnotatedTypeExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.  
11:04:14,479 DEBUG [org.jboss.weld.deployer] (MSC service thread 1-3) Discovered SYNTHETIC BeanDeploymentArchive (org.jboss.resteasy.resteasy-cdi:main.additionalClasses)
11:04:14,481 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-3) WELD-000106: Bean: Built-in Bean [javax.enterprise.inject.spi.BeanManager] with qualifiers [@Default]
11:04:14,481 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-3) WELD-000106: Bean: Built-in Bean [org.jboss.weld.manager.BeanManagerImpl] with qualifiers [@Default]
11:04:14,493 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-3) WELD-000106: Bean: Extension [class org.jboss.resteasy.cdi.ResteasyCdiExtension] with qualifiers [@Default]; application.war
11:04:14,494 DEBUG [org.jboss.weld.deployer] (MSC service thread 1-3) Discovered SYNTHETIC BeanDeploymentArchive (org.hibernate.validator.cdi:main.additionalClasses)
11:04:14,495 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-3) WELD-000106: Bean: Built-in Bean [javax.enterprise.inject.spi.BeanManager] with qualifiers [@Default]
11:04:14,495 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-3) WELD-000106: Bean: Built-in Bean [org.jboss.weld.manager.BeanManagerImpl] with qualifiers [@Default]
11:04:14,504 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-3) WELD-000106: Bean: Extension [class org.hibernate.validator.internal.cdi.ValidationExtension] with qualifiers [@Default]; application.war
11:04:14,509 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-3) WELD-000106: Bean: Extension [class com.sun.faces.flow.FlowDiscoveryCDIExtension] with qualifiers [@Default]; application.war
11:04:14,512 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-3) WELD-000106: Bean: Extension [class com.sun.faces.application.view.ViewScopeExtension] with qualifiers [@Default]; application.war
11:04:14,513 DEBUG [org.jboss.weld.deployer] (MSC service thread 1-3) Discovered SYNTHETIC BeanDeploymentArchive (org.jberet.jberet-core:main.additionalClasses)
11:04:14,514 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-3) WELD-000106: Bean: Built-in Bean [javax.enterprise.inject.spi.BeanManager] with qualifiers [@Default]
11:04:14,514 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-3) WELD-000106: Bean: Built-in Bean [org.jboss.weld.manager.BeanManagerImpl] with qualifiers [@Default]
11:04:14,516 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-3) WELD-000106: Bean: Extension [class org.jberet.creation.BatchCDIExtension] with qualifiers [@Default]; application.war
11:04:14,520 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-3) WELD-000106: Bean: Extension [class org.omnifaces.cdi.eager.EagerExtension] with qualifiers [@Default]; application.war
11:04:14,521 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-3) WELD-000106: Bean: Built-in Bean [javax.enterprise.inject.spi.BeanManager] with qualifiers [@Default]
11:04:14,521 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-3) WELD-000106: Bean: Built-in Bean [org.jboss.weld.manager.BeanManagerImpl] with qualifiers [@Default]
11:04:15,712 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.deployment.unit."application.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."application.war".WeldStartService: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_05]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_05]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_05]
Caused by: java.lang.reflect.MalformedParameterizedTypeException
at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.validateConstructorArguments(ParameterizedTypeImpl.java:58) [rt.jar:1.8.0_05]
at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.<init>(ParameterizedTypeImpl.java:51) [rt.jar:1.8.0_05]
at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.make(ParameterizedTypeImpl.java:92) [rt.jar:1.8.0_05]
at sun.reflect.generics.factory.CoreReflectionFactory.makeParameterizedType(CoreReflectionFactory.java:105) [rt.jar:1.8.0_05]
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:140) [rt.jar:1.8.0_05]
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49) [rt.jar:1.8.0_05]
at sun.reflect.generics.repository.ConstructorRepository.getParameterTypes(ConstructorRepository.java:94) [rt.jar:1.8.0_05]
at java.lang.reflect.Executable.getGenericParameterTypes(Executable.java:279) [rt.jar:1.8.0_05]
at java.lang.reflect.Method.getGenericParameterTypes(Method.java:268) [rt.jar:1.8.0_05]
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedMethod.initParameters(BackedAnnotatedMethod.java:44)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedMethod.initParameters(BackedAnnotatedMethod.java:27)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedCallable.<init>(BackedAnnotatedCallable.java:34)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedMethod.<init>(BackedAnnotatedMethod.java:38)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedMethod.of(BackedAnnotatedMethod.java:32)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedMethods.computeValue(BackedAnnotatedType.java:193)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedMethods.computeValue(BackedAnnotatedType.java:186)
at org.jboss.weld.util.LazyValueHolder.get(LazyValueHolder.java:35)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$EagerlyInitializedLazyValueHolder.<init>(BackedAnnotatedType.java:154)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedMethods.<init>(BackedAnnotatedType.java:186)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedMethods.<init>(BackedAnnotatedType.java:186)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType.<init>(BackedAnnotatedType.java:66)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType.of(BackedAnnotatedType.java:47)
at org.jboss.weld.resources.ClassTransformer$TransformClassToBackedAnnotatedType.load(ClassTransformer.java:83)
at org.jboss.weld.resources.ClassTransformer$TransformClassToBackedAnnotatedType.load(ClassTransformer.java:80)
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524)
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317)
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280)
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195)
at com.google.common.cache.LocalCache.get(LocalCache.java:3934)
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938)
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821)
at org.jboss.weld.util.cache.LoadingCacheUtils.getCacheValue(LoadingCacheUtils.java:52)
at org.jboss.weld.util.cache.LoadingCacheUtils.getCastCacheValue(LoadingCacheUtils.java:80)
at org.jboss.weld.resources.ClassTransformer.getBackedAnnotatedType(ClassTransformer.java:175)
at org.jboss.weld.resources.ClassTransformer.getBackedAnnotatedType(ClassTransformer.java:194)
at org.jboss.weld.bootstrap.BeanDeployer.loadAnnotatedType(BeanDeployer.java:119)
at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:96)
at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$1.doWork(ConcurrentBeanDeployer.java:62)
at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$1.doWork(ConcurrentBeanDeployer.java:60)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53)
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [rt.jar:1.8.0_05]
... 3 more

11:04:15,744 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 2) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "application.war")]) - failure description: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"application.war\".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"application.war\".WeldStartService: Failed to start service
Caused by: java.lang.reflect.MalformedParameterizedTypeException"}}
11:04:15,760 ERROR [org.jboss.as.server] (management-handler-thread - 2) JBAS015870: Deploy of deployment "application.war" was rolled back with the following failure message:
{"JBAS014671: Failed services" => {"jboss.deployment.unit.\"application.war\".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"application.war\".WeldStartService: Failed to start service
Caused by: java.lang.reflect.MalformedParameterizedTypeException"}}
11:04:15,792 DEBUG [org.wildfly.jberet] (MSC service thread 1-7) Removing batch environment; ModuleClassLoader for Module "deployment.application.war:main" from Service Module Loader
11:04:15,816 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 25) JBAS011410: Stopping Persistence Unit (phase 2 of 2) Service 'application.war#primary'
11:04:15,817 DEBUG [org.hibernate.internal.SessionFactoryImpl] (ServerService Thread Pool -- 25) HHH000031: Closing
11:04:15,817 DEBUG [org.hibernate.cache.infinispan.InfinispanRegionFactory] (ServerService Thread Pool -- 25) Stop region factory
11:04:15,817 DEBUG [org.hibernate.cache.infinispan.InfinispanRegionFactory] (ServerService Thread Pool -- 25) Clear region references
11:04:15,840 INFO [org.infinispan.factories.GlobalComponentRegistry] (ServerService Thread Pool -- 25) ISPN000128: Infinispan version: Infinispan 'Infinium' 6.0.2.Final
11:04:16,177 DEBUG [org.infinispan.interceptors.InterceptorChain] (ServerService Thread Pool -- 25) Interceptor chain size: 6
11:04:16,177 DEBUG [org.infinispan.interceptors.InterceptorChain] (ServerService Thread Pool -- 25) Interceptor chain is:
>> org.infinispan.interceptors.InvocationContextInterceptor
>> org.infinispan.interceptors.CacheMgmtInterceptor
>> org.infinispan.interceptors.NotificationInterceptor
>> org.infinispan.interceptors.locking.NonTransactionalLockingInterceptor
>> org.infinispan.interceptors.EntryWrappingInterceptor
>> org.infinispan.interceptors.CallInterceptor
11:04:16,183 DEBUG [org.infinispan.jmx.JmxUtil] (ServerService Thread Pool -- 25) Object name jboss.infinispan:type=Cache,name="local-query(local)",manager="hibernate",component=Cache already registered
11:04:16,184 INFO [org.infinispan.jmx.CacheJmxRegistration] (ServerService Thread Pool -- 25) ISPN000031: MBeans were successfully registered to the platform MBean server.
11:04:16,190 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 25) JBAS010281: Started local-query cache from hibernate container
11:04:16,192 DEBUG [org.infinispan.CacheImpl] (ServerService Thread Pool -- 25) Started cache local-query on null
11:04:16,200 DEBUG [org.hibernate.service.internal.AbstractServiceRegistryImpl] (ServerService Thread Pool -- 25) Implicitly destroying ServiceRegistry on de-registration of all child ServiceRegistries
11:04:16,200 DEBUG [org.hibernate.boot.registry.internal.BootstrapServiceRegistryImpl] (ServerService Thread Pool -- 25) Implicitly destroying Boot-strap registry on de-registration of all child ServiceRegistries
11:04:16,201 DEBUG [org.hibernate.jpa.internal.EntityManagerFactoryRegistry] (ServerService Thread Pool -- 25) Remove: name=application.war#primary
11:04:16,202 INFO [org.jboss.weld.deployer] (MSC service thread 1-3) JBAS016009: Stopping weld service for deployment application.war
11:04:16,297 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 25) JBAS011410: Stopping Persistence Unit (phase 1 of 2) Service 'application.war#primary'
11:04:16,302 DEBUG [org.jboss.as.clustering.infinispan.subsystem] (ServerService Thread Pool -- 25) local-query cache configuration stopped
11:04:16,301 DEBUG [org.jboss.as.clustering.infinispan.subsystem] (ServerService Thread Pool -- 22) timestamps cache configuration stopped
11:04:16,302 DEBUG [org.jboss.as.clustering.infinispan.subsystem] (ServerService Thread Pool -- 24) entity cache configuration stopped
11:04:16,303 DEBUG [org.infinispan.manager.DefaultCacheManager] (MSC service thread 1-4) Stopping cache manager ISPN on null
11:04:16,306 DEBUG [org.infinispan.CacheImpl] (MSC service thread 1-4) Stopping cache local-query on null
11:04:16,309 DEBUG [org.infinispan.transaction.TransactionTable] (MSC service thread 1-4) Wait for on-going transactions to finish for 30 seconds.
11:04:16,310 DEBUG [org.infinispan.transaction.TransactionTable] (MSC service thread 1-4) All transactions terminated
11:04:16,311 INFO [org.jboss.as.clustering.infinispan] (MSC service thread 1-4) JBAS010282: Stopped local-query cache from hibernate container
11:04:16,317 DEBUG [org.jboss.as.clustering.infinispan.subsystem] (MSC service thread 1-4) hibernate cache container stopped
11:04:16,330 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015877: Stopped deployment application.war (runtime-name: application.war) in 555ms

更新:

MalformedParameterizedTypeException 是

"Thrown when a semantically malformed parameterized type is encountered by a reflective method that needs to instantiate it. For example, if the number of type arguments to a parameterized type is wrong."

最佳答案

我已经不在了。我的代码完全没有问题。问题是我的项目有一个与服务器上安装的 JEE 模块不兼容的依赖项。

<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>

<!--
scope=compile prevents
Warning:java: Cannot find annotation method 'max()' in type 'javax.validation.constraints.Size':
class file for javax.validation.constraints.Size not found
-->
<scope>compile</scope>

</dependency>

当编译时 Intellij(但不是 Maven)开始发出警告(例如上面的警告)时,问题就开始了。以下更改消除了 MalformedParameterizedTypeException 问题,但重新引入了烦人的 Intellij 警告。

<scope>provided</scope>

JetBrains 支持人员在其错误跟踪器中创建了一个新问题:http://youtrack.jetbrains.com/issue/IDEA-127569

关于java - 如何在代码中查找语义格式错误的参数化类型的位置。 JBoss Weld 抛出 java.lang.reflect.MalformedParameterizedTypeException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25268550/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com