I am trying to access an ejb that is exposed in jbossAS7.1 from code running in an embedded jetty server:
final Properties jndiProperties = new Properties();
jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
jndiProperties.put(Context.PROVIDER_URL, "remote://127.0.0.1:4447");
jndiProperties.put("jboss.naming.client.ejb.context", true);
jndiProperties.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");
jndiProperties.put(Context.SECURITY_PRINCIPAL, "ubiant");
jndiProperties.put(Context.SECURITY_CREDENTIALS, "ubiant2iA");
ctx = new InitialContext(jndiProperties);
Object b = ctx.lookup("ejb:Hemis/HemisCoreClient//" + "HardwareDataManagement" + "!" + "com.ubiant.hemis.client.ejb.interf.I_HardwareDataManagement");
But I am getting this exception:
"EJB client context selector may not be changed"
Could someone help me with this ?
Here the full stacktrace:
11:17:43,003 ERROR [stderr] (qtp10117087-119)
javax.naming.NamingException: Failed to create remoting connection
[Root exception is java.lang.RuntimeException: Failed to setup EJB
remote context]
11:17:43,011 ERROR [stderr] (qtp10117087-119) at
org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:36)
11:17:43,011 ERROR [stderr] (qtp10117087-119) at
org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:121)
11:17:43,012 ERROR [stderr] (qtp10117087-119) at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)
11:17:43,012 ERROR [stderr] (qtp10117087-119) at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)
11:17:43,012 ERROR [stderr] (qtp10117087-119) at
javax.naming.InitialContext.init(InitialContext.java:242)
11:17:43,012 ERROR [stderr] (qtp10117087-119) at
javax.naming.InitialContext.(InitialContext.java:216)
11:17:43,012 ERROR [stderr] (qtp10117087-119) at
authentification.TokenAuthentificationBroker.addConnection(TokenAuthentificationBroker.java:86)
11:17:43,012 ERROR [stderr] (qtp10117087-119) at
org.apache.activemq.broker.MutableBrokerFilter.addConnection(MutableBrokerFilter.java:97)
11:17:43,012 ERROR [stderr] (qtp10117087-119) at
org.apache.activemq.broker.TransportConnection.processAddConnection(TransportConnection.java:733)
11:17:43,012 ERROR [stderr] (qtp10117087-119) at
org.apache.activemq.broker.jmx.ManagedTransportConnection.processAddConnection(ManagedTransportConnection.java:79)
11:17:43,012 ERROR [stderr] (qtp10117087-119) at
org.apache.activemq.command.ConnectionInfo.visit(ConnectionInfo.java:139)
11:17:43,012 ERROR [stderr] (qtp10117087-119) at
org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:292)
11:17:43,012 ERROR [stderr] (qtp10117087-119) at
org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:149)
11:17:43,012 ERROR [stderr] (qtp10117087-119) at
org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83)
11:17:43,012 ERROR [stderr] (qtp10117087-119) at
org.apache.activemq.transport.ws.MQTTSocket.sendToActiveMQ(MQTTSocket.java:112)
11:17:43,012 ERROR [stderr] (qtp10117087-119) at
org.apache.activemq.transport.mqtt.MQTTProtocolConverter.sendToActiveMQ(MQTTProtocolConverter.java:133)
11:17:43,012 ERROR [stderr] (qtp10117087-119) at
org.apache.activemq.transport.mqtt.MQTTProtocolConverter.onMQTTConnect(MQTTProtocolConverter.java:235)
11:17:43,012 ERROR [stderr] (qtp10117087-119) at
org.apache.activemq.transport.mqtt.MQTTProtocolConverter.onMQTTCommand(MQTTProtocolConverter.java:157)
11:17:43,012 ERROR [stderr] (qtp10117087-119) at
org.apache.activemq.transport.ws.MQTTSocket.onMessage(MQTTSocket.java:59)
11:17:43,012 ERROR [stderr] (qtp10117087-119) at
org.eclipse.jetty.websocket.WebSocketConnectionRFC6455$WSFrameHandler.onFrame(WebSocketConnectionRFC6455.java:860)
11:17:43,012 ERROR [stderr] (qtp10117087-119) at
org.eclipse.jetty.websocket.WebSocketParserRFC6455.parseNext(WebSocketParserRFC6455.java:349)
11:17:43,012 ERROR [stderr] (qtp10117087-119) at
org.eclipse.jetty.websocket.WebSocketConnectionRFC6455.handle(WebSocketConnectionRFC6455.java:225)
11:17:43,012 ERROR [stderr] (qtp10117087-119) at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)
11:17:43,012 ERROR [stderr] (qtp10117087-119) at
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
11:17:43,012 ERROR [stderr] (qtp10117087-119) at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
11:17:43,012 ERROR [stderr] (qtp10117087-119) at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
11:17:43,012 ERROR [stderr] (qtp10117087-119) at
java.lang.Thread.run(Thread.java:745)
11:17:43,012 ERROR [stderr] (qtp10117087-119) Caused by:
java.lang.RuntimeException: Failed to setup EJB remote context
11:17:43,012 ERROR [stderr] (qtp10117087-119) at
org.jboss.naming.remote.client.InitialContextFactory.setupEjbContext(InitialContextFactory.java:438)
11:17:43,012 ERROR [stderr] (qtp10117087-119) at
org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:115)
11:17:43,012 ERROR [stderr] (qtp10117087-119) ... 25 more
11:17:43,012 ERROR [stderr] (qtp10117087-119) Caused by:
java.lang.reflect.InvocationTargetException
11:17:43,012 ERROR [stderr] (qtp10117087-119) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
11:17:43,012 ERROR [stderr] (qtp10117087-119) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
11:17:43,028 ERROR [stderr] (qtp10117087-119) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
11:17:43,028 ERROR [stderr] (qtp10117087-119) at
java.lang.reflect.Method.invoke(Method.java:606)
11:17:43,028 ERROR [stderr] (qtp10117087-119) at
org.jboss.naming.remote.client.InitialContextFactory.setupEjbContext(InitialContextFactory.java:420)
11:17:43,028 ERROR [stderr] (qtp10117087-119) ... 26 more
11:17:43,028 ERROR [stderr] (qtp10117087-119) Caused by:
java.lang.SecurityException: EJB client context selector may not be
changed
11:17:43,028 ERROR [stderr] (qtp10117087-119) at
org.jboss.ejb.client.EJBClientContext.setSelector(EJBClientContext.java:181)
11:17:43,028 ERROR [stderr] (qtp10117087-119) at
org.jboss.naming.remote.client.ejb.RemoteNamingEjbClientContextSelector.setupSelector(RemoteNamingEjbClientContextSelector.java:18)
11:17:43,028 ERROR [stderr] (qtp10117087-119) ... 31 more
According to https://developer.jboss.org/thread/273859, "Setting jboss.naming.client.ejb.context = true tries to create an EJB client context selector but it is already created for the JBoss EAP 6 instance," so "It is not possible to change the ejbSelector if the client run inside the [JBoss] server", as you're doing. The recommendation in that thread is to use the scoped-context feature (7.5.4. Using Scoped EJB Client Contexts) for a situation like yours.
BTW, I was thinking that the other approach that might work is to go back to doing a local (non-remote) lookup that relies on the fact that your code is ultimately running inside of JBoss, as you were originally trying to do in your first question (Get EJB object inside rar deployed inside jboss). But https://developer.jboss.org/thread/273428 say "You need to implement the Remote interface to be able to look it up from a different application ear/jar," so I think that's not a viable option, and the way you're approaching it (doing a remote invocation) sounds like the right approach.
EDIT 1, based on the comment on 6/23/2017:
Based on the "Pre-requisites of remotely accessible JNDI objects" section of https://docs.jboss.org/author/display/AS72/Remote+EJB+invocations+via+JNDI+-+EJB+client+API+or+remote-naming+project, EJBs are only remotely exposed when they satisfy two conditions:
1) Such objects should be bound under the java:jboss/exported/
namespace. For example, java:jboss/exported/foo/bar
2) Objects bound to the java:jboss/exported/ namespace are expected to be serializable.
This allows the objects to be sent over the wire to the remote clients
When I look at the logs showing EJBs being registered from your original question, I don't see anything to indicate that the EJB you're trying to access is being bound under the java:jboss/exported/ namespace. For the remote lookup to work, I think you'll also need to figure out how to bind your EJB under that namespace, in addition to using a scoped context.
Related
I have Alfresco Community Edition 5.2.
The project has been cloned from GitHub repository, and after that I cannot run it.
I am getting the following error at catalina.out file:
2023-02-02 13:16:49,623 ERROR [web.context.ContextLoader] [localhost-startStop-1] Context initialization failed
org.alfresco.error.AlfrescoRuntimeException: 01020049 Not all patches could be applied
at org.alfresco.repo.admin.patch.PatchExecuter.applyOutstandingPatches(PatchExecuter.java:118)
at org.alfresco.repo.admin.patch.PatchExecuter$1.doWork(PatchExecuter.java:131)
at org.alfresco.repo.admin.patch.PatchExecuter$1.doWork(PatchExecuter.java:1)
at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:555)
at org.alfresco.repo.admin.patch.PatchExecuter.onBootstrap(PatchExecuter.java:135)
at org.springframework.extensions.surf.util.AbstractLifecycleBean.onApplicationEvent(AbstractLifecycleBean.java:56)
at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEventInternal(SafeApplicationEventMulticaster.java:214)
at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEvent(SafeApplicationEventMulticaster.java:185)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:954)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:70)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Feb 02, 2023 1:16:49 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.alfresco.web.app.ContextLoaderListener
org.alfresco.error.AlfrescoRuntimeException: 01020049 Not all patches could be applied
at org.alfresco.repo.admin.patch.PatchExecuter.applyOutstandingPatches(PatchExecuter.java:118)
at org.alfresco.repo.admin.patch.PatchExecuter$1.doWork(PatchExecuter.java:131)
at org.alfresco.repo.admin.patch.PatchExecuter$1.doWork(PatchExecuter.java:1)
at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:555)
at org.alfresco.repo.admin.patch.PatchExecuter.onBootstrap(PatchExecuter.java:135)
at org.springframework.extensions.surf.util.AbstractLifecycleBean.onApplicationEvent(AbstractLifecycleBean.java:56)
at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEventInternal(SafeApplicationEventMulticaster.java:214)
at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEvent(SafeApplicationEventMulticaster.java:185)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:954)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:70)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
and this one also:
2023-02-02 13:16:48,818 ERROR [admin.patch.PatchExecuter] [localhost-startStop-1] 01020048 org.alfresco.error.AlfrescoRuntimeException: 01020047 Bootstrap failed
at org.alfresco.repo.importer.ImporterBootstrap.bootstrap(ImporterBootstrap.java:367)
at com.prodyna.adama.gas.patch.SiteReloadedPatch.applyInternalImpl(SiteReloadedPatch.java:388)
at com.prodyna.adama.gas.patch.SiteReloadedPatch.applyInternal(SiteReloadedPatch.java:269)
at org.alfresco.repo.admin.patch.AbstractPatch$1.execute(AbstractPatch.java:455)
at org.alfresco.repo.admin.patch.AbstractPatch$1.execute(AbstractPatch.java:1)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:464)
at org.alfresco.repo.admin.patch.AbstractPatch.applyWithTxns(AbstractPatch.java:462)
at org.alfresco.repo.admin.patch.AbstractPatch.access$0(AbstractPatch.java:442)
at org.alfresco.repo.admin.patch.AbstractPatch$4.doWork(AbstractPatch.java:620)
at org.alfresco.repo.admin.patch.AbstractPatch$4.doWork(AbstractPatch.java:1)
at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:555)
at org.alfresco.repo.admin.patch.AbstractPatch.apply(AbstractPatch.java:624)
at org.alfresco.repo.admin.patch.AbstractPatch.apply(AbstractPatch.java:586)
at org.alfresco.repo.admin.patch.PatchServiceImpl$PatchWork.applyPatch(PatchServiceImpl.java:564)
at org.alfresco.repo.admin.patch.PatchServiceImpl$PatchWork.execute(PatchServiceImpl.java:477)
at org.alfresco.repo.admin.patch.PatchServiceImpl.applyPatch(PatchServiceImpl.java:332)
at org.alfresco.repo.admin.patch.PatchServiceImpl.applyPatchAndDependencies(PatchServiceImpl.java:309)
at org.alfresco.repo.admin.patch.PatchServiceImpl.applyOutstandingPatches(PatchServiceImpl.java:198)
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)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy142.applyOutstandingPatches(Unknown Source)
at org.alfresco.repo.admin.patch.PatchExecuter.applyOutstandingPatches(PatchExecuter.java:83)
at org.alfresco.repo.admin.patch.PatchExecuter$1.doWork(PatchExecuter.java:131)
at org.alfresco.repo.admin.patch.PatchExecuter$1.doWork(PatchExecuter.java:1)
at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:555)
at org.alfresco.repo.admin.patch.PatchExecuter.onBootstrap(PatchExecuter.java:135)
at org.springframework.extensions.surf.util.AbstractLifecycleBean.onApplicationEvent(AbstractLifecycleBean.java:56)
at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEventInternal(SafeApplicationEventMulticaster.java:214)
at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEvent(SafeApplicationEventMulticaster.java:185)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:954)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:70)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.alfresco.service.cmr.view.ImporterException: Failed to import package at line 487; column 75 due to error: Namespace URI http://www.adama.com/model/adamaStudyNotification/1.0 has not been defined in the Repository dictionary
at org.alfresco.repo.importer.view.ViewParser.parse(ViewParser.java:201)
at org.alfresco.repo.importer.ImporterComponent.parserImport(ImporterComponent.java:430)
at org.alfresco.repo.importer.ImporterComponent.importView(ImporterComponent.java:279)
at org.alfresco.repo.importer.ImporterBootstrap.doImport(ImporterBootstrap.java:485)
at org.alfresco.repo.importer.ImporterBootstrap.access$0(ImporterBootstrap.java:374)
at org.alfresco.repo.importer.ImporterBootstrap$1$1.execute(ImporterBootstrap.java:356)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:464)
at org.alfresco.repo.importer.ImporterBootstrap$1.doWork(ImporterBootstrap.java:360)
at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:555)
at org.alfresco.repo.importer.ImporterBootstrap.bootstrap(ImporterBootstrap.java:363)
... 54 more
Caused by: org.alfresco.service.cmr.view.ImporterException: Namespace URI http://www.adama.com/model/adamaStudyNotification/1.0 has not been defined in the Repository dictionary
at org.alfresco.repo.importer.view.ViewParser.getName(ViewParser.java:995)
at org.alfresco.repo.importer.view.ViewParser.processStartElement(ViewParser.java:226)
at org.alfresco.repo.importer.view.ViewParser.parse(ViewParser.java:183)
... 63 more
While ago I added new sites to alfresco project, and bootstraped them. But now I do not know what could be the problem.
It looks like you have a problem with customized code:
com.prodyna.adama.gas.patch.SiteReloadedPatch.applyInternalImpl
is not an official Alfresco patch.
Failed to import package at line 487; column 75 due to error: Namespace URI http://www.adama.com/model/adamaStudyNotification/1.0 has not been defined in the Repository dictionary
seems to be at least one of your issues: the referenced model http://www.adama.com/model/adamaStudyNotification/1.0 is not defined. You may have forgotten to deploy a dependent module which contains the model xml?
If your intention is to run Alfresco without that module you would need to deploy at least the document model, otherwise Alfresco will not be able to read the metadata of existing documents having the type or aspects defined in that model.
I have an existing Spring 4 API and have successfully integrated springdoc-openapi to generate the OpenAPI 3 spec in JSON/YAML and also display the Swagger UI using springdoc-openapi 1.2.29 and Spring Boot 15.2.2.RELEASE, however there appear to be various bugs that were fixed and enhancements added in later versions of springdoc-openapi. Unfortunately I am running into various compatibility issues with Spring 4 if I use versions higher than springdoc-openapi 1.2.29.
Is there an availability compatibility matrix for springdoc-openapi and Spring 4? As I read through the springdoc-openapi documentation, I do not see any readme or release notes suggesting there is a Spring 5 requirement, however as noted below there are Spring 5 classes used in the underlying springdoc-openapi once you reach a certain version.
My relevant POM:
<!-- springdoc-openapi-ui -->
<!-- anything over 1.2.33 uses Spring 5 MethodParameter.getParameter()-->
<!-- anything over 1.2.29 uses Spring 5 org.springframework.http.codec.multipart.FilePart -->
<!-- webjars-locator-jboss-vfs is required for running under JBOSS and exposing the swagger-ui -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.2.29</version>
</dependency>
<!--
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-security</artifactId>
<version>1.2.29</version>
</dependency>
-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
<version>1.5.22.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
<version>1.5.22.RELEASE</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>webjars-locator-jboss-vfs</artifactId>
<version>0.1.0</version>
</dependency>
When using springdoc-openapi-ui 1.2.30, it will subsequently bring in springdoc-openapi-common-1.2.30.jar which throw an exception trying to use org.springframework.http.codec.multipart.FilePart. Likewise, using 1.2.34 or higher will throw an exception on MethodParameter.getParameter().
12:15:05,003 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1) Caused by: java.lang.NoClassDefFoundError: org/springframework/http/codec/multipart/FilePart
12:15:05,003 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1) at org.springdoc.core.GenericParameterBuilder.isFile(GenericParameterBuilder.java:271)
12:15:05,003 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1) at org.springdoc.core.GenericParameterBuilder.isFile(GenericParameterBuilder.java:296)
12:15:05,003 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1) at org.springdoc.core.AbstractRequestBuilder.buildParams(AbstractRequestBuilder.java:271)
12:15:05,003 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1) at org.springdoc.core.AbstractRequestBuilder.build(AbstractRequestBuilder.java:174)
12:15:05,003 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1) at org.springdoc.api.AbstractOpenApiResource.calculatePath(AbstractOpenApiResource.java:205)
12:15:05,003 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1) at org.springdoc.api.OpenApiResource.calculatePath(OpenApiResource.java:134)
12:15:05,003 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1) at org.springdoc.api.OpenApiResource.getPaths(OpenApiResource.java:99)
12:15:05,003 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1) at org.springdoc.api.AbstractOpenApiResource.getOpenApi(AbstractOpenApiResource.java:124)
12:15:05,003 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1) at org.springdoc.api.OpenApiResource.openapiJson(OpenApiResource.java:83)
12:15:05,003 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
12:15:05,003 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
12:15:05,004 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
12:15:05,004 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1) at java.lang.reflect.Method.invoke(Method.java:498)
12:15:05,004 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
12:15:05,004 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
12:15:05,004 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116)
12:15:05,004 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
12:15:05,004 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
12:15:05,004 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
12:15:05,004 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
12:15:05,004 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1) ... 61 more
Spring 5 reference: https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/http/codec/multipart/FilePart.html
public interface FilePart
extends Part
Specialization of Part that represents an uploaded file received in a multipart request.
Since:
5.0
Any suggestions on how to work around this to leverage the bug fixes and enhancements in springdoc-openapi in later versions?
Issue confirmed and will be resolved as part of 1.3.3. Please see the issue logged with Springdoc below. Kudos to #bnasslahsen for incredibly fast identification and correction!
https://github.com/springdoc/springdoc-openapi/issues/563
I am running wso2is Version 5.7 and tried to implement a TokenGenerator based on msf4j JWTAccessTokenBuilder.
My identity.xml includes
<IdentityOAuthTokenGenerator>com.wso2.jwt.token.builder.JWTAccessTokenBuilder</IdentityOAuthTokenGenerator>
<AccessTokenValueGenerator>org.wso2.carbon.identity.oauth.tokenvaluegenerator.SHA256Generator</AccessTokenValueGenerator>
When I login an exception is thrown
[2019-05-16 18:27:18,163] ERROR
{org.apache.catalina.core.StandardWrapperValve} - Servlet.service()
for servlet [OAuth2Endpoints] in context with path [/oauth2] threw
exception java.lang.RuntimeException:
org.apache.cxf.interceptor.Fault:
com/nimbusds/jwt/ReadOnlyJWTClaimsSet
at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:116)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:336)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:249)
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248)
...
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748) Caused by: org.apache.cxf.interceptor.Fault:
com/nimbusds/jwt/ReadOnlyJWTClaimsSet
at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:170)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:136)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:204)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:101)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
... 49 more Caused by: java.lang.NoClassDefFoundError: com/nimbusds/jwt/ReadOnlyJWTClaimsSet
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
...
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:188)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:104)
... 54 more Caused by: java.lang.ClassNotFoundException: com.nimbusds.jwt.ReadOnlyJWTClaimsSet cannot be found by
JWTAccessTokenBuilder_2.7.4.SNAPSHOT
Can anybody give me a hint?
As per the error com.nimbusds.jwt.ReadOnlyJWTClaimsSet cannot be found by JWTAccessTokenBuilder_2.7.4.SNAPSHOT, it is due to the OSGi class binding.
In the maven-bundle-plugin configuration Import-Package of the pom, make sure you have the com.nimbusds.jwt with the correct version range.
Or the quick fix is to add <DynamicImport-Package>*</DynamicImport-Package>
I found the problem:
I used an old version of org.wso2.carbon.identity.inbound.auth.oauth2
I updated the pom.xml to
<dependency>
<groupId>org.wso2.carbon.identity.inbound.auth.oauth2</groupId>
<artifactId>org.wso2.carbon.identity.oauth</artifactId>
<version>6.0.172</version>
<scope>provided</scope>
</dependency>
from https://mvnrepository.com and had to update the code to use the version of com.nimbusds.jwt used by wso2is.
And finally in the service provider settings you must select the Token Issuer.
Getting error while executing program in Eclipse:
og4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
May 21, 2014 5:23:24 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping': Initialization of bean failed; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.gagan.crud.dao.BookDaoImpl] for bean with name 'bookDao' defined in ServletContext resource [/WEB-INF/spring-servlet.xml]; nested exception is java.lang.ClassNotFoundException: com.gagan.crud.dao.BookDaoImpl
Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.gagan.crud.dao.BookDaoImpl] for bean with name 'bookDao' defined in ServletContext resource [/WEB-INF/spring-servlet.xml]; nested exception is java.lang.ClassNotFoundException: com.gagan.crud.dao.BookDaoImpl
Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.gagan.crud.service.BookServiceImpl] for bean with name 'bookService' defined in ServletContext resource [/WEB-INF/spring-servlet.xml]; nested exception is java.lang.ClassNotFoundException: com.gagan.crud.service.BookServiceImpl
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:532)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at
I have been trying to upgrade spring-flex 1.0.3 to 1.5.2 in order to check new features, i.e. Hibernate lazy fetching support in BlazeDS 4. I downloaded all necessary packages, changed dependencies in Maven for Spring (to 3.0.7), Hibernate (to 3.6.9) and Spring flex core (to 1.5.2). When I try to build and deploy application, I got NullPointerException which indicates cause in my domain class (at the end of stack trace):
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_messageBrokerDefaultHandlerMapping': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_messageBroker': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanInitializationException: MessageBroker initialization failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_messageBroker': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanInitializationException: MessageBroker initialization failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.AbstractBeanFactory.isSingleton(AbstractBeanFactory.java:396)
at org.springframework.context.support.AbstractApplicationContext.isSingleton(AbstractApplicationContext.java:1095)
at org.springframework.web.servlet.handler.AbstractUrlHandlerMapping.registerHandler(AbstractUrlHandlerMapping.java:294)
at org.springframework.web.servlet.handler.SimpleUrlHandlerMapping.registerHandlers(SimpleUrlHandlerMapping.java:129)
at org.springframework.web.servlet.handler.SimpleUrlHandlerMapping.initApplicationContext(SimpleUrlHandlerMapping.java:103)
at org.springframework.context.support.ApplicationObjectSupport.initApplicationContext(ApplicationObjectSupport.java:119)
at org.springframework.web.context.support.WebApplicationObjectSupport.initApplicationContext(WebApplicationObjectSupport.java:72)
at org.springframework.context.support.ApplicationObjectSupport.setApplicationContext(ApplicationObjectSupport.java:73)
at org.springframework.context.support.ApplicationContextAwareProcessor.invokeAwareInterfaces(ApplicationContextAwareProcessor.java:106)
at org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:85)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:394)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1413)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
... 35 more
Caused by: org.springframework.beans.factory.BeanInitializationException: MessageBroker initialization failed; nested exception is java.lang.NullPointerException
at org.springframework.flex.core.MessageBrokerFactoryBean.afterPropertiesSet(MessageBrokerFactoryBean.java:203)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
... 54 more
Caused by: java.lang.NullPointerException
at com.educationathome.domain.Device.toString(Device.java:182)
at java.lang.String.valueOf(String.java:2826)
at java.lang.StringBuilder.append(StringBuilder.java:115)
at org.springframework.flex.core.io.PropertyProxyUtils.getBeanPropertyNames(PropertyProxyUtils.java:71)
at org.springframework.flex.core.io.PropertyProxyUtils.findPropertyNames(PropertyProxyUtils.java:80)
at org.springframework.flex.core.io.SpringPropertyProxy.proxyFor(SpringPropertyProxy.java:85)
at org.springframework.flex.core.io.AbstractAmfConversionServiceConfigProcessor.registerAmfProxies(AbstractAmfConversionServiceConfigProcessor.java:115)
at org.springframework.flex.core.io.AbstractAmfConversionServiceConfigProcessor.processAfterStartup(AbstractAmfConversionServiceConfigProcessor.java:73)
at org.springframework.flex.core.MessageBrokerFactoryBean.processAfterStart(MessageBrokerFactoryBean.java:315)
at org.springframework.flex.core.MessageBrokerFactoryBean.afterPropertiesSet(MessageBrokerFactoryBean.java:177)
... 56 more
I appreciate any supportive replies.
It comes from your code :
com.educationathome.domain.Device.toString(Device.java:182)
so check this line, and check what can be null.