Error while building WSO2 Microgateway project on Windows 10 - wso2

I’ve been trying to explore WSO2 Microgateway and set up a Microgateway project. Building the project in Windows 10 with the command “micro-gw build project-name” is giving this error: “Could not find or load main class org.wso2.apimgt.gateway.cli.cmd.Main”.
I’ve downloaded the Toolkit and Runtime from https://wso2.com/api-management/api-microgateway/. I've set the Path environment variable to the /bin directory of the Toolkit and Runtime extracted folders, but still the “micro-gw build project-name” command is giving error “Could not find or load main class org.wso2.apimgt.gateway.cli.cmd.Main”. I’ve also cloned the source code from Github (https://github.com/wso2/product-microgateway/) which has the Main.java class and tried setting environment variables to its path.
I also tried setting the environment variables to the path where Toolkit batch file is present. I also followed the steps mentioned here, https://github.com/wso2/product-microgateway/#running-the-microgateway.
I'm assuming the Toolkit batch file (micro-gw) would execute the Main.java class coming up in the error.
These steps did not resolve the error. I'm new to Java based product, and I'm sure I'm missing something here.

Problem is with the init command not the build command. Init command is suppose to setup the TOOLKIT after the first use. It should extract the platform.zip file and copy all of the required resources to relevant places for you.
I hope you get the Project ___ successfully initialized message after running the init command. Just check $TOOLKIT_HOME/logs/ directory to see if there are any information on the log file.
If the log file also doesn't help, as a workaround, copy all the .jar files inside $TOOLKIT_HOME/lib/gateway/platform and $TOOLKIT_HOME/lib/gateway/cli to $TOOLKIT_HOME/lib/platform/bre/lib and try again, that should work.
Also please report this issue at https://github.com/wso2/product-microgateway/issues

Related

Can't download json schema using gradlew command

I can't figure out how to use the gradlew command to convert my GraphQL schema into a JSON file as it is specified in the documentation.
I opened CMD in my project folder, ran the gradlew command once, and it gave me this error:
Project 'module' not found in root project gradlew
I created a module inside my project with the name "module" and now it's throwing the following error:
Task 'downloadApolloSchema' not found in project ':module'.
I've already added all the dependencies to the latest version (2.0.0 as of the time of posting) so I'm clueless as to why this is happening. I've already searched the web and found nothing about this...
This is the command I'm trying to issue in the CMD:
C:\Users\myuser\AndroidStudioProjects\GraphQLApp\app>..\gradlew :module:downloadApolloSchema -Pcom.apollographql.apollo.endpoint=https://graphql-udemy-android.herokuapp.com/graphql -Pcom.apollographql.apollo.schema=src/main/graphql/com/example/schema.json
I have to go up one directory (..\) since the gradlew command is in the above my app folder.
I'm on Windows, and my Gradle version is 6.4.
You just change ./gradlew to .\gradlew
Open the root terminal
Paste the code below and ENTER!
.\gradlew downloadApolloSchema --endpoint=https://Your Endpoint/graphql --schema=app/src/main/graphql/com/example/Your Path/schema.json
Have a good days!
Sorry about that, the module part was mostly a placeholder for the gradle module where you apply the com.apollographql.apollo plugin. You can ignore it and gradle will find the appropriate task:
./gradlew downloadApolloSchema
This has been updated in the project README as well.
For windows i used
.\gradlew downloadApolloSchema --endpoint="https://rickandmortyapi.com/graphql" --schema=app/src/main/graphql/GetRepositories.json
NOTICE I used:
.\ instead of ./

Nix: Building `waf` produces a file, but I seem to need a folder

I've cloned the nixpkgs repo. From the top of that repo, I can run nix-build -A waf to build waf, and nix-env -f . -iA waf to make waf part of my user environment. Neither complains -- but afterward I am still unable to call waf:
[jeff#jbb-dell:~/nix/nixpkgs]$ waf
waf: command not found
[jeff#jbb-dell:~/nix/nixpkgs]$
Most packages, when I build them using nix-build -A, produce a symlink called result that goes to a folder containing the executable in question. Strangely, though, in waf's case the symlink is to a file, not a folder.
I'm running NixOS. If I add waf to environment.systemPackages in my configuration, upon building I get an error that seems to be a result of the strangeness described in the previous paragraph:
[jeff#jbb-dell:~/nix/jbb-config]$ sudo nixos-rebuild switch
building Nix...
building the system configuration...
these derivations will be built:
/nix/store/s618gllra3g2vn62c92advg9ks2swkz1-system-path.drv
/nix/store/gpph3adrgn949mikfvkwld86flshdbvq-unit-polkit.service.drv
/nix/store/i7xql7889ank54fnhd16zk4z79l1ix88-unit-systemd-fsck-.service.drv
/nix/store/dv9p4fsrqn1fwdvy9scyc7g9422wvm7c-dbus-1.drv
/nix/store/y730jf9s9nrzmkf55i01nlwinw5gxpsp-unit-dbus.service.drv
/nix/store/4wjan71p2di7lscnscdfhp55j49dcymx-system-units.drv
/nix/store/qrzwrpsz0hh5gzaxic6ww8mnwl03zwil-unit-dbus.service.drv
/nix/store/lhq0s9s5v3sqvjx6mqlyqj6hf4kv38sf-user-units.drv
/nix/store/hk5wbmf4dpna3dn0h0q1balj3482l6xd-etc.drv
/nix/store/yj3lfyv5sbp751xzy9jdw1d06n9gdiin-nixos-system-jbb-dell-19.09.1889.692a8cabbcc.drv
building '/nix/store/s618gllra3g2vn62c92advg9ks2swkz1-system-path.drv'...
The store path /nix/store/f1ylicjswpfx1wbvxapsnwy987qnlxl6-waf-2.0.18 is a file and can't be merged into an environment us ing pkgs.buildEnv! at /nix/store/kncarzyhspzsplkcmmyiqg2cavrwr373-builder.pl line 96.
builder for '/nix/store/s618gllra3g2vn62c92advg9ks2swkz1-system-path.drv' failed with exit code 2
cannot build derivation '/nix/store/yj3lfyv5sbp751xzy9jdw1d06n9gdiin-nixos-system-jbb-dell-19.09.1889.692a8cabbcc.drv': 1 dependencies couldn't be built
error: build of '/nix/store/yj3lfyv5sbp751xzy9jdw1d06n9gdiin-nixos-system-jbb-dell-19.09.1889.692a8cabbcc.drv' failed
[jeff#jbb-dell:~/nix/jbb-config]$
This looks like an implementation error to me. waf, as a top-level Nixpkgs package, should put its binary in $out/bin.
I've checked for usages of waf in nixpkgs and it seems to be used inside derivations only via wafHook.
If you only need waf inside a derivation, I recommend going with wafHook, following the example of other packages. If you need to install it in your user profile, ideally you can send a PR to make waf a proper package or you can work around it with a custom derivation.

C++ Windows Driver MSB3030 could not copy the file '' because it was not found

VS2017, SDK/WDK, C++ project
we have a c++ solution (driver) that is shared across developers via Team Foundation Services - visualstudio.com (now called azure devops?).
When I perform a get latest source code, and want to rebuild the solution I get two MSB3030 errors:
"Could not copy the file "C:\path of my colleague his file" because it was not found."
I found it strange that I saw on one of the two errors a path of my colleague his pc. He works on C:\ I'm working on E:\
Unloading the project, I saw he path being set here:
<ItemGroup>
<FilesToPackage Include="C:\path of my colleague\foo.xml" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<PackageRelativeDirectory>
</PackageRelativeDirectory>
</FilesToPackage>
We cannot get this solution to build because of the MSB3030. First we have to clean the specific projects individually, rebuild it, then build another project etc.. a few steps to perform manually in the correct order , trial and error, drinking coffee, throwing bananas to the pc and praying that a monkey outputs the code correctly.
Has anyone seen somehting similar regarding MSB3030 errors?
On my pc I see the path of my colleague, but he doesn't see my path (strange!).
C:\Program Files (x86)\Windows
Kits\10\build\WindowsDriver.common.targets(1699,5): error MSB3030:
Could not copy the file 'C:...' because it was not found.
I've set the Any CPU to x64 because it doesn't make any sense for c++.
C++ Windows Driver MSB3030 could not copy the file '' because it was not found
The reason for this issue is that the path of the ItemGroup is an absolute path in the project file:
<ItemGroup>
<FilesToPackage Include="C:\path of my colleague\foo.xml" ...>
...
</FilesToPackage>
</ItemGroup>
Regardless of whether your colleague has added this file to source control, when you pull the code from the TFS server to your local and put the code in a different local folder, the absolute path will bring you a lot of trouble, you need to manually check the code on the TFS server for this file and you need to modify the absolute path of this file in your project. But this problem will reappear after your colleague updates after you submit your code. Because an absolute path cannot be assigned to two different paths C:\ and E:\.
To resolve this issue, you need to change the absolute path to a relative path in the source code. Generally, we prefer to add this file to the Solution/Project folder, then use the MSBuild Macros $(SolutionDir)/$(ProjectDir) to specify it.
Check Common macros for build commands and properties for some more details.
Hope this helps.

Use VS Online "Command Line" task with relative paths

I'm trying to use the new VS Online Build process and, specifically, package my app as a NuGet package.
To do so I have to execute something like "nuget pack". My source code is in GitHub and there, under the root folder, I have a folder called .nuget with all necessary to do the packaging.
I've added to my build template a "Command Line" step with this parameters:
tool: C:\a\9ea8689c\myusername\myproject.nuget\nuget.exe
arguments: pack
Everything else is defaults, included working folder. This works. However when I've tried to replace the absolute path for something like ".nuget/nuget.exe" or .nuget/nuget.exe or even changing the working folder to .nuget and from there just type "nuget.exe" it repeatedly fails because it can't find the tool.
Am I missing something? Should the task work with relative paths?
You should use absolute paths leveraging TFS Environment Variables like TF_BUILD_BUILDDIRECTORY.
In a batch file it is something like
echo Launching my own NuGet copy
%TF_BUILD_BUILDDIRECTORY%\myproject.nuget\nuget.exe
This worked for me: $(BUILD.SOURCESDIRECTORY)\NuGet.exe.
Notice the dot instead of underscore. I have put my NuGet.exe in the main repository folder, in my case NuGet 3.5 Beta.

Run a jar Rhapsody app file

I have created some Java applications to extend Rhapsody using Java API and I have deployed them successfully to the Rhapsody environment (Right click on the project -> Apps).
I can see the exported .jar files under the directory RhapsodyApps/apps.
My question is, How can I run them from the command line (Under windows 7)???
Thank you in advance
What I managed to do is to create a .bat file, using "Generate Apps Execution Batch File". As I mentioned in my last post it did not exist in the "Apps" menu of rhapsody. Besides, it existed in the "...\share\RhapsodyApps\apps" directory with the name "SynchronousScriptInvocation.jar". I hardcoded the RhapsodyApps.hep file, by adding the following:
#REM: This app generates a script which will invoke each app synchronously one after another. ...
name7=Apps\Generate Apps Execution Batch File
isPluginCommand7=1
command7=Apps
applicableTo7=Project,SysML,AUTOSAR_40,AUTOSAR_31,AUTOSAR_32,DDS,UPDM1_DoDAF20,UPDM2_DoDAF
isVisible7=1
I got the name (Generate Apps Execution Batch File) from the AppInfos.xml file.
Then, the plugin is displayed in the Apps menu in Rhapsody IDE, and I can generate the .bat file. Problems did not stop here. The batch file was not displaying my plugin and the reason was something with my JAVA_PATH configuration. Finally I modified the .bat file as following:
#rem This is auto generated script. Be careful on changing it manually.
#rem Build Order
set APP0=0df8829923eb43f4aab9d33ada1ddbf1
#set APPS= %APP0%
set JAVA_PATH=%JAVA_PATH%\bin\java
set JAVA_API=C:/work/User/Build.TRUNK/ProjectName/RhapsodyShare8/JavaAPI
set RhapsodyApps=C:/work/User/Build.TRUNK/ProjectName/RhapsodyShare8/RhapsodyApps
set CLASS_PATH="%RhapsodyApps%"/apps/RhapsodyAppLauncher.jar;"%RhapsodyApps%"/RhapsodyApps.jar;"%RhapsodyApps%"/apps.jar;"%JAVA_API%"/rhapsody.jar
"C:\Program Files (x86)\IBM\Rational\Rhapsody\8.0.5\jre\bin\java" -cp %CLASS_PATH% -Djava.library.path="%JAVA_API%" apps.RhapsodyLauncherApp %APPS%
Finally it works. I hope that this post will help somebody in the future.