opendj-core 6.5.0 maven dependency - java

On OpenDJ 2.6.4, i’m using the dependency “opendj-ldap-sdk” in order to use the
following classes:
org.forgerock.opendj.asn1.ASN1;
org.forgerock.opendj.asn1.ASN1Writer;
org.forgerock.opendj.ldap.ByteStringBuilder;
I checked that the same classes exist on Directory Services 6.5 on lib\opendj-core.jar but i cannot find the maven dependency to use it (in a context of migration from OpenDJ 2.6.4 to Directory Services 6.5).
I’ve found this dependency:
<dependency>
<groupId>org.codice.org.forgerock.opendj</groupId>
<artifactId>opendj-core</artifactId>
<version>3.0.0.ALPHA1</version>
</dependency>
but the version doesn’t match..
Where can I find the dependency?

You can unzip DS-6.5.0.zip and then add the <systemPath> element to your maven dependency. See https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#System_Dependencies .
For a more robust mechanism, if you intend to use Directory Services 6.5 in production, then I would recommend that you contact your ForgeRock support. They will explain to you how to compile your plugin(s) against this version.

Related

Jetty ServletTester class for Version 9.4.34.v20201102

I'm currently looking into testing jetty servlets. I found the org.eclipse.jetty.testing.ServletTester class in some old documentation (just by random searching on the web), but it seems to be removed in newer versions.
Is there a replacement for it, and if yes, where can i find it?
If there is no replacement, I would be happy to hear about different ways to accomplish the goal of testing servlets!
Thanks in advance
The class org.eclipse.jetty.testing.ServletTester is the old Jetty 7 and Jetty 8 ServletTester.
It can be found in the following maven artifacts ...
https://search.maven.org/search?q=fc:org.eclipse.jetty.testing.ServletTester
The newer org.eclipse.jetty.servlet.ServletTester (note the package change) is available for Jetty 9.x, Jetty 10.x, and Jetty 11.x in the following artifacts ...
https://search.maven.org/search?q=fc:org.eclipse.jetty.servlet.ServletTester
Standard maven repository behaviors here, as the class is not a runtime class, it sits in the tests jar (also on maven central).
Example:
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>9.4.35.v20201120</version>
<classifier>tests</classifier>
</dependency>

How to fix the "the-default-package-is-not-permitted-by-the-import-package-syntax" error while using geojson library?

I was upgrading to new library of geojson from version 14.2 to 20.2. And I was keep of getting below maven build error which is failing at the bundle processing with the message "the-default-package . -is-not-permitted-by-the-import-package-syntax".
I expect the maven build with bundle processing to be successful but the actual output is "the-default-package-is-not-permitted-by-the-import-package-syntax" error.
While upgrading the geotools library from old version 14.2 to new version 20.2, there were lot of changes has been made.
GeoTools Upgrade
This was one of the link that would help everyone to do it very easily. But with the upgradation of geotools, we also update the gt-geojson library too. This library contains the class "Skunkwork" without any package name which result in above error during bundle processing of maven build. To avoid this error,i have to remove this class. And it works fine.
Before Fix
POM Configuration:
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-geojson</artifactId>
<version>20.2</version>
</dependency>
After Fix
POM Configuration:
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-geojson</artifactId>
<version>20.2-fixed</version>
</dependency>
Note: This jar needs to be manually installed to your local repository. And as well as you need to install the fixed jar to remote artifactory if used by your code base such as Nexus, JFrog etc.

Upgrading gwt from 2.1.1 to 2.8.0: ServiceConfigurationError: org.apache.juli.logging.Log: Provider org.eclipse.jetty.apache.jsp.JuliLog not a subtype

After upgrading gwt from version 2.1.1 to 2.8.0, I got the error message
2017-04-20 12:59:19.551:WARN:oejuc.AbstractLifeCycle:main: FAILED c.g.g.d.s.j.WebAppContextWithReload#341fbaf1{/,file:/C:/Users/xxx/.IntelliJIdea2017.1/system/gwt/xxx.97baa614/xxx.fdf824a8/run/www/,STARTING}{C:\Users\xxx\.IntelliJIdea2017.1\system\gwt\xxx.97baa614\xx.fdf824a8\run\www}: java.util.ServiceConfigurationError: org.apache.juli.logging.Log: Provider org.eclipse.jetty.apache.jsp.JuliLog not a subtype
java.util.ServiceConfigurationError: org.apache.juli.logging.Log: Provider org.eclipse.jetty.apache.jsp.JuliLog not a subtype
I found some other posts with similar messages, like this or this, but the situation seems to be different:
I do not use Maven or Ant, just pure IntelliJ, I have no reference to any Tomcat library, and I am not aware of any JSP in our application.
I found through debugging that first the class loader com.google.gwt.dev.shell.jetty.Jettylauncher$WebAppContextWithReload$WebAppClassLoaderExtension loads class org.eclipse.jetty.apache.jsp.JuliLog including interface org.apache.juli.logging.Log.
Then, later interface org.apache.juli.logging.Log is loaded by sun.misc.Launcher$AppClassLoader triggered indirectly by
org.eclipse.jetty.webapp.WebAppContext.startContext()
which calls method initialize of an
org.eclipse.jetty.jsp.JettyJspServlet
instance.
I have no idea why a JspServlet needs to be initialized at all, as no JSPs are used in the application, as far as I see, just a few Servlets. And it seems all the classes involved in this conflict are contained in the single jar gwt-dev.jar, so I see no possibility to influence any class loading behavior via class path settings.
Any idea how I could resolve this?
I also got this error upgrading from gwt from version 2.4 to 2.8.2.
Jake W's answer helped me.
To solve this, I ran a maven dependency tree on my project to figure out what was referencing jetty's apache-jsp.
To run the dependency tree, in Eclipse I created a new run configuration -> maven build -> with the goals "dependency:tree -Doutput=/dependency/file.txt". Once it's run, the console output will show where it saves the output. It should be the same location that you referenced with the -Doutput option.
Look for something like this in the output file:
- org.eclipse.jetty:apache-jsp:jar:9.2.14.v20151106:compile
And then look up in the tree to see where it's being pulled in from. In my case it came from this:
+- com.google.gwt:gwt-dev:jar:2.8.2:compile
+- net.sourceforge.htmlunit:htmlunit:jar:2.19:compile
\- org.eclipse.jetty:apache-jsp:jar:9.2.14.v20151106:compile
Once you know where it's coming from, (assuming you're using maven) you can add an exclusion in your pom.xml file for it:
</dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwt.version}</version>
<exclusions>
<exclusion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>apache-jsp</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
This worked for me. Thanks :)
I saw this error when I recently upgraded to GWT 2.8.0. Please try to exclude jetty-apache-Jsp related dependencies from your project.
You may see other jetty related issues as well, so please also make sure you are using exactly the same jetty version as GWT 2.8.0 is using.
I'm on mobile at the moment, unable to add more details, but I hope that can be a useful direction to go. Please add your comments if you still see issues, I will then have a look and update the answer when I'm on my laptop.
I have just ran into this exception after adding gwt-test-utils:0.53 dependency (with GWT 2.8.1)
I am using ant and all information found regarding this error indicated there was 2 versions of Juli Logging in the classpath, but every search came up with only gwt-dev.jar. Production builds worked fine, but dev mode did not which needs gwt-dev.jar.
Part of the build process has the jars copied from a local lib directory to war/WEB-INF/lib to pack into the war. The ant script points to the local lib directory for debugging, not the ones meant for the war file. Despite the war location not being listed in the ant file as a class path, it was still loading it.
Ultimately, gwt-dev.jar was conflicting with the copied version of itself.

Maven build - force the use of a newer version

I am trying to build protege-server (https://github.com/protegeproject/org.protege.owl.server) from source. I downloaded the source code. Using "mvm -X package" yields the following error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.
0:compile (default-compile) on project org.protege.owl.server: Compilation failu
re
[ERROR] /c:/Users/user/Programs/webprotege/org.protege.owl.server-master/src/mai
n/java/org/protege/owl/server/connect/local/OSGiLocalTransport.java:[11,32] type
org.osgi.framework.ServiceRegistration does not take parameters
Based on a previous question, an OSGI blogpost explains that the problem was fixed in a later (4.3.1) version of the library.
I tried to refer a newer version of this library in the POM.xml file:
<dependency>
<groupId>org.osgi</groupId>
<artifactId>core</artifactId>
<version>6.0.0</version>
<scope>system</scope>
<systemPath>/c:/Users/user/Downloads/osgi.core-6.0.0.jar</systemPath>
</dependency>
and even downloaded the newer version to specifically target it.
The error still occurs. Is there any way to solve it?
EDIT:
Attempting the solution suggested by #Balazs Zsoldos didn't help and I received the same error message. I noted an import of this package (org.osgi.framework) referring version 1:
<Bundle-Activator>org.protege.owl.server.Activator</Bundle-Activator>
<Bundle-SymbolicName>org.protege.owl.server</Bundle-SymbolicName>
<Bundle-Vendor>The Protege Development Team</Bundle-Vendor>
<Embed-Dependency>antlr, antlr-runtime, stringtemplate</Embed-Dependency>
<Export-Package>org.protege.owl.server*;version=2.0.6-SNAPSHOT</Export-Package>
<Import-Package>!org.antlr.stringtemplate,
!org.apache.commons.cli,
org.osgi.framework;version="1",
*</Import-Package>
An attempt to remove this line did not help either, as it appears in another dependency down stream. I could not find out how to override the downstream import-package instruction.
The effective pom.xml, as generated by eclipse, is attached as a link: https://docs.google.com/document/d/1eHFalUHVZ45ejLes_eqaXLw6ttjcTryphbGr_CKbhRk/edit?usp=sharing
The issue is that older versions of osgi.core are still on the classpath of the as they are imported with different group and artifact ids. Drag and drop the pom.xml to your eclipse and see the Dependency Hierarchy tab of the pom editor to get more information.
The following two are imported by dependencies:
org.osgi:org.osgi.core (by org.apache.felix.log)
org.apache.felix:org.osgi.core (by owlapi distribution)
To solve the problem, you should add the following dependency:
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
And as this does not override the org.apache.felix:org.osgi.core dependency, exclude that one:
<dependency>
<groupId>net.sourceforge.owlapi</groupId>
<artifactId>owlapi-distribution</artifactId>
<version>3.4.5</version>
<exclusions>
<exclusion>
<groupId>org.apache.felix</groupId>
<artifactId>org.osgi.core</artifactId>
</exclusion>
</exclusions>
</dependency>
(and remove the dependency with system scope as you do not need it and its artifactId is different from the standard anyway).
Edit
Just realized that the old osgi.core package is also inside org.apache.felix:org.apache.felix.framework that is pulled transitively by ProtegeLauncher via org.apache.felix:org.apache.felix.main:4.0.3. This means that you should either
Increment the version of org.apache.felix:org.apache.felix.main to the newest (or to one that at least implements osgi 4.3). In this case you do not need osgi.core at all
exclude org.apache.felix:org.apache.felix.main from edu.stanford.protege:ProtegeLauncher (and keep version 4.3.1 or higher of osgi.core)
I tried the second one and another issue comes that surfire plugin cannot be downloaded from maven central (or something similar, you will see).
Notes
The developer of this protege library was clearly not familiar how maven dependency management works and what should have been imported as a dependency. The project imports an OSGi runtime environment transitively that should never happen. For compilation only API should be imported and if the target runtime surely contains that API, it should be imported with provided scope. I would recommend to
not use this library or
clean it out (at least the maven dependency part) and send a pull request so the library can have an acceptable quality

CXF Conflicts xmlschema and xmlschema-core Dependency

I have a problem with my cxf dependencies. There is a really huge project that ı working and there are lots of dependencies.
My problem is with xmlschema and xmlschema-core dependencies. There is no older versions of dependencies in my pom files, but i am getting the following exception. Do you have any idea about the problem ?
java.lang.NoSuchFieldError: QUALIFIED
at org.apache.cxf.service.model.SchemaInfo.setSchema(SchemaInfo.java:146)
at org.apache.cxf.wsdl11.SchemaUtil.extractSchema(SchemaUtil.java:136)
at org.apache.cxf.wsdl11.SchemaUtil.getSchemas(SchemaUtil.java:73)
at org.apache.cxf.wsdl11.SchemaUtil.getSchemas(SchemaUtil.java:65)
at org.apache.cxf.wsdl11.SchemaUtil.getSchemas(SchemaUtil.java:60)
at org.apache.cxf.wsdl11.WSDLServiceBuilder.getSchemas(WSDLServiceBuilder.java:372)
at org.apache.cxf.wsdl11.WSDLServiceBuilder.buildServices(WSDLServiceBuilder.java:339)
at org.apache.cxf.wsdl11.WSDLServiceBuilder.buildServices(WSDLServiceBuilder.java:203)
at org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:142)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:383)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:506)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:242)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:205)
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101)
at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:90)
at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:155)
at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:155)
at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:465)
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:332)
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:319)
If you get java.lang.NoSuchFieldError: QUALIFIED error. It is also comes from dependency confilict, but the weirdest thing is there is no dependency in the dependency hierarchy. The root cause of above exception is missing versions in some dependencies. I need cxf-rt-core 2.5.2 which has internal dependecy of xmlschema-core. Following code block is taken from cxf-rt-core 2.5.2 pom.
<dependency>
<groupId>org.apache.ws.xmlschema</groupId>
<artifactId>xmlschema-core</artifactId>
</dependency>
There is no version information as seen above. This causes the error. If there is no version provided in the pom file, it matches the first dependency in the repository, it is generally older versions. There should be carefully investigated the dependencies and its version. If there is a dependency which has not version, it may cause similar error. All dependency conflicts should be excluded as explained in this answer, then updating all the dependencies will solve the issue. There should be given special attention to local repository, and make sure that there is no older versions of dependencies.

Categories

Resources