cancel
Showing results for 
Search instead for 
Did you mean: 

Problem when creating an all-in-one project in Eclipse

nettania
Confirmed Champ
Confirmed Champ

Hi,

I am currently trying to get first experiences in developing extensions for alfresco. Meanwhile I already successfully created and Aikau Client Im am stucking in creating an All-In-One project.

I am using Eclipse with OpenJDK 12 on my mac. I used this guide https://docs.alfresco.com/sdk2.0/tasks/alfresco-sdk-rad-eclipse-aio-project.html to create an all-in-one project in eclipse. I I try to run the porject, I did not change anything I get the following error:

Exception in thread "main" java.util.ServiceConfigurationError: sun.util.locale.provider.LocaleDataMetaInfo: Unable to load sun.util.resources.cldr.provider.CLDRLocaleDataMetaInfo
	at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:583)
	at java.base/java.util.ServiceLoader.loadProvider(ServiceLoader.java:855)
	at java.base/java.util.ServiceLoader$ModuleServicesLookupIterator.hasNext(ServiceLoader.java:1077)
	at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1300)
	at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1385)
	at java.base/sun.util.cldr.CLDRLocaleProviderAdapter$1.run(CLDRLocaleProviderAdapter.java:89)
	at java.base/sun.util.cldr.CLDRLocaleProviderAdapter$1.run(CLDRLocaleProviderAdapter.java:86)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:552)
	at java.base/sun.util.cldr.CLDRLocaleProviderAdapter.<init>(CLDRLocaleProviderAdapter.java:86)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
	at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:166)
	at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:404)
	at java.base/java.lang.Class.newInstance(Class.java:590)
	at java.base/sun.util.locale.provider.LocaleProviderAdapter.forType(LocaleProviderAdapter.java:176)
	at java.base/sun.util.locale.provider.LocaleProviderAdapter.findAdapter(LocaleProviderAdapter.java:279)
	at java.base/sun.util.locale.provider.LocaleProviderAdapter.getAdapter(LocaleProviderAdapter.java:250)
	at java.base/java.util.Calendar.createCalendar(Calendar.java:1692)
	at java.base/java.util.Calendar.getInstance(Calendar.java:1660)
	at java.base/java.text.SimpleDateFormat.initializeCalendar(SimpleDateFormat.java:676)
	at java.base/java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:620)
	at java.base/java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:599)
	at org.apache.maven.cli.CLIReportingUtils.formatTimestamp(CLIReportingUtils.java:157)
	at org.apache.maven.cli.CLIReportingUtils.createMavenVersionString(CLIReportingUtils.java:99)
	at org.apache.maven.cli.MavenCli.populateProperties(MavenCli.java:1676)
	at org.apache.maven.cli.MavenCli.properties(MavenCli.java:596)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:278)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
Caused by: java.lang.LinkageError: loader 'platform' attempted duplicate class definition for sun.util.resources.cldr.provider.CLDRLocaleDataMetaInfo. (sun.util.resources.cldr.provider.CLDRLocaleDataMetaInfo is in module jdk.localedata of loader 'platform')
	at java.base/java.lang.ClassLoader.defineClass2(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1108)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:183)
	at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:761)
	at java.base/jdk.internal.loader.BuiltinClassLoader.findClassInModuleOrNull(BuiltinClassLoader.java:682)
	at java.base/jdk.internal.loader.BuiltinClassLoader.findClass(BuiltinClassLoader.java:563)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:633)
	at java.base/java.lang.Class.forName(Class.java:491)
	at java.base/java.util.ServiceLoader.loadProvider(ServiceLoader.java:853)
	... 37 more

I understand the error but I do not know where I can find the duplicate class definition. This is a base class which is part of Open-JDK and I can´t find the duplicate jar in the project. 

Can someone give me an hint, how to resolve this problem.

Florian

1 ACCEPTED ANSWER

abhinavmishra14
World-Class Innovator
World-Class Innovator

The link is pointing to SDK2.x.

If you are using ACS 6.x, you should be generating SDK4.x archetype. 

Generate the new project by following these steps:

1- Open commond prompt and execute following maven command:

mvn archetype:generate -Dfilter=org.alfresco:

or

mvn archetype:generate -Dfilter="org.alfresco:"

2- You will be asked to choose the archetype. SELECT '2'

Choose archetype:
1: remote -> org.alfresco.maven.archetype:activiti-jar-archetype (DEPRECATED - UNSUPPORTED - EXPERIMENTAL)
2: remote -> org.alfresco.maven.archetype:alfresco-allinone-archetype (Sample multi-module project for All-in-One development on the Alfresco platform. Includes modules for Platform/Repository JAR and Share JAR)
3: remote -> org.alfresco.maven.archetype:alfresco-amp-archetype (Sample project with full support for lifecycle and rapid development of Repository AMPs (Alfresco Module Packages))
4: remote -> org.alfresco.maven.archetype:alfresco-platform-jar-archetype (Sample project with full support for lifecycle and rapid development of Platform/Repository JARs and AMPs (Alfresco Module Packages))
5: remote -> org.alfresco.maven.archetype:alfresco-share-jar-archetype (Share project with full support for lifecycle and rapid development of JARs and AMPs (Alfresco Module
        Packages))
6: remote -> org.alfresco.maven.archetype:share-amp-archetype (Share project with full support for lifecycle and rapid development of AMPs (Alfresco Module
        Packages))

3- Select '14' for the SDK version as 4.1.0

Choose org.alfresco.maven.archetype:alfresco-allinone-archetype version:
1: 2.0.0-beta-1
2: 2.0.0-beta-2
3: 2.0.0-beta-3
4: 2.0.0-beta-4
5: 2.0.0
6: 2.1.0
7: 2.1.1
8: 2.2.0
9: 3.0.0
10: 3.0.1
11: 3.1.0
12: 4.0.0-beta-1
13: 4.0.0
14: 4.1.0
Choose a number: 14:

4- Provide 'groupId'

Define value for property 'groupId':

e.g. com.demo.aio.sdk4

5- Provide the 'artifactId' (name of your project)

Define value for property 'artifactId':

e.g.: sdk4-aio-project

6- Provide package:

Define value for property 'package' com.demo.aio.sdk4: :

Keep as is. Press enter.

7- You will be asked to confirm the properties:

Confirm properties configuration:
groupId: com.demo.aio.sdk4
artifactId: sdk4-aio-project
version: 1.0-SNAPSHOT
package: com.demo.aio.sdk4
 Y: :

Press 'Y', if everything looks good. A sample project will be generated. 

8- Import them in eclipse and get started.

Note: SDK4.x is based on docker and docker-compose.

In Addition, check to see if there JDK is properly configured in your eclipse. 

Note: JDK 11 is recommended for SDK4.1.0

Have a look at this doc as well: https://hub.alfresco.com/t5/alfresco-content-services-hub/alfresco-sdk-4-0/ba-p/289257

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

View answer in original post

2 REPLIES 2

abhinavmishra14
World-Class Innovator
World-Class Innovator

The link is pointing to SDK2.x.

If you are using ACS 6.x, you should be generating SDK4.x archetype. 

Generate the new project by following these steps:

1- Open commond prompt and execute following maven command:

mvn archetype:generate -Dfilter=org.alfresco:

or

mvn archetype:generate -Dfilter="org.alfresco:"

2- You will be asked to choose the archetype. SELECT '2'

Choose archetype:
1: remote -> org.alfresco.maven.archetype:activiti-jar-archetype (DEPRECATED - UNSUPPORTED - EXPERIMENTAL)
2: remote -> org.alfresco.maven.archetype:alfresco-allinone-archetype (Sample multi-module project for All-in-One development on the Alfresco platform. Includes modules for Platform/Repository JAR and Share JAR)
3: remote -> org.alfresco.maven.archetype:alfresco-amp-archetype (Sample project with full support for lifecycle and rapid development of Repository AMPs (Alfresco Module Packages))
4: remote -> org.alfresco.maven.archetype:alfresco-platform-jar-archetype (Sample project with full support for lifecycle and rapid development of Platform/Repository JARs and AMPs (Alfresco Module Packages))
5: remote -> org.alfresco.maven.archetype:alfresco-share-jar-archetype (Share project with full support for lifecycle and rapid development of JARs and AMPs (Alfresco Module
        Packages))
6: remote -> org.alfresco.maven.archetype:share-amp-archetype (Share project with full support for lifecycle and rapid development of AMPs (Alfresco Module
        Packages))

3- Select '14' for the SDK version as 4.1.0

Choose org.alfresco.maven.archetype:alfresco-allinone-archetype version:
1: 2.0.0-beta-1
2: 2.0.0-beta-2
3: 2.0.0-beta-3
4: 2.0.0-beta-4
5: 2.0.0
6: 2.1.0
7: 2.1.1
8: 2.2.0
9: 3.0.0
10: 3.0.1
11: 3.1.0
12: 4.0.0-beta-1
13: 4.0.0
14: 4.1.0
Choose a number: 14:

4- Provide 'groupId'

Define value for property 'groupId':

e.g. com.demo.aio.sdk4

5- Provide the 'artifactId' (name of your project)

Define value for property 'artifactId':

e.g.: sdk4-aio-project

6- Provide package:

Define value for property 'package' com.demo.aio.sdk4: :

Keep as is. Press enter.

7- You will be asked to confirm the properties:

Confirm properties configuration:
groupId: com.demo.aio.sdk4
artifactId: sdk4-aio-project
version: 1.0-SNAPSHOT
package: com.demo.aio.sdk4
 Y: :

Press 'Y', if everything looks good. A sample project will be generated. 

8- Import them in eclipse and get started.

Note: SDK4.x is based on docker and docker-compose.

In Addition, check to see if there JDK is properly configured in your eclipse. 

Note: JDK 11 is recommended for SDK4.1.0

Have a look at this doc as well: https://hub.alfresco.com/t5/alfresco-content-services-hub/alfresco-sdk-4-0/ba-p/289257

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

Had similar issue sometimes back. Thanks for sharing these steps