How can I find out what is causing a certain URL to be resolved to a synthetic resources? - aem

On my Adobe CQ 5 (CQ 5.6) installation, for some reason, there's a URL (http://localhost:4503/services) that is getting resolved to a synthetic resource:
This is causing CQ to show the following page, rather than a 404 Page Not Found page:
What is causing this behavior?

You get Forbidden error not because of the strange type of the /services, but because you didn't add any extension (you'll get the same result requesting /content/geometrixx). Let's try to add some extension: .html doesn't really work, but .infinity.tidy.json results in interesting discovery:
{
"tagfilter": {
"sling:resourceType": "/services/tagfilter.servlet",
"servletClass": "com.adobe.cq.social.commons.impl.servlets.TagFilterServlet",
"sling:resourceSuperType": "sling/bundle/resource",
"servletName": "com.adobe.cq.social.commons.impl.servlets.TagFilterServlet"
},
"tagfilter.servlet": {
"sling:resourceType": "/services/tagfilter.servlet",
"servletClass": "com.adobe.cq.social.commons.impl.servlets.TagFilterServlet",
"sling:resourceSuperType": "sling/bundle/resource",
"servletName": "com.adobe.cq.social.commons.impl.servlets.TagFilterServlet"
},
...
It seems that /services is a virtual (or, well, synthetic) path, a parent for servlets. In fact, you can't bind servlet to any path, the most popular choice is /bin prefix, however /services is possible as well. You'll find a list of all such paths in Apache Sling Servlet/Script Resolver and Error Handler OSGi configuration.

Related

How to set SameSite LAX using JBOSS 7.4

We are currently using JBOSS 7.4 for functional testing. I've read on the documentation that undertow version is 2.2.5
and according to the undertow blog
that to configure the samesite cookie on a webapp, I have to added an undertow-handlers.conf file (located in the WEB-INF folder) which contains only the following line:
path(/)->samesite-cookie(mode=Lax)
but this is not working (I'll update with stacktrace later)
I tried different syntaxes but I still cannot start Jboss :
path(/)->samesite-cookie(mode=Lax, cookie-pattern=*) ---> PatternSyntaxException: Dangling meta character '*' near index 0
path(/)->samesite-cookie(mode="Lax", cookie-pattern="*") --->
Caused by: java.lang.IllegalArgumentException: UT000045: Error parsing predicated handler string no handler named samesite-cookie known handlers are [disallowed-methods, allowed-methods, buffer-request, jdbc-access-log, http-continue-accept, secure-cookie, access-log, mark-secure, response-rate-limit, canonical-path, response-code, disable-cache, ssl-headers, trace, blocking, url-decoding, error-file, access-control, redirect, set, ip-access-control, request-limit, resource, compress, restart, clear, byte-range, eager-form-parser, done, rewrite, forwarded, stuck-thread-detector, reverse-proxy, jvm-route, learning-push, dump-request, proxy-peer-address, resolve-local-name, header, store-response, path-separator, resolve-peer-name]:
path(/)->samesite-cookie(mode=\"Lax\", cookie-pattern=\"*\")
^"}}
Any help will be greatly appreciated as none of the above is working.
Thank you.

Jenkins CORS Filter plugin not adding Access-Control-Allow-Origins header

I am trying to add CORS support to my Jenkins server so I could access the REST API from the browser. From looking around, the recommended approach is to use the CORS Filter plugin.
I have installed it, enable it, and add http://localhost to the Access-Control-Allow-Origins field, as well as GET to Access-Control-Allow-Methods field. However, these headers are not showing up in my requests.
This plugin has not been updated in a few years, so I'm not sure if it's compatible with the latest version of Jenkins. I'm running version 2.172.
In the Jenkins system log, I see these errors, not sure if it's related/ relevant
Caught exception evaluating: descriptor.getPropertyType(instance,field).itemTypeDescriptorOrDie in /configure. Reason: java.lang.reflect.InvocationTargetException
java.lang.AssertionError: class hudson.ivy.IvyBuildTrigger$IvyConfiguration is missing its descriptor in public hudson.ivy.IvyBuildTrigger$IvyConfiguration[] hudson.ivy.IvyBuildTrigger$DescriptorImpl.getConfigurations(). See https://jenkins.io/redirect/developer/class-is-missing-descriptor
Caught exception evaluating: h.filterDescriptors(it,attrs.descriptors) in /configure. Reason: java.lang.NullPointerException: Descriptor list is null for context 'class hudson.model.Hudson' in thread 'Handling GET /configure from 100.71.26.18 : qtp589873731-14 Jenkins/configure.jelly GlobalLibraries/config.jelly LibraryConfiguration/config.jelly SCMRetriever/DescriptorImpl/config.jelly MultiSCM/DescriptorImpl/config.jelly'
java.lang.NullPointerException: Descriptor list is null for context 'class hudson.model.Hudson' in thread 'Handling GET /configure from 100.71.26.18 : qtp589873731-14 Jenkins/configure.jelly GlobalLibraries/config.jelly LibraryConfiguration/config.jelly SCMRetriever/DescriptorImpl/config.jelly MultiSCM/DescriptorImpl/config.jelly'
These errors have at org.jenkinsci.plugins.corsfilter.AccessControlsFilter.doFilter(AccessControlsFilter.java:79) in their stack trace.
Does anyone know of a good way to enable CORS support for Jenkins REST API?
Jenkins version 2.303 and I struggle with the same issue. I would recommend to add the port number on the localhost URI you defined in the plugin settings, even though I'm pretty sure that won't change anything.
It actually seems the plugin is having no effect at all.
Probably the best solution is to set up your own proxy which would take care of CORS. Here is a good and well document example Build a Node.js Proxy Server in Under 10 minutes!

IBM Content Navigator ICN Plugin returns an error when configured but works fine

I am using ICN 3.0.3 IF7. I have a custom plugin that writes the following error to the console when I initially configure it into ICN.
The plugin itself works fine once configured.
Uncaught TypeError: cls is not a constructor
at Object.eval (ecm/widget/layout/AdminPane.js:9845)
at dojo.js.jgz:22442
at runFactory (dojo.js.jgz:611)
at execModule (dojo.js.jgz:691)
at dojo.js.jgz:397
at guardCheckComplete (dojo.js.jgz:699)
at contextRequire (dojo.js.jgz:396)
at req (dojo.js.jgz:32)
at Object._displayPluginConfig (ecm/widget/layout/AdminPane.js:9844)
at Object._pluginRequestCompleted (ecm/widget/layout/AdminPane.js:9759)
In addition, once it is configured, I cannot get the details on it like I can for the included AFP Viewer plugin:
Name: AFP Viewer
Version: 2.0.3.5
Repository types: None
Actions: None
Open Actions: None
Viewers: AFP Viewer
Features: None
Layouts: None
It seems like something is wrong with the plugin structure that doesn't affect its ability to run. I am worried because I just don't like seeing errors. Has anyone seen this before?
Looking at the error it seems like the module you specified in the plugin.java#getConfigurationDijitClass is either failing to instantiate, or isn't specified at all.
If you have a configuration dijit class configured, then ensure it's actually a widget and that it's constructor and postCreate method (if provided) don't throw an error :).
If you don't have one configured, set it to null to prevent instantiation

matchOnUriPrefix=true does not seem to be working

I am using:
wildlfy 10.1.0 final
Camel 2.19.1
Camel Java DSL RouteBuilder
In my RouteBuilder.configure I have the following from:
from("undertow:http://localhost:" + portNum + "/DataplatformESB/v3?matchOnUriPrefix=true&httpMethodRestrict=post,get,put,options,patch,delete")
When I test to "localhost:8080/DataplatformESB/v3" with GET, PUT, or PATCH, they all work fine. But when I test to "localhost:8080/DataplatformESB/v3/anythingelse" I'll get a 404 (page not found) in return. In the Wildfly log it stats: "Matched prefix path /DataplatformESB for path /DataplatformESB/v3/anythingelse". So for me it looks like the "matchOnUriPrefix=true" is not working.
I have already tested with from("restlet:http://localhost:" + portNum + "/DataplatformESB/v3?matchOnUriPrefix=true&httpMethodRestrict=post,get,put,options,patch,delete"), but that does not work as well.
I have also tried it with the restConfiguration and .componentProperty("matchOnUriPrefix", "true") but also no luck.
Does anyone has an idea why the matchOnUriPrefix=true does not seem to work for me?
I have done some further research and found out the folliwing:
I got the undertow test project from https://github.com/apache/camel/tree/master/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowPrefixMatchingTest.java and run/tested in it in my NetBeans.
The code is:
from("undertow:http://localhost:{{port}}/bar?matchOnUriPrefix=true")
.transform(bodyAs(String.class).append(" Matching prefix"))
.to("mock:bar");
This runs fine and returns OK when the URL starts with the prefix: "bar". So "bar/foo" returns OK as well.
But when I paste this code into the Wildfly Camel Rest Swagger example (there is no Wildfly Camel Rest example) from the website https://github.com/wildfly-extras/wildfly-camel-examples/tree/master/camel-rest-swagger, then I only get an OK when testing with "bar" as path.
Using "bar/foo" result in a 404 return code.
Im still using Wildfly 10.1 final and Camel 2.19.1.
So what is causing the difference in output? What do I have to change in Wildfly to get it working?
Is the option matchOnUriPrefix default disabled/ignored on Wildfly?
When using the Wildfly-Camel 2.18.3 on the Wildlfly installation it seems to work.
It looks like the default value for matchOnUriPrefix is changed or the handling of this property.
In that case it seems to me that this introduced the bug as described above.

OFBiz-11.04 deployment in JBoss-5.1.0

In order to get flexibility in load balancing and clustering, I thought of deploying my OFBiz application in JBoss-5.1.0 as per document (https://cwiki.apache.org/OFBTECH/deploying-ofbiz-904-on-jboss-510.html).
Build was successful and I could see all WAR files in server/default/deploy/OFBiz.ear and other JAR files in lib folder. But I am getting a few issues when starting JBoss server. Please take a look and help me if you have any clues.
Issues:
Could not find definition for entity name EntityKeyStore
......................
Could not find definition for entity name JobSandbox
...................
Entity definitions for EntityKeyStore is located in entitymodel.xml of framework/entity/entitydef folder. I could not find this xml anywhere inside OFBiz.ear. (Not only this XML, none of the entitymodel.xml s are found in ear. But no issue with other entities. I do not know why it is so). I checked my database (server/default/data/derby) and found out ENTITY_KEY_STORE there.
The same is the case for JobSandBox.
After this exception, the server seems to proceed with creating dispatcher for each component and it started with accounting. I am getting another issue here.
Could not get root location for component with name [common], error was: org.ofbiz.base.component.ComponentException: No component found named : common
.....
....
....
---- exception report ----------------------------------------------------------
Error processing include at [component://common/webcommon/WEB-INF/common-controller.xml]:java.net.MalformedURLException: Could not get root location for component with name [common], error was: org.ofbiz.base.component.ComponentException: No component found named : common
Exception: java.net.MalformedURLException
This exception is repeatedly printed in log file. And down the line, the same kind of exception is thrown for other components like commonext, accounting and ecommerce.
After these exceptions "Could not find definition for entity name Tenant" is also thrown.
My OFBiz application uses a multitenant environment. Any help is greatly appreciated.