Mule: Error creating bean with name 'Secure_Property_Placeholder': - mule

I am trying to use Secure Property Placeholder in mavenized project.
downloaded 1.3.3 secure property connector in anypoint.
loaded 1.3.3 maven dependency in pom.xml
<dependency>
<groupId>com.mulesoft.security</groupId>
<artifactId>mule-module-security-property-placeholder</artifactId>
<version>1.3.3</version>
</dependency>
still getting below error:
Caused by: org.mule.api.lifecycle.InitialisationException: Error creating bean with name 'Secure_Property_Placeholder': Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/mule/security/encryption/MuleEncryptionException
what should i do?

That looks like an old version of the artifact.
Try using this instead:
<dependency>
<groupId>com.mulesoft.security</groupId>
<artifactId>mule-module-security-property-placeholder</artifactId>
<version>1.6.0</version>
</dependency>

Can you check if by adding the following dependencies to your POM file, the issue gets resolved?
`<dependency>
<groupId>com.mulesoft.security</groupId>
<artifactId>security-api</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpg-jdk16</artifactId>
<version>1.45</version>
</dependency>
<dependency>
<groupId>com.mulesoft.security</groupId>
<artifactId>mule-module-security-encryption</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>com.mulesoft.security</groupId>
<artifactId>mule-module-security-property-placeholder</artifactId>
<version>1.4.0</version>
</dependency>`

Related

How can I implement log4j2 (2.14.0) 'JSON Template Layout' in a mule application?

Log4j2 has implemented a 'JSON Template Layout'. I have been able to implemented this in a standard maven java application, however I am not able to implement it in a Mule 4.3 application. I have added the log4j2 (2.14.0) dependencies to my POM:
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.14.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.14.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-layout-template-json</artifactId>
<version>2.14.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.12.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.12.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.12.1</version>
</dependency>
Log4j2 Appender Config
<Appenders>
<Console name="CONSOLE" target="SYSTEM_OUT">
<JsonTemplateLayout />
</Console>
</Appenders>
And I see that they are loaded in the log, but I get an error:
2021-02-06 07:17:39,175 WrapperListener_start_runner DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.layout.template.json.JsonTemplateLayout].
2021-02-06 07:17:39,179 WrapperListener_start_runner ERROR Could not create plugin of type class org.apache.logging.log4j.layout.template.json.JsonTemplateLayout for element JsonTemplateLayout: java.util.UnknownFormatConversionException: Conversion = 'interface org.apache.logging.log4j.layout.template.json.util.RecyclerFactory' java.util.UnknownFormatConversionException: Conversion = 'interface org.apache.logging.log4j.layout.template.json.util.RecyclerFactory'
at org.apache.logging.log4j.core.config.plugins.convert.TypeConverterRegistry.findCompatibleConverter(TypeConverterRegistry.java:103)
at org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.convert(TypeConverters.java:412)
at org.apache.logging.log4j.core.config.plugins.visitors.AbstractPluginVisitor.convert(AbstractPluginVisitor.java:151)
Is Mule somehow dynamically loading an older version of log4j2 that does not implement the 'JSON Template Layout'?
Mule 4 provides log4j2 to applications. It is one of few libraries that actually may override application's libraries in Mule 4. You should use what is provided. Do not try to change any provided libraries with different versions, that is not supported.

Mock Apache ActiveMq with amqp protocol

We are using solace as the Messaging system in our application and while writing the unit test classes (using JUNIT )for listners i have to start the solcae in my local.
Instead i was trying to mock the broker (apache ActiveMq) to use amqp protocl and send messages to the listeners.
https://github.com/apache/activemq/blob/activemq-5.15.x/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/AmqpTransformerTest.java
But when i try to build the maven project i see the error
package org.apache.activemq.transport.amqp.client does not exist.
I have added the below dependencies but i still facing the same issue. Please suggest
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-broker</artifactId>
<version>5.15.12</version>
<!-- <scope>test</scope> -->
</dependency>
<!-- Testing Dependencies -->
<dependency>
<groupId>org.apache.qpid</groupId>
<artifactId>qpid-jms-client</artifactId>
<version>0.51.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-kahadb-store</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-jaas</artifactId>
<version>5.15.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-broker</artifactId>
<version>5.15.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-spring</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-http</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-mqtt</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-leveldb-store</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.activemq.tooling</groupId>
<artifactId>activemq-junit</artifactId>
<version>5.15.12</version>
<scope>test</scope>
</dependency>
I am not able to resolve the below compilation issues.
org.apache.activemq.transport.amqp.client can not be resolved since the dependecy for this package is not found,But i have added the above dependencies in the maven project.
import org.apache.activemq.transport.amqp.client.AmqpClient;
import org.apache.activemq.transport.amqp.client.AmqpConnection;
import org.apache.activemq.transport.amqp.client.AmqpMessage;
import org.apache.activemq.transport.amqp.client.AmqpSender;
import org.apache.activemq.transport.amqp.client.AmqpSession;
Please suggest.
thank you experts.
Not entirely clear what your test is doing but the classes it can't find are those of the AMQP test client that is implemented in the ActiveMQ 5.x AMQP module's test jar so you definitely won't find them with the dependencies you have there.
The AMQP test client in the ActiveMQ broker is not meant for general use by anyone as is was built specifically to test the AMQP stack in the broker. If you remove the usage of that from your tests you should have better luck.

Missing artifact com.fasterxml.jackson.core:jackson-databind:bundle:2.9.8

Working with Jackson library, it came following error in Eclipse 4.9.0 version
Missing artifact com.fasterxml.jackson.core:jackson-databind:bundle:2.9.6 pom.xml /Jackson-Usage line 7 Maven Dependency Problem
The problem came when I added maven dependencies by GUI to add dependencies.
The solution was from generated dependencies
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.8</version>
<type>bundle</type>
</dependency>
to remove and save.
<type>bundle</type>
xml
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.9</version>
<type>bundle</type>
</dependency>
Remove bundle and that should resolve the error code in eclipse.

com.google.inject.ProvisionException: Unable to provision

I have created simple seedstack web project through guideline mentioned on http://seedstack.org/docs/basics/
Undertow is also started with seedstack:run.
However, while accessing "hello" resource undertow throws below exception:
ERROR 2018-07-25 21:37:34,468 XNIO-1 task-2 io.undertow.request
UT005023: Exception handling request to
/api/seed-w20/application/configuration
null returned by binding at
org.seedstack.w20.internal.W20Module.configure(W20Module.java:51) (via
modules: com.google.inject.util.Modules$OverrideModule ->
io.nuun.kernel.core.internal.injection.KernelGuiceModuleInternal ->
org.seedstack.w20.internal.W20Module) but the 3rd parameter of
org.seedstack.w20.internal.FragmentManagerImpl.(FragmentManagerImpl.java:32)
is not #Nullable at
org.seedstack.w20.internal.W20Module.configure(W20Module.java:51) (via
modules: com.google.inject.util.Modules$OverrideModule ->
io.nuun.kernel.core.internal.injection.KernelGuiceModuleInternal ->
org.seedstack.w20.internal.W20Module) while locating
org.seedstack.w20.internal.ConfiguredApplication
for the 3rd parameter of org.seedstack.w20.internal.FragmentManagerImpl.(FragmentManagerImpl.java:32)
while locating org.seedstack.w20.internal.FragmentManagerImpl while
locating org.seedstack.w20.FragmentManager
for field at org.seedstack.w20.internal.rest.application.ApplicationConfigurationResource.fragmentManager(ApplicationConfigurationResource.java:38)
while locating
org.seedstack.w20.internal.rest.application.ApplicationConfigurationResource
Any help please?
This is a bug introduced recently into the w20-bridge, which occurs when no w20.app.json configuration file is present.
You can workaround it by creating an empty-object w20.app.json file at the root of the classpath:
{}
You can also update the version of all w20-bridge dependencies to 3.2.4 which has a fix for it. This can be done by using the dependencyManagement section of your POM:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.seedstack</groupId>
<artifactId>seedstack-bom</artifactId>
<version>18.4.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.seedstack.addons.w20</groupId>
<artifactId>w20-bridge-web</artifactId>
<version>3.2.4</version>
</dependency>
<dependency>
<groupId>org.seedstack.addons.w20</groupId>
<artifactId>w20-bridge-web-bootstrap-3</artifactId>
<version>3.2.4</version>
</dependency>
<dependency>
<groupId>org.seedstack.addons.w20</groupId>
<artifactId>w20-bridge-web-business-theme</artifactId>
<version>3.2.4</version>
</dependency>
<dependency>
<groupId>org.seedstack.addons.w20</groupId>
<artifactId>w20-bridge-web-components</artifactId>
<version>3.2.4</version>
</dependency>
<dependency>
<groupId>org.seedstack.addons.w20</groupId>
<artifactId>w20-bridge-rest</artifactId>
<version>3.2.4</version>
</dependency>
<dependency>
<groupId>org.seedstack.addons.w20</groupId>
<artifactId>w20-bridge-specs</artifactId>
<version>3.2.4</version>
</dependency>
</dependencies>
</dependencyManagement>
This fix will be included in the upcoming SeedStack 18.7.

jfreechart-1.0.14-swt.jar maven dependency using system path

I need to add maven dependency in my POM file for jfreechart-1.0.14-swt.jar. I have used below dependency in xml:
<dependency>
<groupId>jfree</groupId>
<artifactId>jfreechart-swt</artifactId>
<version>1.0.14</version>
<scope>system</scope>
<systemPath>${basedir}src/main/webapp/WEB-INF/lib/jfreechart-1.0.14-swt.jar</systemPath>
</dependency>
even tried with this one:
<dependency>
<groupId>jfree</groupId>
<artifactId>jfreechart-swt</artifactId>
<version>1.0.14</version>
</dependency>
But in both cases the build is failing. Can anyone let me know how I can resolve this?
the above issue is resolved now.. did some R&D
correct pom dependency is:
<dependency>
<groupId>jfree</groupId>
<artifactId>jfreechart-swt</artifactId>
<version>1.0.14</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/jfreechart-swt-1.0.14.jar</systemPath>
</dependency>