I am using latest Studio and embedded 4.1.5 engine.
I created a CommonProject with some reusable flows.
1 of the flow is using DW2.0 and is using a local class to cast the result of the transformation. CommonProject and DW work on its own.
Then I created a second project CallerProject. Added CommonProject as a dependency, and added the CommonProject FLOW via IMPORT:
When I call the CallerProject FLOW that uses the CommonProject imported flow, all seems to be working up to the DW2.0 transformation that is failing since the CLASS is not found.
Error: "Unable to find class ..."
Anything obvious I missed?
The java class is in the CommonProject JAR within the CallerProject JAR
I believe you want to import a project JAR file. The steps for that is:- File-> import -> Anypoint Studio -> Packaged Mule application(.jar).
You didn't mention mavenizing your flow.
This should help:
https://support.mulesoft.com/s/article/How-to-add-a-call-to-an-external-flow-in-Mule-4
Related
Hi I am facing an issue with eclipse. currently i have a java project using maven/springboot and i am using http://mapstruct.org/ libraries to generate some classes.
In my test I am declaring the generated classes (implementation) however the eclipse complain it could not be resolved to a type.
when i do a maven clean package from the terminal all the tests pass . Also i can see that the generated classes under the folder target/annotations/com/primecast/service/mapper/ , basically it is generated successfully . However when i declare an instance of the class like this from my junit test
private ProfileMapperImpl profileMapper
it shows cannot be resolved to a type. However i can find the ProfileMapperImpl class generated properly under the folder target/annotations/com/primecast/service/mapper/
any idea how can i add the generated source files to my eclipse so that the eclipse wont complain . my eclipse version is eclipse photon released on 2019.
thank you for reading my question.
I hope you are seeing the error in eclipse IDE at the import's section while trying to add the import statement of the implementation class. If that is the case, simply remove the import statement. The application should still be able to resolve the class without errors. That is what worked for me.
I have a java based appengine endpoint project in eclipse.
When I generate client library using command line tool.
https://developers.google.com/appengine/docs/java/endpoints/endpoints_tool
I'm getting only source based jar file ('project_name_version'.java-1.18.0-rc-sources.jar). It does not work fine in Android Studio when I add as a Library.
How can I get class based jar client library (google-api-services-'project_name_verison'-1.18.0-rc.jar)?
I tried searching online but no luck yet.
You could always zip up the sources file and use them in Android Studio. However , note that in the build.gradle file, you will have to reference the other dependent JAR files + versions that will be needed by the sources that you have generated in Eclipse via the Generate Cloud Endpoint Library option.
Build your app engine back end with JRE 7. You can change this from windows->preferences->java->installed JREs. You'll find an Add button at the right side of the pane. For more detail refer this Tutorial
This will solve most of your problems.
I am trying to make a simple servlet in Eclipse. But including the following libraries generates errors as if they were not defined in Eclipse.
import javax.servlet.*;
import javax.servlet.http.*;
How to have them recognised and defined?
Please add servlet-api.jar in classpath of your project.if you are using tomcat server, then it should be present in ${CATALINA_HOME}/lib
Be sure you are doing the right way:
If you are using the Classic version of Eclipse, then you must donwload the Web Tools Platform.
If you have an Eclipse Java EE Edition, then there is already installed the necessary plugins.
Create a new Dynamic Web Project: Menu New > Project > Dynamic Web Project.
Fill all values you want for the new project.
Do right click on the project and select New Servlet.
Last step creates a new Class file that is a servlet class, already importing the necessary packages, such as javax.servlet.http.*.
If you are using a Eclipse with a Maven plugin installed then, after configured it, you can only add the following dependencies:
http://mvnrepository.com/artifact/javax.servlet/servlet-api/2.5
http://mvnrepository.com/artifact/javax.servlet/jstl/1.2
http://mvnrepository.com/artifact/javax.servlet/jsp-api/2.0
In fact, you can see this tutorial explaining very well all the steps to create a Dynamic Web Prroject using WTP.
Or by ugin Maven, this one and this full explained.
Hope this help...
I like to write a Custom Mediator for the WSO2 ESB.
I found some Tutorials for this, but I don't get it working in the WSO2 ESB. I think I maybe have an error in the path I need for the Class Mediator, but let me explain everything:
For writing this Mediator I use the WSO2 developer Studio for Eclipse Juno.
There I created a new ESB Mediator Project called "b64writer" with this content:
package org.wso2.carbon;
import org.apache.synapse.MessageContext;
import org.apache.synapse.mediators.AbstractMediator;
public class B64Mediator extends AbstractMediator {
public boolean mediate(MessageContext context) {
// TODO Implement your mediation logic here
String inhalt = context.getEnvelope().toString();
trace.trace("Message: " + inhalt);
return true;
}
}
In the next step I created a new Carbon Application Project, with the Mediator selected on "Dependencies". The config for this is:
Group ID: org.wso2.carbon.b64mediator
Artifact ID: b64mediator
Version: 1.0.0
I used the button on the right side to create an archive. This archive I copied to "C:\wso2esb\repository\carbonapps\0".
And now my question: How can I use this Mediator?
It should work like this:
<class name="org.wso2.carbon.B64Mediator" />
But it isn't. WSO2 ESB can't find the class. Where's my mistake?
Ok, I had the same issue as you, and I managed to add the mediator by using the WSO2 Developer Studio add-on for eclipse to make a mediation library. (Bring up the new wizard box, and select WSO2/Extensions/Project Types/Mediator Project)
Then create your mediator or put into the project, and export it as a jar file to the /repository/components/lib folder. You have to restart the ESB every time you update the jar or if you're running the ESB when you add the jar.
I hope this helps.
Place the archive inside repository/components/dropins or repository/components/lib (if you don't build it as an osgi bundle) directory.
you should deploy class mediators as java Library artifact and refer them from class Mediators. That is, deply the jar you craeted from dev studio and keep taht in repository/components/lib folder and restart the server.
Then refer like;
<class name="org.wso2.carbon.B64Mediator" />
from your sequence
I don't know if you have solved your problem. I had the same issue but I could solved it.
I created my mediator using the WSO2 Developer Studio "Mediator Project" in Eclipse Kepler. Next I exported to Java/JAR file right clicking in my project and selecting "export generated class files and resources" in the properties.
The JAR file you have to place into repository/components/lib folder and restart your ESB
i have added new project in my workspace which is having 2 projects A and B respectively. now i have added third project C in build path as well as in project reference of A. i am using some package c.foo.* of C in Project A's test.jsp but while importing c.foo.* package i am getting error as Package not found. how i can access package c.foo.* of Project C in test.jsp of Project A ? i am using eclipse IDE
A Page not found error means entirely different: the request URL is plain wrong. If the import has actually failed, you would have gotten a compilation error. Are you sure that the URL is correct?
That said, raw Java code doesn't belong in JSP files. Use a Servlet for this. You can use doGet() to preprocess requests and doPost() to postprocess requests. In a Servlet class you can just import/write Java code the usual way without struggling with scriptlets.
Are the source folders in project C exported from that project's Java Build Path properties?