camel-tooling / vscode-wsdl2rest

Deprecated - VS Code extension that provides access to the jboss-fuse/wsdl2rest utility to generate a Camel Rest DSL configuration
Apache License 2.0
1 stars 7 forks source link

Issue with Velocity failure #4

Closed bfitzpat closed 5 years ago

bfitzpat commented 5 years ago
[DEBUG] WSDL File URI: file:///c%3A/Users/brianf/Documents/GitHub/generator-camel-project-fork/test/helloworld.wsdl
(node:5700) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
[DEBUG] DSL Type: Spring
[DEBUG] Ouput Folder: src/main/java
[DEBUG] JAXWS Endpoint: http://localhost:8080/somepath
[DEBUG] JAXRS Endpoint: http://localhost:8081/jaxrs
[DEBUG] Log4J Config: file:///c:/Users/brianf/Documents/GitHub/vscode-wsdl2rest/jars/log4j.properties
[DEBUG] Java Binary: C:\Program Files\Java\jdk1.8.0_162\bin\java
[DEBUG] WSDL2Rest JAR: c:\Users\brianf\Documents\GitHub\vscode-wsdl2rest\jars\wsdl2rest.jar
[DEBUG] Java Call: C:\Program Files\Java\jdk1.8.0_162\bin\java file:///c:/Users/brianf/Documents/GitHub/vscode-wsdl2rest/jars/log4j.properties -jar c:\Users\brianf\Documents\GitHub\vscode-wsdl2rest\jars\wsdl2rest.jar
[DEBUG] Retrieving document at 'file:/c%3A/Users/brianf/Documents/GitHub/generator-camel-project-fork/test/helloworld.wsdl'.

[DEBUG] 07:44:39  INFO [main] - Services: 

[DEBUG] 07:44:39  INFO [main] -     HelloService

[DEBUG] 07:44:39  INFO [main] -     Port: HelloPort

[DEBUG] 07:44:39  INFO [main] -     Binding: HelloPortType

[DEBUG] 07:44:39  INFO [main] -     PortType: HelloPortType

[DEBUG] 07:44:39  INFO [main] -     Operations: 

[DEBUG] 07:44:39  INFO [main] -         Operation: sayHello

[DEBUG] 07:44:39  INFO [main] -             Input: 

[DEBUG] 07:44:39  INFO [main] -             Message: SayHelloRequest

07:44:39  INFO [main] -             Part: :firstName

07:44:39  INFO [main] -                 Params: java.lang.String firstName

[DEBUG] 07:44:39  INFO [main] -             Output: 

[DEBUG] 07:44:39  INFO [main] -             Message: SayHelloResponse

[DEBUG] 07:44:39  INFO [main] -             Part: :greeting

[DEBUG] 07:44:39  INFO [main] -                 Params: java.lang.String greeting

[DEBUG] 07:44:39  INFO [main] -             Faults: 

[DEBUG] 07:44:42 ERROR [main] - Error executing command

org.apache.velocity.exception.VelocityException: Error initializing log: Failed to initialize an instance of org.apache.velocity.runtime.log.Log4JLogChute with the current runtime configuration.

    at org.apache.velocity.runtime.RuntimeInstance.initializeLog(RuntimeInstance.java:875)

    at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:262)

    at org.apache.velocity.app.VelocityEngine.init(VelocityEngine.java:93)

    at org.jboss.fuse.wsdl2rest.impl.codegen.CamelContextGenerator.process(CamelContextGenerator.java:67)

    at org.jboss.fuse.wsdl2rest.impl.Wsdl2Rest.process(Wsdl2Rest.java:103)

    at org.jboss.fuse.wsdl2rest.impl.Main.mainInternal(Main.java:60)

    at org.jboss.fuse.wsdl2rest.impl.Main.main(Main.java:36)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

    at java.lang.reflect.Method.invoke(Method.java:498)

    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)

    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)

    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)

    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)

Caused by: org.apache.velocity.exception.VelocityException: Failed to initialize an instance of org.apache.velocity.runtime.log.Log4JLogChute with the current runtime configuration.

    at org.apache.velocity.runtime.log.LogManager.createLogChute(LogManager.java:220)

    at org.apache.velocity.runtime.log.LogManager.updateLog(LogManager.java:269)

    at org.apache.velocity.runtime.RuntimeInstance.initializeLog(RuntimeInstance.java:871)

    ... 14 more

Caused by: java.lang.RuntimeException: Error configuring Log4JLogChute : 

    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

    at org.apache.velocity.util.ExceptionUtils.createWithCause(ExceptionUtils.java:67)

    at org.apache.velocity.util.ExceptionUtils.createRuntimeException(ExceptionUtils.java:45)

    at org.apache.velocity.runtime.log.Log4JLogChute.initAppender(Log4JLogChute.java:133)

    at org.apache.velocity.runtime.log.Log4JLogChute.init(Log4JLogChute.java:85)

    at org.apache.velocity.runtime.log.LogManager.createLogChute(LogManager.java:157)

    ... 16 more

Caused by: java.io.FileNotFoundException: velocity.log (Access is denied)

    at java.io.FileOutputStream.open0(Native Method)

    at java.io.FileOutputStream.open(FileOutputStream.java:270)

    at java.io.FileOutputStream.<init>(FileOutputStream.java:213)

    at java.io.FileOutputStream.<init>(FileOutputStream.java:133)

    at org.apache.log4j.FileAppender.setFile(FileAppender.java:294)

    at org.apache.log4j.RollingFileAppender.setFile(RollingFileAppender.java:207)

    at org.apache.log4j.FileAppender.<init>(FileAppender.java:110)

    at org.apache.log4j.RollingFileAppender.<init>(RollingFileAppender.java:79)

    at org.apache.velocity.runtime.log.Log4JLogChute.initAppender(Log4JLogChute.java:118)

    ... 18 more
bfitzpat commented 5 years ago

Created an upstream issue - https://github.com/jboss-fuse/wsdl2rest/issues/85

bfitzpat commented 5 years ago

@lhein I think this is a threading issue. In Eclipse, we do the Thread dance (https://github.com/jbosstools/jbosstools-fuse/blob/c4d7ad6a9b1a9ea04953dc48e8bde84884d56692/editor/plugins/org.fusesource.ide.wsdl2rest.ui/src/org/fusesource/ide/wsdl2rest/ui/wizard/Wsdl2RestWizard.java#L376) -- is there a comparable idea in JS/TS? I think not, since it's largely single threaded as a rule.

As such, I think we are going to need to update wsdl2rest to bubble up the "noVelocityLog" option as a command line option to work around this. The code is already in wsdl2rest, but we didn't make it available because we didn't need it that visible.

That is unless you have an idea of how to handle this?

lhein commented 5 years ago

Interesting. On my side it worked without any errors. I have no answer yet for your question.

apupier commented 5 years ago

it is working fine for me too. @bfitzpat Can you point to the wsdl you are using and the option that you choose please?

is there a comparable idea in JS/TS? I think not, since it's largely single threaded as a rule.

no there isn't. Here we have a SpringBoot application launched, I see there is no reason that there is a Classpath visibility issue.

bfitzpat commented 5 years ago

I have tried with https://github.com/bfitzpat/vscode-wsdl2rest/blob/master/src/test/address.wsdl and https://github.com/bfitzpat/vscode-wsdl2rest/blob/master/src/test/helloworld.wsdl with all defaults from that point forward.

bfitzpat commented 5 years ago

On Fedora I get a different result...

[DEBUG] WSDL File URI: file:///home/bfitzpat/workspaces/testme/address.wsdl
[DEBUG] DSL Type: Spring
[DEBUG] Ouput Folder: src/main/java
[DEBUG] JAXWS Endpoint: http://localhost:8080/somepath
[DEBUG] JAXRS Endpoint: http://localhost:8081/jaxrs
rejected promise not handled within 1 second
bfitzpat commented 5 years ago

Turned out to be a local npm issue (https://til.codes/npm-install-failed-with-cannot-run-in-wd-2/) that I was able to resolve using the first option listed in the post. And the extension does run fine on fedora. Unsure why this is giving me grief on my Windows box.

bfitzpat commented 5 years ago

Velocity failure on windows only occurs when debugging from inside a running vscode instance. If you run tests externally, it runs fine (npm test). Going to close this as unneccesary