Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enunciate 2.13.2 issue with java 8 #1084

Closed
amrtham opened this issue Mar 17, 2021 · 28 comments
Closed

enunciate 2.13.2 issue with java 8 #1084

amrtham opened this issue Mar 17, 2021 · 28 comments
Labels
Milestone

Comments

@amrtham
Copy link

amrtham commented Mar 17, 2021

i am using 2.13.2 and getting below issue

It's recommended that you customize the name of one of these types using the @XmlType annotation

java.lang.RuntimeException: com.webcohesion.enunciate.EnunciateException: Compile failed of Java client-side classes.

below is my enunciate.xml

    <modules>
            <!-- Documentation -->
            <!--       <jackson disabled="true"/>
            -->         <jaxb datatype-detection="aggressive" />
                <jaxrs datatype-detection="aggressive"/>

    <jaxws datatype-detection="aggressive" />
<jackson disabled="true"/> 
    </modules>
@stoicflame
Copy link
Owner

What's the source code on which the compile is failing?

@stoicflame stoicflame added the bug label Mar 17, 2021
@stoicflame stoicflame added this to the 2.14.0 milestone Mar 17, 2021
@amrtham
Copy link
Author

amrtham commented Mar 17, 2021

Which version do you recomned for java 8
my earlier version was 1.26

@stoicflame
Copy link
Owner

The latest version (2.13.3) will work fine with Java 8.

@amrtham
Copy link
Author

amrtham commented Mar 17, 2021

i have modified the xml as below and see below error

    <modules>
            <!-- Documentation -->
             <jackson disabled="true"/>

java.lang.RuntimeException: com.webcohesion.enunciate.EnunciateException: freemarker.core._TemplateModelException: An error has occurred when reading existing sub-variable "resourceGroups"; see cause exception! The type of the containing value was: extended_hash+string (com.webcohesion.enunciate.modules.jaxrs.api.impl.JaxrsResourceApi wrapped into f.e.b.StringModel)

@stoicflame
Copy link
Owner

I'm afraid I still don't have enough visibility into the issue to be helpful. I'm going to need to have some way to reproduce the problem so I can see deeper into what's going on.

My best guess is that the classpath is messed up.

@amrtham
Copy link
Author

amrtham commented Mar 17, 2021

i have verified and class path is actually having the Enunciate jars .

i see this

Enabled modules: [docs, gwt-json-overlay, idl, jackson1, java-json-client, java-xml-client, javascript-client, jaxrs, spring-web, swagger]
Some source files were not found for the Java classes that define the Web service API.
Enunciate will be unable to find the documentation for the classes that are missing source files. (For details, rebuild with debug-level logging.)
In order for Enunciate to find the source files for API classes that are not being compiled in the current project, the source file must be on the Enunciate sourcepath and the class must be explicitly included in the Enunciate configuration.
For more information, see https://github.com/stoicflame/enunciate/wiki/Discovering-Source-Files
No JAXB XML data types: Java XML client will not be generated.

Can you please clarify me


what is to be referred in the buildDir . is it the source of the files for what we need the docs to be generated.

@stoicflame
Copy link
Owner

buildDir is where you're telling Enunciate to write its output.

@amrtham
Copy link
Author

amrtham commented Mar 17, 2021

earlier i was using 1.26.2 with java 7 and i defined the task as

<taskdef name="enunciate" classname="org.codehaus.enunciate.main.EnunciateTask">

Now i am using 2.13.2 with java 8 and i defined the task as

<taskdef name="enunciate" classname="com.webcohesion.enunciate.EnunciateTask">

any issue

@amrtham
Copy link
Author

amrtham commented Mar 17, 2021

please confirm if it is fine i will try with 2.13.3.

@stoicflame
Copy link
Owner

That's the correct Ant task.

@amrtham
Copy link
Author

amrtham commented Mar 18, 2021

i tried with 2.13.3 and getting below error

java.lang.RuntimeException: com.webcohesion.enunciate.EnunciateException: Compile failed of Java client-side classes.

@stoicflame
Copy link
Owner

Please include the output of the compile failure. What's the source code failing to compile?

@amrtham
Copy link
Author

amrtham commented Mar 18, 2021

[ENUNCIATE] Using enunciate configuration at /home/enu1.3/core/wls/management/build/enunciate_config.xml
Enabled modules: [docs, gwt-json-overlay, idl, jackson, jackson1, java-json-client, java-xml-client, javascript-client, jaxb, jaxrs, jaxws, spring-web, swagger]

Both Jackson 1 and Jackson 2 Enunciate modules are enabled.
This may cause duplicated and/or inconsistent JSON documentation.
It is recommended that you disable one of the modules by either
pruning your classpath of one of the versions of the Jackson
library, or by explicitly disabling one of the modules in the
Enunciate configuration file. For more information, see
https://github.com/stoicflame/enunciate/wiki/Two-JSON-Sections

Some source files were not found for the Java classes that define the Web service API.
Enunciate will be unable to find the documentation for the classes that are missing source files. (For details, rebuild with debug-level logging.)
In order for Enunciate to find the source files for API classes that are not being compiled in the current project, the source file must be on the Enunciate sourcepath and the class must be explicitly included in the Enunciate configuration.
For more information, see https://github.com/stoicflame/enunciate/wiki/Discovering-Source-Files
Unable to find source file for java.lang.Package.
Unable to find source file for com.tmp.xmlns.webservices.jaxws_databinding.XmlOneway.
Unable to find source file for com.tmp.xmlns.webservices.jaxws_databinding.XmlRequestWrapper.
[enunciate] /home/enu1.3/core/wls/management/build/tmp/java-json-client/src/java/lang/reflect/TypeVariable.java:22: error: illegal start of type
[enunciate] private ? _genericDeclaration;
[enunciate] ^
[enunciate] /home/enu1.3/core/wls/management/build/tmp/java-json-client/src/java/lang/reflect/TypeVariable.java:22: error: ';' expected
[enunciate] private ? _genericDeclaration;
[enunciate] ^
[enunciate] /home/enu1.3/core/wls/management/build/tmp/java-json-client/src/java/lang/reflect/TypeVariable.java:62: error: illegal start of type
[enunciate] public ? getGenericDeclaration() {

@amrtham
Copy link
Author

amrtham commented Mar 18, 2021

Request you to help me with this issue.

@stoicflame
Copy link
Owner

The compile failure seems to be caused because Enunciate is attempting to document the java.lang.reflect.TypeVariable class as part of your API. I suspect you're trying to document classes that shouldn't be included in the API. You'll want to exclude those classes from the documentation.

You can do this by looking through the output of mvn -X and noting all the messages that look like:

Added [class name] as a [IDL type].

Exclude any classes that shouldn't be part of your API.

The resourceGroups error is something I've never seen before, nor can I reproduce it locally. Again, my best guess is that you're building the Enunciate classpath incorrectly, perhaps referencing older jars.

@stoicflame
Copy link
Owner

Looks like you're making progress.

Now it's down to Enunciate generating bad client-side code, but I can't tell why. What does the WsApi class look like? The one with the repositoryImportAssembly, etc. methods?

@amrtham
Copy link
Author

amrtham commented Mar 19, 2021

It is all having @XmlAccessorType ,@xmlType,@xmlelement

@stoicflame
Copy link
Owner

Can you share the source code for it?

@amrtham
Copy link
Author

amrtham commented Mar 19, 2021

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;


@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "repo", propOrder = {
    "id",
    "url",
    "proxy"
})
public class repo{
	//some setters and getters
}

@stoicflame
Copy link
Owner

Hmmm... still not enough for me to see what's going on.

Isn't there a class named Ws or WsApi or something like that with methods named repositoryImportAssembly, repositoryImportVm, and repositoryImportVirtualDisk?

@amrtham
Copy link
Author

amrtham commented Mar 19, 2021

Yes there is a class Wsapi and wsapiImpl in which all these methods are referred
as

  @WebMethod
    @WebResult(name = "job")
    Job repo(@WebParam(name = "repositoryId") @XmlElement(required = true) Id<Repository> repositoryId,
                                 @WebParam(name = "url") @XmlElement(required = true) String url,
                                 @WebParam(name = "proxy") String proxy) throws WsException;

@stoicflame
Copy link
Owner

Okay, I see now.

Tracking the bug at #1085.

Current workaround is to rename the parameter. (I.e. don't have a parameter named proxy).

@amrtham
Copy link
Author

amrtham commented Mar 19, 2021

ok. Can you just brief me about the issue little and let me know when it can be fixed

@stoicflame
Copy link
Owner

I don't have a schedule for when it will get fixed. You're welcome to watch the issue to get updates.

@amrtham
Copy link
Author

amrtham commented Mar 22, 2021

I tried with the rename and it worked fine .
i have one more issue
eaaalier i have some link documents generated with the naming convention as ns0-<> and now they are generated with json-<> .How to change them
And soap documentation is not generated

@stoicflame
Copy link
Owner

i have some link documents generated with the naming convention as ns0-<> and now they are generated with json-<> .How to change them

You can't. It's hard-coded for now.

And soap documentation is not generated.

Yeah, because you disabled the jaxws module in your config.

@amrtham
Copy link
Author

amrtham commented Mar 22, 2021

no i have not disabled

<modules>
          <!-- Documentation -->
        <docs
           splashPackage="com.mgr.ws"
           title=" Web Services API @version@"
           copyright="mydoc" />
<docs includeApplicationPath="true"/>       </modules>

@stoicflame
Copy link
Owner

Your previous comment had it disabled.

When you run with debug output, you should see messages like "Added [classname] as a JAX-WS endpoint interface." Can you confirm?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants