+1 for improving the error message

Thanks

Il lun 15 mag 2023, 17:13 Petr Kuzel <petrku...@eurofins.com.invalid> ha
scritto:

> Hi Claus,
>
> that I suspected and have already ruled out prior asking, I had:
>
> @Component("azureFiles")
> public class FilesComponent extends RemoteFileComponent<ShareFileItem> {
>
>
> Looking at source of the exception:
>
>         // these information is not available at compile time and we enrich
>         // these later during the camel-package-maven-plugin
>         if (model.getJavaType() == null) {
>             throw new IllegalStateException("Could not find component java
> type");
>         }
>
> and a bit around, it really searches for Component annotations:
>
>         // get the java type class name via the @Component annotation from
> its
>         // component class
>         for (AnnotationInstance ai : getIndex().getAnnotations(COMPONENT))
> {
>             String[] cschemes = ai.value().asString().split(",");
>             if (Arrays.asList(cschemes).contains(scheme) &&
> ai.target().kind() == AnnotationTarget.Kind.CLASS) {
>                 String name = ai.target().asClass().name().toString();
>                 model.setJavaType(name);
>                 break;
>             }
>         }
>
> OK, the trick is that split Component value must match endpoint scheme.
>
> Indeed:
>
> @Component("azure-files")
> public class FilesComponent extends RemoteFileComponent<ShareFileItem> {
>
> resolves the problem.
>
> I would propose a more clear error message:
>
>     throw new IllegalStateException("Could not find @Component(" + scheme
> + ") annotated class.");
>
> Would it make sense? I could create a RFE for that.
>
> Thank you.
>
>   Hope it helps
>   Cc.
>
> --
>   Mr. Petr Kužel, Software Engineer
>   Eurofins International Support Services s.à r.l.
>   Val Fleuri 23
>   L-1526 LUXEMBOURG
>
> -----Original Message-----
> From: Claus Ibsen <claus.ib...@gmail.com>
> Sent: Monday, May 15, 2023 16:21
> To: dev@camel.apache.org
> Subject: Re: What is the recommended way to depend on Java 11, pls?
>
>
>
> CAUTION: EXTERNAL EMAIL - Sent from an email domain that is not formally
> trusted by Eurofins.
>
> Do not click on links or open attachments unless you recognise the sender
> and are certain that the content is safe.
>
> Hi
>
> The component class also needs an annotation, see the other components how
> they do it
>
> On Mon, May 15, 2023 at 2:15 PM Petr Kuzel <petrku...@eurofins.com
> .invalid>
> wrote:
>
> > OK, thx. I have switched to 3.x
> >
> >     <parent>
> >         <groupId>org.apache.camel</groupId>
> >         <artifactId>camel-azure-parent</artifactId>
> >         <version>3.21.0-SNAPSHOT</version>
> >     </parent>
> >
> > But still facing maven errors in generate:
> >
> > [ [1;31mERROR [m] Failed to execute goal
> > [32morg.apache.camel:camel-package-maven-plugin:3.21.0-SNAPSHOT:generate
> > [m  [1m(generate) [m on project  [36mcamel-azure-files [m:  [1;31mError
> > generating data org.apache.maven.plugin.MojoFailureException: Unable to
> > create mojo [m: Could not find component java type ->  [1m[Help 1] [m
> >
> > ...
> >  [1mCaused by [m: org.apache.maven.plugin.MojoFailureException:
> > [1;31mError generating data org.apache.maven.plugin.MojoFailureException:
> > Unable to create mojo [m
> > ...
> >  [1mCaused by [m: org.apache.maven.plugin.MojoFailureException:
> > [1;31mUnable to create mojo [m
> > ...
> >  [1mCaused by [m: java.lang.IllegalStateException:  [1;31mCould not find
> > component java type [m
> >      [1mat [m
> >
> org.apache.camel.maven.packaging.EndpointSchemaGeneratorMojo.findComponentProperties
> > ( [1mEndpointSchemaGeneratorMojo.java:872 [m)
> >      [1mat [m
> >
> org.apache.camel.maven.packaging.EndpointSchemaGeneratorMojo.writeJSonSchemeAndPropertyConfigurer
> > ( [1mEndpointSchemaGeneratorMojo.java:257 [m)
> >      [1mat [m
> >
> org.apache.camel.maven.packaging.EndpointSchemaGeneratorMojo.processSchemas
> > ( [1mEndpointSchemaGeneratorMojo.java:204 [m)
> >      [1mat [m
> >
> org.apache.camel.maven.packaging.EndpointSchemaGeneratorMojo.executeUriEndpoint
> > ( [1mEndpointSchemaGeneratorMojo.java:183 [m)
> >      [1mat [m
> > org.apache.camel.maven.packaging.EndpointSchemaGeneratorMojo.execute (
> > [1mEndpointSchemaGeneratorMojo.java:141 [m)
> >      [1mat [m
> > org.apache.camel.maven.packaging.AbstractGeneratorMojo.execute (
> > [1mAbstractGeneratorMojo.java:98 [m)
> >      [1mat [m
> org.apache.camel.maven.packaging.AbstractGenerateMojo.invoke
> > ( [1mAbstractGenerateMojo.java:96 [m)
> >      [1mat [m
> org.apache.camel.maven.packaging.AbstractGenerateMojo.invoke
> > ( [1mAbstractGenerateMojo.java:75 [m)
> >      [1mat [m org.apache.camel.maven.packaging.GenerateMojo.doExecute (
> > [1mGenerateMojo.java:46 [m)
> >      [1mat [m
> > org.apache.camel.maven.packaging.AbstractGenerateMojo.execute (
> > [1mAbstractGenerateMojo.java:64 [m)
> >      [1mat [m
> > org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (
> > [1mDefaultBuildPluginManager.java:137 [m)
> >      [1mat [m org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2
> > ( [1mMojoExecutor.java:370 [m)
> >      [1mat [m org.apache.maven.lifecycle.internal.MojoExecutor.doExecute
> (
> > [1mMojoExecutor.java:351 [m)
> >      [1mat [m org.apache.maven.lifecycle.internal.MojoExecutor.execute (
> > [1mMojoExecutor.java:215 [m)
> >      [1mat [m org.apache.maven.lifecycle.internal.MojoExecutor.execute (
> > [1mMojoExecutor.java:171 [m)
> >      [1mat [m org.apache.maven.lifecycle.internal.MojoExecutor.execute (
> > [1mMojoExecutor.java:163 [m)
> >      [1mat [m
> > org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (
> > [1mLifecycleModuleBuilder.java:117 [m)
> >      [1mat [m
> > org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (
> > [1mLifecycleModuleBuilder.java:81 [m)
> >      [1mat [m
> >
> org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build
> > ( [1mSingleThreadedBuilder.java:56 [m)
> >      [1mat [m
> org.apache.maven.lifecycle.internal.LifecycleStarter.execute
> > ( [1mLifecycleStarter.java:128 [m)
> >      [1mat [m org.apache.maven.DefaultMaven.doExecute (
> > [1mDefaultMaven.java:294 [m)
> >      [1mat [m org.apache.maven.DefaultMaven.doExecute (
> > [1mDefaultMaven.java:192 [m)
> >      [1mat [m org.apache.maven.DefaultMaven.execute (
> > [1mDefaultMaven.java:105 [m)
> >      [1mat [m org.apache.maven.cli.MavenCli.execute (
> [1mMavenCli.java:960
> > [m)
> >      [1mat [m org.apache.maven.cli.MavenCli.doMain ( [1mMavenCli.java:293
> > [m)
> >      [1mat [m org.apache.maven.cli.MavenCli.main ( [1mMavenCli.java:196
> [m)
> > ...
> >
> > My UriEndpoint annotation reads:
> >
> > // TODO , extendsScheme = "file"   FTP has it, AzureBlob does not have
> > it...
> > @UriEndpoint(firstVersion = "4.0.0", scheme = "azure-files", title =
> > "Azure Files",
> >              syntax = "azure-files:host/share",
> >              category = { Category.CLOUD, Category.FILE }, headersClass =
> > FilesConstants.class)
> >
> > Any clue, please?
> >
> >   Cc.
> >
> > --
> >   Mr. Petr Kužel, Software Engineer
> >   Eurofins International Support Services s.à r.l.
> >   Val Fleuri 23
> >   L-1526 LUXEMBOURG
> >
> > -----Original Message-----
> > From: Andrea Cosentino <anco...@gmail.com>
> > Sent: Friday, May 12, 2023 20:11
> > To: dev <dev@camel.apache.org>
> > Subject: Re: What is the recommended way to depend on Java 11, pls?
> >
> >
> >
> > CAUTION: EXTERNAL EMAIL - Sent from an email domain that is not formally
> > trusted by Eurofins.
> >
> > Do not click on links or open attachments unless you recognise the sender
> > and are certain that the content is safe.
> >
> > I meant to say 3.x sorry
> >
> > Il ven 12 mag 2023, 19:43 Claus Ibsen <claus.ib...@gmail.com> ha
> scritto:
> >
> > > Hi
> > >
> > > If you build a new component then we only accept this for new releases,
> > eg
> > > 3.21 and 4.0.
> > > Camel 4.0 requires Java 17 and Camel 3.x is Java 11.
> > >
> > > If you can only work with Java 11, then use camel-3.x branch (eg Camel
> > > 3.21), and then we need to look later how to forward merge this to
> Camel
> > v4
> > >
> > >
> > > On Fri, May 12, 2023 at 6:15 PM Petr Kuzel <petrku...@eurofins.com
> > > .invalid>
> > > wrote:
> > >
> > > > I remember that advice but relaxing related corporate
> > > > constraints is not an easy job and it will not happen
> > > > over a night.
> > > >
> > > > I've experimented B:
> > > >
> > > >     <parent>
> > > >         <groupId>org.apache.camel</groupId>
> > > >         <artifactId>camel-azure-parent</artifactId>
> > > >         <version>3.20.5-SNAPSHOT</version>
> > > >     </parent>
> > > >
> > > > and got stopped by:
> > > >
> > > > [ [1;34mINFO [m] No previous run data found, generating files.
> > > > [ [1;34mINFO [m] Building index...
> > > > ...
> > > > [ [1;31mERROR [m] Failed to execute goal
> > > >
> > [32morg.apache.camel:camel-package-maven-plugin:3.20.5-SNAPSHOT:generate
> > > > [m  [1m(generate) [m on project  [36mcamel-azure-files [m:
> [1;31mError
> > > > generating data org.apache.maven.plugin.MojoFailureException: Unable
> to
> > > > create mojo [m: Could not find component java type ->  [1m[Help 1] [m
> > > >
> > > >
> > > > The signature and scenario matches
> > > > https://issues.apache.org/jira/browse/CAMEL-15043.
> > > > (But so far I have not got how it was resolved).
> > > >
> > > >   Cc.
> > > >
> > > > --
> > > >   Mr. Petr Kužel, Software Engineer
> > > >   Eurofins International Support Services s.à r.l.
> > > >   Val Fleuri 23
> > > >   L-1526 LUXEMBOURG
> > > >
> > > > -----Original Message-----
> > > > From: Andrea Cosentino <anco...@gmail.com>
> > > > Sent: Friday, May 12, 2023 17:30
> > > > To: dev@camel.apache.org
> > > > Subject: Re: What is the recommended way to depend on Java 11, pls?
> > > >
> > > >
> > > >
> > > > CAUTION: EXTERNAL EMAIL - Sent from an email domain that is not
> > formally
> > > > trusted by Eurofins.
> > > >
> > > > Do not click on links or open attachments unless you recognise the
> > sender
> > > > and are certain that the content is safe.
> > > >
> > > > I would focus on Java 17 and backport on old LTS branch 3.18.x and
> > 3.20.x
> > > > later.
> > > >
> > > > Il giorno ven 12 mag 2023 alle ore 16:55 Petr Kuzel
> > > > <petrku...@eurofins.com.invalid> ha scritto:
> > > >
> > > > > After fixing all syntax errors, compiler revealed:
> > > > >
> > > > >     [ [1;31mERROR [m]
> > > > >
> > > >
> > >
> >
> /C:/d/git/external/camel/components/camel-azure/camel-azure-files/src/main/java/org/apache/camel/component/file/azure/FilesEndpoint.java:[22,24]
> > > > > cannot access org.apache.camel.Category
> > > > >       bad class file:
> > > > >
> > > >
> > >
> >
> C:\Users\petr\.m2\repository\org\apache\camel\camel-api\4.0.0-SNAPSHOT\camel-api-4.0.0-SNAPSHOT.jar(/org/apache/camel/Category.class)
> > > > >         class file has wrong version 61.0, should be 55.0
> > > > >         Please remove or make sure it appears in the correct
> > > subdirectory
> > > > > of the classpath.
> > > > >
> > > > > i.e. the camel api 4.x was compiled to target Java 17.
> > > > >
> > > > > I guess I have two options:
> > > > >
> > > > >   A: retry in one of 3.{15,16,17,18,19}.x branches
> > > > >   B: ask for installation of  Java 17 tool chain and continue on
> main
> > > > >
> > > > >   Cc.
> > > > >
> > > > > --
> > > > >   Mr. Petr Kužel, Software Engineer
> > > > >   Eurofins International Support Services s.à r.l.
> > > > >   Val Fleuri 23
> > > > >   L-1526 LUXEMBOURG
> > > > >
> > > > > -----Original Message-----
> > > > > From: Petr Kuzel <petrku...@eurofins.com.INVALID>
> > > > > Sent: Friday, May 12, 2023 12:02
> > > > > To: dev@camel.apache.org
> > > > > Subject: RE: What is the recommended way to depend on Java 11, pls?
> > > > >
> > > > >
> > > > >
> > > > > CAUTION: EXTERNAL EMAIL - Sent from an email domain that is not
> > > formally
> > > > > trusted by Eurofins.
> > > > >
> > > > > Do not click on links or open attachments unless you recognise the
> > > sender
> > > > > and are certain that the content is safe.
> > > > >
> > > > > In pom.xml (derived from camel-azure-storage-blob pom.xml) having:
> > > > >
> > > > >     <properties>
> > > > > <!--        <jdk.version>11</jdk.version> it was a mere guess
> looking
> > > at
> > > > > effective pom with camel-azure-parent -->
> > > > >         <maven.compiler.source>11</maven.compiler.source>
> > > > >         <maven.compiler.target>11</maven.compiler.target>
> > > > >     </properties>
> > > > >
> > > > > after:
> > > > >
> > > > >     <parent>
> > > > >         <groupId>org.apache.camel</groupId>
> > > > >         <artifactId>camel-azure-parent</artifactId>
> > > > >         <version>4.0.0-SNAPSHOT</version>
> > > > >     </parent>
> > > > >
> > > > > results in unexpected Java 8.
> > > > >
> > > > > If I remove the parent element,
> > > > > then inline groupId, version,
> > > > > and all dependency/version-s
> > > > > it results in expected Java 11.
> > > > > But I do not find such inlining well
> > > > > maintainable.
> > > > >
> > > > >   Cc.
> > > > >
> > > > > --
> > > > >   Mr. Petr Kužel, Software Engineer
> > > > >   Eurofins International Support Services s.à r.l.
> > > > >   Val Fleuri 23
> > > > >   L-1526 LUXEMBOURG
> > > > >
> > > > > -----Original Message-----
> > > > > From: Nicolas Filotto <nfilo...@talend.com>
> > > > > Sent: Friday, May 12, 2023 11:12
> > > > > To: dev@camel.apache.org
> > > > > Subject: Re: What is the recommended way to depend on Java 11, pls?
> > > > >
> > > > >
> > > > >
> > > > > CAUTION: EXTERNAL EMAIL - Sent from an email domain that is not
> > > formally
> > > > > trusted by Eurofins.
> > > > >
> > > > > Do not click on links or open attachments unless you recognise the
> > > sender
> > > > > and are certain that the content is safe.
> > > > >
> > > > > Have you tried to set the properties maven.compiler.source,
> > > > > maven.compiler.target, and maven.compiler.release like
> > > > > https://github.com/apache/camel/blob/main/pom.xml#L114-L116? See
> the
> > > > > compiler plugin documentation for more details
> > > > >
> > >
> https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html
> > > > > [
> > > > >
> > > >
> > >
> >
> https://opengraph.githubassets.com/e5d400780d6259a437dde976fdb2b9578500cb8781471f86fd1b266a581f6b0a/apache/camel
> > > > > ]<https://github.com/apache/camel/blob/main/pom.xml#L114-L116>
> > > > > camel/pom.xml at main · apache/camel<
> > > > > https://github.com/apache/camel/blob/main/pom.xml#L114-L116>
> > > > > Apache Camel is an open source integration framework that empowers
> > you
> > > to
> > > > > quickly and easily integrate various systems consuming or producing
> > > > data. -
> > > > > camel/pom.xml at main · apache/camel
> > > > > github.com
> > > > >
> > > > > ________________________________
> > > > > From: Petr Kuzel <petrku...@eurofins.com.INVALID>
> > > > > Sent: Friday, May 12, 2023 10:22
> > > > > To: dev@camel.apache.org <dev@camel.apache.org>
> > > > > Subject: RE: What is the recommended way to depend on Java 11, pls?
> > > > >
> > > > > Hi Nicolas,
> > > > >
> > > > > I have meant Java 11. I assume the Java backward compatibility
> > > > > allows me to target Java 11 regardless that some other Camel 4
> > > > > components require Java 17.
> > > > >
> > > > >  (I plan to backport to Camel 3.16+.) A good point after all.
> > > > >
> > > > >   Hope it helps
> > > > >   Cc.
> > > > >
> > > > > --
> > > > >   Mr. Petr Kužel, Software Engineer
> > > > >   Eurofins International Support Services s.à r.l.
> > > > >   Val Fleuri 23
> > > > >   L-1526 LUXEMBOURG
> > > > >
> > > > > -----Original Message-----
> > > > > From: Nicolas Filotto <nfilo...@talend.com>
> > > > > Sent: Friday, May 12, 2023 10:14
> > > > > To: dev@camel.apache.org
> > > > > Subject: Re: What is the recommended way to depend on Java 11, pls?
> > > > >
> > > > >
> > > > >
> > > > > CAUTION: EXTERNAL EMAIL - Sent from an email domain that is not
> > > formally
> > > > > trusted by Eurofins.
> > > > >
> > > > > Do not click on links or open attachments unless you recognise the
> > > sender
> > > > > and are certain that the content is safe.
> > > > >
> > > > > Did you mean Java 17? As stated in the page that you are referring
> > to,
> > > > > Camel 4 only supports Java 17+
> > > > > ________________________________
> > > > > From: Petr Kuzel <petrku...@eurofins.com.INVALID>
> > > > > Sent: Friday, May 12, 2023 10:10
> > > > > To: dev@camel.apache.org <dev@camel.apache.org>
> > > > > Subject: What is the recommended way to depend on Java 11, pls?
> > > > >
> > > > > Hi Camel devs,
> > > > >
> > > > > I have cloned the Camel FTP and Azure components
> > > > > blending them together to develop a new Azure Files
> > > > > component.
> > > > >
> > > > > When I use
> > > > >
> > > > >     <parent>
> > > > >         <groupId>org.apache.camel</groupId>
> > > > >         <artifactId>camel-azure-parent</artifactId>
> > > > >         <version>4.0.0-SNAPSHOT</version>
> > > > >     </parent>
> > > > >
> > > > >     <properties>
> > > > >     </properties>
> > > > >
> > > > > Eclipse maven project leaves me with Java 8.  But I'd like
> > > > > to use Java 11. (the dep on 11 is aligned with
> > > > >
> > > > >
> > > >
> > >
> >
> https://urldefense.com/v3/__https://camel.apache.org/manual/what-are-the-dependencies.html__;!!CiXD_PY!X4fmazwO2q9nXiI2v8iAzLBcV6DJ9HvlHaxt8SUV5qpUDfn8cXEgoJgnhvxMmitudjrWdheG5fdCuN1t15ZkU-PBUw$
> > > > > )
> > > > >
> > > > > Should I specify any properties, or ask for
> > > > > updating of camel-azure-parent,
> > > > > or declare it out-of-bound in Eclipse, pls?
> > > > >
> > > > >   Regards
> > > > >   Cc.
> > > > >
> > > > > --
> > > > >   Mr. Petr Kužel, Software Engineer
> > > > >   Eurofins International Support Services s.à r.l.
> > > > >   Val Fleuri 23
> > > > >   L-1526 LUXEMBOURG
> > > > >
> > > > >
> > > > > As a recipient of an email from the Talend Group, your personal
> data
> > > will
> > > > > be processed by our systems. Please see our Privacy Notice <
> > > > > https://www.talend.com/privacy-policy/> for more information about
> > our
> > > > > collection and use of your personal information, our security
> > > practices,
> > > > > and your data protection rights, including any rights you may have
> to
> > > > > object to automated-decision making or profiling we use to analyze
> > > > support
> > > > > or marketing related communications. To manage or discontinue
> > > promotional
> > > > > communications, use the communication preferences portal<
> > > > > https://info.talend.com/emailpreferencesen.html>. To exercise your
> > > data
> > > > > protection rights, use the privacy request form<
> > > > >
> > > >
> > >
> >
> https://urldefense.com/v3/__https://talend.my.onetrust.com/webform/ef906c5a-de41-4ea0-ba73-96c079cdd15a/b191c71d-f3cb-4a42-9815-0c3ca021704cl__;!!CiXD_PY!QmTQSzQryZO9HtF6rAgA3ndt3m0IHTQEl5Af06czFcQ6pyGzWld-DGLkUhozMUvG8qN4rZ6lnrTBnV1KJqlvQlmO2Q$
> > > > > >. Contact us here <https://www.talend.com/contact/> or by mail to
> > > > either
> > > > > of our co-headquarters: Talend, Inc.: 400 South El Camino Real, Ste
> > > 1400,
> > > > > San Mateo, CA 94402; Talend SAS: 5/7 rue Salomon De Rothschild,
> 92150
> > > > > Suresnes, France
> > > > >
> > > > > As a recipient of an email from the Talend Group, your personal
> data
> > > will
> > > > > be processed by our systems. Please see our Privacy Notice <
> > > > > https://www.talend.com/privacy-policy/> for more information about
> > our
> > > > > collection and use of your personal information, our security
> > > practices,
> > > > > and your data protection rights, including any rights you may have
> to
> > > > > object to automated-decision making or profiling we use to analyze
> > > > support
> > > > > or marketing related communications. To manage or discontinue
> > > promotional
> > > > > communications, use the communication preferences portal<
> > > > > https://info.talend.com/emailpreferencesen.html>. To exercise your
> > > data
> > > > > protection rights, use the privacy request form<
> > > > >
> > > >
> > >
> >
> https://talend.my.onetrust.com/webform/ef906c5a-de41-4ea0-ba73-96c079cdd15a/b191c71d-f3cb-4a42-9815-0c3ca021704cl
> > > > >.
> > > > > Contact us here <https://www.talend.com/contact/> or by mail to
> > either
> > > > of
> > > > > our co-headquarters: Talend, Inc.: 400 South El Camino Real, Ste
> > 1400,
> > > > San
> > > > > Mateo, CA 94402; Talend SAS: 5/7 rue Salomon De Rothschild, 92150
> > > > Suresnes,
> > > > > France
> > > > >
> > > >
> > >
> > >
> > > --
> > > Claus Ibsen
> > > -----------------
> > > @davsclaus
> > > Camel in Action 2: https://www.manning.com/ibsen2
> > >
> >
>
>
> --
> Claus Ibsen
> -----------------
> @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>

Reply via email to