Missing dependency while upgrading AEM 6.5.1 to 6.5.10 - osgi

I am upgrading AEM 6.5.1 (Service pack 1) to AEM 6.5.10 (Service pack 10). For this I installed SP10 in AEM as well updated the uber-jar version to 6.5.10 in my source code POM.xml file.
I see that in the OSGI console, my bundle is in Installed and not Active state. This is because certain dependencies (which before the update were not present) are missing. I have been able to get those dependencies, except one.
com.microsoft.schemas.office.powerpoint -- Cannot be resolved
I am unable to find any JARs online that fixes this issue. I tried Apache POI but no success. Does anyone know what this dependency is and where I can get it?
Thanks!

If you are not using it at all, you can exclude it.
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<!-- Import any version of javax.inject, to allow running on multiple versions of AEM -->
<Import-Package>
javax.inject;version=0.0.0,
!sun.misc;resolution=optional,!javax.persistence,!com.sun.jdi.*,
!com.microsoft.schemas.office.powerpoint,*
</Import-Packages>

Related

Does flyway support sql migrations under test folder?

I am migrating a project from Spring Boot 1.5.21 to 2.2.5. I have followed all instructions in the guide. However, I have an issue with flyway (upgrading from 4.2.0 to 6).
Previously, when I had sql migration files under src/test/resources/db/migration, flyway would run them as part of the mvn clean install command. Now, for some reason, it stopped running these migrations (Just to clarify, I'm talking about maven build and not while running the app).
I'm using maven 3.6.3 and flyway-maven-plugin version 6.0.8 with the following configuration (some values are tokens which are irrelevant for this question):
<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>${flyway.version}</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>migrate</goal>
</goals>
</execution>
</executions>
<configuration>
<skip>${db.skip}</skip>
<url>${db.url}</url>
<user>${db.username}</user>
<password>${db.password}</password>
<locations>
<location>classpath:db/migration</location>
</locations>
<schemas>public,downstream</schemas>
<outOfOrder>true</outOfOrder>
<callbacks>
db.migration.callback.PopulateControlFieldsFlywayCallback,db.migration.callback.UpdateReplicaIdentityFlywayCallback,db.migration.callback.UpdateSchemaHistoryTableFlywayCallback
</callbacks>
</configuration>
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
</dependency>
</dependencies>
</plugin>
Why did the behaviour changed? How to revert to old behaviour? Am I missing something?
I have dug in the flyway and flyway-maven-plugin sorces. I have found that the path from classpath location tag is searched by ClassRealm in class. And there is exist two classpathes: ClassRealm[plugin>org.flywaydb:flyway-maven-plugin:5.0.0, parent: jdk.internal.loader.ClassLoaders$AppClassLoader#1f89ab83]. ClassRealm is a classloader that is used in Maven.
I have executed classLoader.getResources('/db/migration')and found that it returns 2 paths (target/classes/db/migration and target/test-classes/db/migration) for mave-plugin version 4.2.0, but returns only 1 path (target/classes/db/migration) for version5.0.0`.
Also I have found that there was a commit in flyway-maven-plugin repository for using maven 3 instead of 2 between maven-plugin version 4.2.0 and 5.0.0.
I haven't found an exact reason, but, summarizing all, I guess that there were some changes in maven-plugin (I guess some maven core library version) as a result of which the finding path in classpath was changed.
I have tried several options for returning the old behavior, but all of these not so good. These are work:
Stay on 4.2.0 maven-plugin version (I have a pet project where
I specified flyway 5.0.0 in <dependencies> and use maven-plugin
4.2.0 and it works correctly for you);
Specify a path to test-migration via <location>filesystem:target/test-classes/db/migration</location> or <location>filesystem:src/test/resources/db/migration</location>
I hope it will help you.
P.S. By the way, why do you use migration under test folder for generating classes by jooq? It looks very strange to me. You generate classes from one DB model, but in PROD you will have another DB model (since migrations only under main are used). Maybe you should think about it and using only migration under main folder? If you have some exceptions while jooq generatinig, try to fix it without test migrations.

Java 11 Eclipse finds automatic module, Maven does not

I'm attempting to upgrade a 15 year old Maven multimodule project to Java 11, and the module system that was introduced in Java 9. Since the project is built using Maven, all dependencies are pretty clear. First I want to do this using the automatic module names, in order not to also introduce upgraded artifacts (if not absolutely required).
Eclipse is pretty helpful in this process, autocompleting the automatic module names in the module-info.java. For example:
requires dom4j;
But if I compile with Maven, I get errors about that it cannot find the modules Eclipse just autocompleted in there.
module-info.java:[29,18] module not found: dom4j
I am using Maven's compiler plugin 3.7.0 (3.8.0 gives a NullPointerException as per https://jira.apache.org/jira/browse/MCOMPILER-355) I suspect Maven is setting the jars up on the classpath instead of on the modulepath, but the compiler's plugin debug output does not log that.
How can I make Maven correctly handle those modules?
I was running into the same issue. Adding
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
</plugins>
</build>
to my pom solved the problem for me...
Maven version 3.9.0 seems to be buggy and will not find the module although the dependency is using an Automatic-Module-Name. Downgrading to version 3.8.1 helps.

Unresolved constraint in bundle suddenly in new version of JBossFuse

I have already searched for solution online but none of them has actually worked. I am moving from JBossFuse 6.2.1. to JbossFuse 6.3.0. This includes upgrading dependencies which I have managed, most of them. Right now I am stuck with this error:
Error executing command: Error starting bundles:
Unable to start bundle 390: Unresolved constraint in bundle pipeline-reception-ws-external-cxf [390]: Unable to resolve 390.0: missing requirement [390.0] osgi.wiring.package; (osgi.wiring.package=org.eclipse.jetty.http.ssl)
I am using maven-bundle-plugin which is configured this way:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
<Import-Package>
org.apache.camel.*;version="[${camel.range.start},${camel.range.end})",
ms.common.wsdl,template.velocity,org.eclipse.jetty.server,*
</Import-Package>
<Export-Package>
eu.unicorn.basse.ms.pipeline.reception.route.ws.external.cxf.*
</Export-Package>
<_removeheaders>Import-Service</_removeheaders>
</instructions>
</configuration>
</plugin>
I am not sure why this does not work if it works on older JbossFuse environment. Question is, how to solve this issue.
This error indicates that your environment does not contain a bundle which exports the package org.eclipse.jetty.http.ssl. As there is no version information in your package import it indicates that you also don't have a suitably bundled version of it in your bundle's build path (if you did then the maven-bundle-plugin would have found a version and added it to your import).
Either this requirement on org.eclipse.jetty.http.ssl is new to your bundle, or it was previously supplied by another bundle in Fuse 6.2.1 which is no longer present in Fuse 6.3.0.
In any event you need to start by fixing your bundle, either by putting the relevant parts of Jetty on the build path so that you get a version range on your import, or by removing the new dependency which has leaked into your bundle. Then, if needed, you can simply deploy the other bundles that your bundle requires.

Could not start bundle Unresolved constraint in bundle osgi.wiring.package=org.apache.commons.configuration version>=1.9.0 ! version>=2.0.0

I am trying to install a latest version of my apache camel application using feature:install on Karaf
this new version has a dependency of org.apache.commons.configuration ver 1.9
but getting the below error
error:
Error executing command: Could not start bundle mvn: in feature(s)<package> : Unresolved constraint in bundle <bundle> [414]: Unable to resolve 414.0: missing requirement [414.0] osgi.wiring.package; (&(osgi.wiring.package=org.apache.commons.configuration)(version>=1.9.0)(!(version>=2.0.0)))
I had included it in the pom.xml
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.9</version>
</dependency>
also have tried several ways suggested in sof but none is working
have also put the for org.apache.commons.configuration under the plugins
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Import-Package>
org.apache.cxf.service.model,
org.apache.cxf.message,
org.apache.commons.configuration,
*
</Import-Package>
</instructions>
</configuration>
</plugin>
But still not able to resolve. Could anyone please help resolve this?
thanks
You need to ensure that the jar is installed in Karaf.
In order to do this you need to wrap the jar as a bundle:
osgi:install wrap:mvn:commons-configuration/commons-configuration/1.9
After you've done this make sure to remove the addition you made to Import-Package as it's not needed.
If you want the dependency to be installed along with your application's feature just add the following element to your feature:
<bundle>wrap:mvn:commons-configuration/commons-configuration/1.9</bundle>
Do you really want to import it from another deployed bundle or should it be a simple embedded dependency?
Since you list it under Import-Package, you expect the first. For that to work you need to have another bundle deployed in the container that exports org.apache.commons.configuration.
If you want to embedded it as simple dependency in the same bundle, you have to exclude it from Import-Package with ! as prefix and probably use Embed-Dependency instruction like the example in this answer: https://stackoverflow.com/a/30532447/8035582

How to configure OSGI in IntelliJ when it's handled by Maven

I'm an OSGI newb.
I can really use any guidance I can get regarding IntelliJ IDEA / OSGI / Maven / Sling.
So the actual Felix plugin dies when I load it. Apparently it hasn't been maintained and is no longer compatible with the latest release by which I mean IntelliJ IDEA 13.
So I've configured the framework to felix-framework-4.2.1, and that seems to work fine. My greatest concern is that if I apply the OSGI facet to a bundle, the settings seem to indicate that it will change the bundle. Since we have this set up in Maven, I don't think we want this. The source of the facet seems to be the Osmorc plugin. When I used it before, there were complaints about some packages in maven that weren't OSGI enabled and the IDE wanted to point to a special Spring repository for OSGI enabled jar dependencies.
Since we are doing this in Maven, should I even bother with Osmorc? Is there a better way to manage OSGI in IntelliJ IDEA? It is handy knowing which packages are OSGI enabled but an error for that? Really? Specifically I am referring to "The package is not exported by the bundle dependencies" showing up on imports and annotations.
My personal observation with Intellij IDEA 13 is that the OSGI project inspector is slightly more aggressive when it comes to profiling your classes that utilize non-osgi exported classes. That being said, a way around this is by adjusting the inspector severity level. This enables you to use the same OSGI-based approach you were using in Intellij IDEA 12.
To do this, go into your project settings (on Mac: Command+,) and then navigate to the following node:
Inspections --> OSGI --> Package accessibility
Once selected, you'll be able to change the severity level from error to warning.
Performing this change is requisite on a few changes in your pom.xml:
<dependencies>
.
.
<dependency>
<groupId>com.pkg.name</groupId>
<artifactId>some-non-osgi-artifact</artifactId>
<version>0.1-EXAMPLE</version>
</dependency>
</dependencies>
<build>
<plugins>
.
.
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${maven-bundle-plugin.version}</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
<Export-Package>
you.know.what.goes.here
</Export-Package>
<Private-Package>you.know.what.goes.here</Private-Package>
<Import-Package>
*
</Import-Package>
<Embed-Dependency>some-non-osgi-artifact;scope=compile|runtime;inline=false</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<Embed-StripGroup>true</Embed-StripGroup>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
Hope this helps,
Ajay
I think your best bet currently is to use the maven bundle plugin to manage your imports and exports. This means intellij will simply see your bundles as maven projects. Still the correct jars should result. I handle OSGi bundles the same way in eclipse and it works fine.
I also read on the OSGi dev mailing list that there is a bndtools for intellij planned but this will for sure take a while.

Resources