Bean missing error when deploying SnappyData-0.5 pulse.war - snappydata

I am trying to deploy the Pulse Web Application to an external Tomcat. I get this error when deploying. How should I fix this?
org.springframework.beans.factory.NoSuchBeanDefinitionException: No
bean named 'org.springframework.security.authenticationManager' is
defined: Did you forget to add a gobal
element to your configuration (with child
elements)? Alternatively you can use the authentication-manager-ref
attribute on your and elements.

OK. This is fixed. To everyone also experiencing this... you must set the Spring Profile "pulse.authentication.default" or it will not load the AuthenticationManager Bean.
The overall issue is with the RowStore's documentation, which says this is OPTIONAL, when in fact it is required.
http://rowstore.docs.snappydata.io/docs/manage_guide/pulse/quickstart.html#topic_795C97B46B9843528961A094EE520782
It says at Step 4.) that configuring security is Optional when in fact you have to pass a Spring Profile. Also, again in the section "Authenticating Pulse Users", it says this is not a requirement.
To fix the issue I had to pass the Spring Profile "pulse.authentication.default" to activate the Bean in spring-security.xml and deploy pulse.war properly.
A better way for SnappyData pulse.war to do this in the future might be to use "!pulse.authentication.custom", which would always load the default AuthenticationManager bean as long as a custom one was not configured.
Example change for future to make it truly optional:
<beans:beans profile="!pulse.authentication.custom" >
<authentication-manager>
<authentication-provider>
<user-service>
<user name="admin" password="admin" authorities="ROLE_USER" />
</user-service>
</authentication-provider>
</authentication-manager>
</beans:beans>

Which version of Tomcat are you using?
Here is another thread on the same issue with TC authentication.
Else, can you just try Pulse in the "embedded mode" ?

Which version of SnappyData you are using ?
You need to mention a pulse.properties file in the classpath . For details you can check http://rowstore.docs.snappydata.io/docs/manage_guide/pulse/quickstart.html#topic_795C97B46B9843528961A094EE520782.
Let us know if you any problems further.

Related

Attribute is required but not set (Unable to create snapshot class for interface)

My Liferay 7 server was using SomeModule happily, until I deployed a new version of SomeModule which has an additional required field favoriteColor.
Now whenever I try to load the portlet Liferay says:
java.lang.RuntimeException: Unable to create snapshot class for interface some.SomeModuleConfiguration
at com.liferay.portal.configuration.metatype.bnd.util.ConfigurableUtil._createConfigurableSnapshot(ConfigurableUtil.java:77)
at com.liferay.portal.configuration.metatype.bnd.util.ConfigurableUtil.createConfigurable(ConfigurableUtil.java:51)
at some.SomeModule.activate(SomeModule.java:50)
...
aused by: java.lang.IllegalStateException: Attribute is required but not set favoriteColor
at aQute.bnd.annotation.metatype.Configurable$ConfigurableHandler.invoke(Configurable.java:75)
at com.sun.proxy.$Proxy1220.favoriteColor(Unknown Source)
at some.SomeModuleConfigurationSnapshot407.<init>(Unknown Source)
The configuration UI for SomeModule does not show anything about favoriteColor.
How to fix that, for instance by setting favoriteColor to its default value?
An alternative path would be using a OSGi configuration file to set defaults and missing values. You can use those files as you do for those modules that come with liferay; e.g., elasticsearch config. (check your osgi/configs directory)
If you are lucky enough to have the source code of the module, you can solve this problem like this:
Temporarily make the new field optional, but replacing required = true to required = false in SomeModuleConfiguration.java.
Deploy the module.
Load the configuration page, save.
Restore to required = true.
Deploy again.
Alternative answers welcome!

MUnit test fails - Cannot process event as “FileConnector” is stopped

I am implementing Munit for a flow which involves Mule Requester. This mule requester would be picking up a file.
So, when i run the java class as Junit, it throws out an exception as, Cannot perform the operation on the FileConnector as it is stopped.
The expression used in mule requester is ,
file ://${path}?connector=FileConnector
I have also defined a global file connector.
Please let me know how to resolve this issue.
Thank you.
All connectors and inbound-endpoints are disabled by default in MUnit. This is to prevent flow accidentally processing/generating real data. (Some explanation here). For the same reason File Connector is also disabled.
To enable connectors, you need to override a method in your MUnitsuite as below -
#Override
protected boolean haveToMockMuleConnectors() {
return false;
}
For XML Munit, see this to enable connectors.
Note: This will enable and start all the connectors that you are using in your mule-configs under test. If you have SMTP connector, DB connector, MQ connector etc, they all be started during test, so use it with caution.
Check whether the file connector is defined in the files you loaded for munit.
<spring:beans>
<spring:import resource="classpath:api.xml"/>
</spring:beans>
You may also try mocking the mule requester.

logback: CyclicBufferTracker.setMaxNumberOfBuffers() removed while official doc still refering it. what's alternative please?

I'm use SMTPAppender in logback, and configured like this:
<appender name="ALARM-APPENDER" class="ch.qos.logback.classic.net.SMTPAppender">
...
<cyclicBufferTracker class="ch.qos.logback.core.spi.CyclicBufferTracker">
<maxNumberOfBuffers>256</maxNumberOfBuffers>
</cyclicBufferTracker>
...
</appender>
but I got this error while running:
10:00:48,171 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter#82:24 - no applicable action for [maxNumberOfBuffers], current ElementPath is [[configuration][appender][cyclicBufferTracker][maxNumberOfBuffers]]
So I rechecked official manual:
http://logback.qos.ch/manual/appenders.html#bufferManagement
It didn't tell where maxNumberOfBuffers should be config to.
Fortunately, I find a config example in official doc:
http://logback.qos.ch/recipes/emailPerTransaction.html
<cyclicBufferTracker class="ch.qos.logback.core.spi.CyclicBufferTracker">
<maxNumberOfBuffers>512</maxNumberOfBuffers>
</cyclicBufferTracker>
Looks the same...
Then I checked latest java-doc for Class CyclicBufferTracker:
http://logback.qos.ch/apidocs/ch/qos/logback/core/spi/CyclicBufferTracker.html
No "setMaxNumberOfBuffers" method here or in it's parent Classes.
As last resorts, I checked the source code changing history in github:
https://github.com/qos-ch/logback/blob/a052f15d09636698c96fcdb753da3270f5c01b11/logback-core/src/main/java/ch/qos/logback/core/spi/CyclicBufferTracker.java
In the original version,when it's still a interface, there are both "setMaxNumberOfBuffers" and "setBufferSize" method in it.
https://github.com/qos-ch/logback/commit/773193a09922ab2a1dd70e4978be8cdf4e050f6e
Apr 25, 2013, method "setMaxNumberOfBuffers" was removed.
Now there is a problem: where should I config "setMaxNumberOfBuffers" to?
("setMaxNumberOfBuffers" has totally differet meaning from "setBufferSize")
It's can't even find and "maxNumberOfBuffers" String in logback's repository:
https://github.com/qos-ch/logback/search?q=maxNumberOfBuffers
I'm using lastest version of logback(1.1.2) by the way.
Thanks guys!
Make sure that the latest version is used. Got the same problem but with bufferSize property for logback version 1.0.9.
After some research found this
bug report. After updating to the latest version problem dissappeared.

Unity and lifetime management configuration - always transient lifetime manager

I have an configuration error with Unity.
I am trying to implement http://unitymvc3.codeplex.com/, but i am stucked right now, because of this:
In my unity configuration I have this settings:
<register type="IMainDbContext" mapTo="WorkflowContext">
<lifetime type="hierarchical" />
<constructor></constructor>
</register>
But at the time of creating unity, (my simple code is here:)
UnityConfigurationSection section = ConfigurationManager.GetSection("unity") as UnityConfigurationSection;
if (section != null)
{
section.Configure(container);
}
this.container = container;
everything is configured great, except of registration "IManDbContext" which has LifetimeManagerType = {Name = "TransientLifetimeManager" FullName = "Microsoft.Practices.Unity.TransientLifetimeManager"}, but it should be hierarchical lifetime manager
Have you got any ideas how tell unity (in configuration, not in code) i want hierarchical lifetime manager?
Thanks for any tips.
My error was caused by this error:
I have multiple DbContext, but they was badly configured:
<register type="IMainDbContext" mapTo="WorkflowContext">
<lifetime type="hierarchical" />
<constructor></constructor>
</register>
<register type="IReportDbContext" mapTo="SomeBadContext">
<lifetime type="hierarchical" />
<constructor></constructor>
</register>
When I was using this configuration, which was bad, unity simple don`t configure any lifetime manager. After I set these context right, unity used my lifetime manager configurations just right.
I don't think you can. If you're specifying the lifetime type you need to either supply "singleton" or "external" (external being a custom lifetime).
Link to Unity Schema Documentation
In fairness, unless you're using multiple Unity containers I don't see the value of having a hierarchical lifetime manager, as this is designed to ensure that you only have one instance of your type instantiated in the main unity container and any child containers you generate from it.
So, unless you're planning on generating child containers and want a separate instance of your IMainDbContext inplmenting object, you might as well just using "singleton" lifetime manager.

Spring integration delayer element

I'm trying to configure my spring integration and want to use the element, which basically sits between a retryFilter and a queue.
All works fine if I go straight from the retryFilter to the queue, however, as soon as I put the delayer element in between them, the config file fails to be loaded (as happens when there is an error in it).
Config for this section is as follows:
<!-- Retry filter -->
<filter
input-channel="retryChannel"
ref="retryFilter"
method="doRetry"
output-channel="queueChannel" />
<channel id="delayChannel" />
<delayer input-channel="delayChannel" default-delay="10000" output-channel="queueChannel"/>
<channel id="queueChannel">
<queue capacity="100" />
</channel>
<poller id="poller" default="true">
<interval-trigger interval="1000"/>
</poller>
Any help greatly appreciated.
Dave
I've tried out your sample and got it working fine on Spring Integration 2.0.0.BUILD-SNAPSHOT. You can see my commit here:
http://github.com/iwein/Spring-Integration-Sandbox/commit/c274a12f057b6750dcf18663486a99970368e68e
There are a couple of things I changed:
channel renames (in, out) instead of
longer names
filter outputs to
delayer input, instead of passing by
the delayer
Are you using an older version of Spring Integration perhaps?
You can check out my little gradle project ( http://github.com/iwein/Spring-Integration-Sandbox/tree/master/quick-samples/router-test/) which could help you experiment. If you still can't get it working it would be good if you shared a stacktrace and the exact version you are using.