Can't get Swagger Annotations output on Websphere Liberty Profile - jax-rs

I'm trying to use Swagger (1.5.12) Annotations in my web application deployed to WAS Liberty Profile 16.0.0.3.
However, when I access the /swagger.json URL, the following exception is thrown:
[err] [Default Executor-thread-13] WARN org.reflections.Reflections - could not create Vfs.Dir from url. ignoring the exception and continuing
[err] org.reflections.ReflectionsException: could not create Vfs.Dir from url, no matching UrlType was found [wsjar:file:/opt/ibm/WebSphere/Liberty-ND-16.0.0.3/wlp/usr/servers/defaultServer/workarea/org.eclipse.osgi/61/data/cache/com.ibm.ws.app.manager_87/.cache/!/WEB-INF/classes/]
either use fromURL(final URL url, final List urlTypes) or use the static setDefaultURLTypes(final List urlTypes) or addDefaultURLTypes(UrlType urlType) with your specialized UrlType.
[err] at org.reflections.vfs.Vfs.fromURL(Vfs.java:109)
Do you know how to overcome this issue?
I'd like to use this swagger.json output with the REST API Documentation that comes with WLP under /ibm/api/explorer/ context.
Thanks, any suggestions are really welcome!

I solved the problem adding the following setting in server.xml:
<classloading useJarUrls="true"/>
I also had to downgrade to Swagger 1.5.3

Yes, at the moment WebSphere Liberty supports Swagger annotations 1.5.3. You won't get a compiler error if using 1.5.4, but full support for that version is not there yet.
The version of the annotations package in Open Source moves up quickly, but rest assured that in the next few months WebSphere Liberty will synchronize with the latest versions.

Related

Anypoint Platform application name missing (flowVars._clientName)

I am facing a weird problem today, when running my MuleSoft application locally from my AnypointStudio and firing a request from postman, I am getting 403 error. When debugging I found out that the application is checking for flowVars._clientName, however it is missing. According to this documentation, actually yes flowVars._clientName is expected.
https://help.mulesoft.com/s/article/How-to-get-the-client-application-name-in-a-flow-based-on-the-client-id-and-client-secret.
So my application fails with 403 error. Seems that other environments are working perfectly fine.
And yes it is using Client Id enforcement.
Any clues?
Without more details it looks like the issue is inside the logic of your application. The KB article that you referenced is a how to in case you need to obtain the client name. It doesn't say that you have to use for authentication. You don't describe how the application does authentication/authorization. Is it in a flow? Or in a policy? If it is the standard Client ID enforcement policy, the expressions to evaluate client id and secret can be configured, but I don't think the default is not #[flowVars._clientName] nor #[flowVars._clientId].
Note that Exchange is basically a repository of APIs and other artifacts. It doesn't authenticate anything at execution time. Unless your application is trying to use it somehow, but I can't think of a reason for that.
The issue was resolved only by re-downloading Anypoint Studio and mule runtime. Very weird, it was happening only for one application, not for the others. Creating a new workspace did not help, deleting the application and re-cloning and installing did not help, even recloning in a new directory did not help. Only using a new Anypoint Studio and runtime installation resolved it (even with the old code base) ...

java.lang.NoClassDefFoundError: org.apache.woden.resolver.URIResolver

getting the below exception after deploying the application in WAS8. using axis2 1.7.4 family with Woden api and impl 1.0M8. Will someone please help
java.lang.NoClassDefFoundError: org.apache.woden.resolver.URIResolvergetting
at java.lang.J9VMInternals.verifyImpl(Native Method)
at java.lang.J9VMInternals.verify(J9VMInternals.java:93)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:170)
at org.apache.axis2.deployment.ModuleDeployer.deploy(ModuleDeployer.java:65)
at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136)
at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:815)
at org.apache.axis2.deployment.RepositoryListener.loadClassPathModules(RepositoryListener.java:222)
at org.apache.axis2.deployment.RepositoryListener.init2(RepositoryListener.java:71)
at org.apache.axis2.deployment.RepositoryListener.<init>(RepositoryListener.java:64)
at org.apache.axis2.deployment.DeploymentEngine.loadFromClassPath(DeploymentEngine.java:177)
at org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfiguration(FileSystemConfigurator.java:135)
at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:64)
at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(ConfigurationContextFactory.java:210)
at org.apache.axis2.client.ServiceClient.configureServiceClient(ServiceClient.java:151)
at org.apache.axis2.client.ServiceClient.<init>(ServiceClient.java:144)
and later below I am getting classnotfoundexception also
Caused by: java.lang.ClassNotFoundException: org.apache.woden.resolver.URIResolver
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:650)
... 27 more
If you're going to bring your own web services implementation, you have to run with PARENT_LAST class loading (or, preferably, package your version of the web services implementation in a shared library with an isolated class loader) and disable the built-in web services engine in WebSphere. Based on the exception stack, what appears to be happening is that something in your web services engine is interacting with WebSphere's version and triggering a load for a dependency that WebSphere doesn't package. Setting the environment to use your version will resolve that.
Note that WebSphere already includes Axis2, so unless you are strictly dependent on that specific point release, there's a very good chance that the best solution for you is just to rely on WebSphere's web services provider, rather than bringing your own. That will greatly simplify your configuration, since you won't need to mess with class loading delegation settings or system properties disabling the web services provider.

Skip loading of a jar file in WebSphere 8.5.5

I am getting an exception as given below.
I want Response class to be loaded from jawax-ws-rs.api.jar.
but its getting loaded from the j2ee.jar and throwing the below error:-
java.lang.NoSuchMethodError: javax/ws/rs/core/Response.readEntity(Ljava/lang/Class;)Ljava/lang/Object
Is there any way we can skip loading of j2ee.jar at startup of WebSphere?
Your question is incorrect, probably what you really want is to replace JAX-RS engine provided with WAS with some third part. And you should never pack j2ee.jar with your application as all required classes are already loaded by the server.
Check the following posts and links:
JAX-RS Jersey 2.10 support in Websphere 8
Disabling the JAX-RS runtime environment

Endeca-Hybris integration not working

i'am trying to integrate hybris 4.7.9 with endeca. I have installed the following endeca components. 1)MDEX engine 2)Platform services 3)Endeca workbench 4)CAS.
I have deployed a sample application on endeca side using "D:\Endeca\ToolsAndFrameworks\11.0.0\deployment_template\bin\deploy.bat"
In Hyend2 in admincockpit of hybris
I have made EAC/CAS connection with my appication and made a export job.
Problem is i am not able to run that job, it reports me following error:
http://localhost:8500/MyAppen_en_data/?wsdl returned response code 404
at com.endeca.itl.service.ServiceLocator.getService(ServiceLocator.java:150)
I don't know Hybris, but since the error is related to Endeca, let me try to give some pointers.
CAS: Check that CAS is up and running
App Name: You might have specified app-name-with-locale (MyAppen) somewhere where you need to specify only app-name (MyApp). [The Endeca app name without the locale is called as "Base Application Name". Go back and check all your configurations in Hybris and Endeca].
You may also refer to this blog (Although it is for ATG framework, it should give idea for Hybris as well).

Magento Soap Interface, Invalid WSDL

I am having a problem where the soap interface to Magento (http://172.16.0.119/index.php/api/v2_soap?wsdl) is generating invalid wsdl. When I try to generate a proxy using visual studio I get an error that there are several elements declared more than once in the document for example
Source: Line: 44 Column: 4 Validation Error: The global element
'http://schemas.xmlsoap.org/soap/encoding/:Array' has already been
declared
I thought that perhaps I had something corrupted in my magento install as I have several plugins and such running, so I done a fresh install of magneto 1.6.1 with no plugins or anything. I still receive this error. Has anybody else had this problem? How did you resolve it?
Thanks in advance.
There is a setting within the admin module that allows you to set the WS-I (http://en.wikipedia.org/wiki/Web_Services_Interoperability) Compliance flag to True. I was receiving a number of issues with VS2010 and the Magento API until I changed this flag.
It can be found in System -> Configuration -> Services -> Magento Core API
Hope this helps.