I'm trying to implement some custom Java code in a non-static manor. I've used the "NEW" component under Java modules, so I can use the "INVOKE" component later.
XML for Component
<java:new doc:name="New" doc:id="b45f35b5-d524-45df-b006-a962d0a8ce69" class="com.company.LockComponent" constructor="LockComponent()"/>
I then added a classLoaderModelLoaderDescriptor to my mule-artifact.json, as shown below.
{
"minMuleVersion": "4.1.5",
"classLoaderModelLoaderDescriptor": {
"id": "mule",
"attributes": {
"exportedPackages":[
"com.company.LockComponent"
]
}
}
}
I'm getting JAVA:CLASS_NOT_FOUND error. I'm not sure what I'm missing...
Ensure that:
The applications uses the latest Java Module version.
The application uses the latest Mule Maven Plugin version.
The Java source for the class is included with your project (src/main/java) or as a dependency in Maven.
You should not need to modify mule-artifact.json with above steps.
Related
I'm working with the ABP Framework and I'm implementing my own mail templates.
The project was made using the abp project template. I created the template in my Application module: Acme.Bookstore.Application/Assets/Templates/MyEmailTemplate.tpl. I edited the properties of the file to be embedded.
Then I made an instance of the template definition provider as follows:
public class MyEmailTemplateDefinitionProvider : TemplateDefinitionProvider
{
public override void Define(ITemplateDefinitionContext context)
{
context.Add(
new TemplateDefinition(
MyEmailTemplates.MyEmailTemplate,
displayName: LocalizableString.Create<AccountResource>($"TextTemplate:{MyEmailTemplates.MyEmailTemplate}"),
layout: StandardEmailTemplates.Layout,
localizationResource: typeof(AccountResource)
).WithVirtualFilePath($"Assets/Templates/MyEmailTemplate.tpl", true)
);
}
}
Then I added the following lines to my BookstoreApplicationModule.cs
Configure<AbpVirtualFileSystemOptions>(options =>
{
options.FileSets.AddEmbedded<BookstoreApplicationModule>("Acme.Bookstore");
});
I did all this following this documentation: https://docs.abp.io/en/abp/5.3/Virtual-File-System
When debugging locally all works well, but when I deploy the project it can't access the template file. The error is as follows:
Volo.Abp.AbpException: Could not find a file/folder at the location: Assets/Templates/MyEmailTemplate.tpl
I already tried adding the AddEbedded call in the HttpApi.Host module but got the same result. I don't know what I'm missing.
For the record, I'm deploying in an Ubuntu server, but that shouldn't matter.
The problem was that the embedded files weren't being added to the VirtualFileSystem. It worked in develpment because the framework calls:
if (hostingEnvironment.IsDevelopment())
{
Configure<AbpVirtualFileSystemOptions>(options =>
{
... Some code ...
options.FileSets.ReplaceEmbeddedByPhysical<BookstoreApplicationModule>(
Path.Combine(hostingEnvironment.ContentRootPath,
$"..{Path.DirectorySeparatorChar}Acme.Bookstore.Application"));
});
}
So the problem didn't arise until I did a dotnet publish.
I could not figure out why it wasn't working on the Application module but moving the files to the Domain.Shared module fixed it.
I guess that there is some package or setting missing on the other module but this solution is enough for me.
Our application should have a main app and is consists of multiple modules and these modules have their own git repository.
The goal is to use the main app and turn the modules into packages that should only be referenced or called in the main app. Just like a DLL in C# or a component in Angular.
Now, I have looked thru sencha docs and all I can see is consolidating the modules into one single directory/workspace. We don't want to go that way because the modules have their own repo and the "main app" will also have its own repository.
Please recommend the best path to take.
I guess the simplest way is to define the workspace for the package inside each repo by adding this as workspace.json:
{
"frameworks": {
"ext": "ext"
},
"build": {
"dir": "${workspace.dir}/build"
},
"packages": {
"dir": "${workspace.dir}/packages/local,${workspace.dir}/packages",
"extract": "${workspace.dir}/packages/remote"
}
}
Now you need to link (symlink suggested) or copy the framework under /ext
Lets say you have the following structure
/root/workspace.json
/root/ext
/root/packages/local/yourModule
Now you can go to /root/packages/local/yourModule
and call
sencha package build
This should produce the package and js-files.
You will find the js files under
/root/packages/local/yourModule/build/yourModule.js
/root/packages/local/yourModule/build/yourModule-debug.js
These files can now be loaded on demand from your main app.
Depending on your needs you can optimize the build by adding
skip.sass=1
skip.examples=1
skip.slice=1
skip.pkg =1
in your package.json - or for legacy sencha cmd packages inside
/root/packages/local/yourModule/.sencha/sencha.cfg
A different approach could be by using another build tool.
You need to do inside:
/root/packages/local/yourModule/src
(put the files in the right order)
concat
remove whitespace *
uglify *
star means only relevant for the debug version of your module (package).
This is more less what a standard sencha cmd package build does.
I tried it successfully with grunt.
Good day.
I have created a .NetCore2 webapp and would like some guidance on how you get
windows.forms working on it. (VS2017)
This is the error I get basically:
Dot Net Core and Azure Storage: Could not load file or assembly System, Version=4.0.0.0
Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.
The project builds but the moment I call the api it fails to detect the dll. (In code it detects the dll fine)
I have added the dll to the project, also followed the instructions of adding it to your project.json. (in my case: package.json)
"frameworks": {
"netcoreapp1.0": {
"imports": [
"net46",
"net40"
]
}
},
Also added the required references to my csproj folder.
<PropertyGroup>
<TargetFrameworks>net452;netstandard1.3</TargetFrameworks>
</PropertyGroup>
How to use System.Windows.Forms in .NET Core class library
"frameworks": {
"netstandard1.6": {
"dependencies": {
"NETStandard.Library": "1.6.0"
}
},
"net40": {
"frameworkAssemblies": {
"System.Windows.Forms": {}
}
}
}
I am still getting the same error.
I know it is not advised to use .Net framework in a .NetCore app.
Am I going to have to port the framework app so it works in a Core enviroment?
The reason i want to just use .NetFramework is that the app already works fine, I just have to get the screens shown to the user.
I also read somewhere that Windows.Forms is not supported with .NetCore in some versions of the framework.
If so, any links to help with this?
I am quite a noob with .NETCore so some of my questions might not make sense or are ignorant.
Thanks
I am going to integrate salesforce library into liferay 7 mvc portlet, the following steps are what i did:
Add libraries to class path. In Eclipse, go to Project > Properties > Java Build Path > Libraries > Add External JARs, then add the sfdc-wsc JAR to this list
Add below line to build.gradle:
compile group: 'com.force.api', name: 'force-wsc', version: '40.1.1'
The java source code is ok until i use gradle build to build project, the following error occur:
error: package com.sforce.soap.enterprise does not exist import com.sforce.soap.enterprise.EnterpriseConnection;
error: package com.sforce.soap.enterprise does not exist import com.sforce.soap.enterprise.QueryResult;
error: package com.sforce.soap.enterprise does not exist import com.sforce.soap.enterprise.SaveResult;
I also set the bnd file as follow according to blog post of DAVID H NEBINGER: https://web.liferay.com/web/user.26526/blog/-/blogs/osgi-module-dependencies
But nothing is improved
Bundle-ClassPath:.,\lib/externalLib.jar
-includeresource:\
lib/externalLib.jar=externalLib.jar,\
lib/commons-lang.jar=commons-lang=[0-9]*.jar
Please give any suggestion to correct.
Thanks in advance
I recently developed such a solution, but I used a different approach. I've implemented an OSGi bundle that exports Salesforce's SOAP APIs. This way you can use Salesforce APIs in any other Liferay bundle.
On this Salesforce SOAP API Client OSGi Bundle repository you find the sources. The OSGi bundle is also available on Maven Central.
Once you install the Salesforce SOAP API Client OSGi bundle, you can use it in any other Liferay bundle, such as your MVC Portlet. This sample project Salesforce Liferay Gogo Shell Command Client implements a set of Gogo Shell commands that allow us to interact with the Salesforce CRM system.
In your particular case, if you want to include external libraries via Gradle, then you can declare your dependency through the key compileInclude.
dependencies {
compileOnly group: "org.osgi", name: "org.osgi.core", version: "6.0.0"
compileOnly group: "org.osgi", name: "org.osgi.service.component.annotations", version: "1.3.0"
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.6.0"
compileOnly group: "org.apache.felix", name: "org.apache.felix.gogo.runtime", version: '1.0.6'
compileInclude group: 'org.fusesource.jansi', name: 'jansi', version: '1.16'
compileInclude 'de.vandermeer:asciitable:0.3.2'}
This way you do not have to do anything on the bnd file. The external jar, like magic will be placed inside your bundle and MANIFEST will be correct.
If you want generate your stubs then you go at Force.com Web Service Connector (WSC)
I use react-native-web to have components that can be used not only mobile but also in web browsers. My understanding of the idea is simple: Provide an HTML-based implementation for the regular react-native components.
If I understand the library correct, it works by overwriting the package with webpack:
// webpack.config.js
module.exports = {
...
resolve: {
alias: {
'react-native': 'react-native-web'
}
}
};
But what if I want to provide implementations for components that are not implemented by react-native-web? And how could I provide an implementation for external packages like react-native-button.
A package like react-native-button is just a collection of code that uses React Native's API. If you load react-native-web as a stand-in for the original implementation, the third-party package might "just work". How well it works depends on how complete react-native-web's implementation of the API is.
Note that some third-party React Native packages include specific non-Javascript code (iOS/Android native code) that react-native-web does not aim to implement. If the package documentation says that you need to run react-native link or change your Xcode/Android Studio project configuration, it's probably not readily usable with react-native-web.