Configure multiple content stores in Alfresco? - alfresco

I followed the step given in below link to configure multiple content stores in Alfresco 5.0.d.
http://docs.alfresco.com/5.0/concepts/store-config-fullexample.html
Alfresco instance is not able to start and gives the exeption,
Cannot resolve reference to bean 'storeSelectorContentStore' while setting bean property 'store';
nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'storeSelectorContentStore' defined in file [/opt/alfresco-5.0.d/tomcat/shared/classes/alfresco/extension/content-store-selector-context.xml]:
I also tried the method stated in below link,
https://community.alfresco.com/docs/DOC-5156-content-store-configuration
This gives a different error, alfresco dir root not defined even though it's defined in the properties file.

This is an enterprise only feature. This is why you are getting this error on Community.

Marcus is right about this being an Enterprise only feature, but you could develop your own. It shouldn't be too much of a hassle.
Also, have you tried using this extension, I suspect it has everything you need and is maintained by a well know Alfresco contributor?
https://github.com/Acosix/alfresco-simple-content-stores

Related

Get property of object Alfresco

I'm using Alfresco 5.1 Community, and i'm trying to get a property of an object for example, in the user we have:
"{http://www.alfresco.org/model/content/1.0}companytelephone"
If I want to get the value of this property, how can I obtain this in javascript?
It depends where you're trying to do this, if you're doing this in a JavaScript controller for a WebScript on the Repository then you will be able to find most of the information in this Wiki page: https://wiki.alfresco.com/wiki/JavaScript_API_Cookbook
If you're doing it in the JavaScript controller of a WebScript running on Share then for most objects you'll need to request the full metadata for the node by calling a REST API on the Repository.
In the case of the user, there is a "user" object available in WebScripts running on the Share tier.
There is lots of information on getting this kind of data with some basic Googling, I'd also recommend launching the Rhino debugger via the WebScripts index page so you can try evaluating JavaScript code (this works for both the Repository and for Share).

Invalid Type Error Occasionally in Symfony 2 Console

I have a Symfony 2 environment in which I am using a custom data type with Doctrine's MongoDB ODM mappings. This all works, except occasionally; when I go to clear the cache or install the assets I sometimes receive the following error:
[InvalidArgumentException]
Invalid type specified "..."
This seems to always happen with the next command I issue to the console after I have cleared the cache, later operations all succeed. Doctrine seems to have issues intermittently finding it, and I suspect it has to do with where I'm registering the type and when that occurs with relationship to when Doctrine processes the mappings.
The type is being added as part of the boot() method in another bundle which may not always be included.
What is happening here?
Can I somehow ensure that the type is loaded earlier, or provide it in a configuration file? As far as I can tell there is no way, at present, using the MongoDB configuration to specify custom types in a .yml file as described for the ORM here.
I found a good solution in this post.
The short answer is to add
\Doctrine\ODM\MongoDB\Mapping\Types\Type::registeredType('mytype', 'My\Type\Class');
in MyBundleClass::__consruct(). This will get the type registered before any warmup happens with the cache.
Using Type::registeredType() instead of Type::addType() will avoid checking to see if the type is already registered. In the case of Type::addType() will throw an exception if it has already been added.
To answer the second of my two questions above, I seem to have found a work-around for this, but I don't like it very much. It feels more like a hack than a proper solution.
In app/autoload.php after I register the annotation registry and driver, I call:
\Doctrine\ODM\MongoDB\Mapping\Types\Type::addType('mytype', 'My\Type\Class');
... and this appears to ensure that the type is registered when calling the console commands.

Using application scope variables in java

My company is redoing our website over the next few months, going from a ColdFusion website to one written in Java. I am just learning Java and I am curious as to how I can set application scope variables in a Java web application. ColdFusion has the application.cfm file that holds variables that are accessible by all ColdFusion pages/components within the app. Java obviously does not have a direct equivalent to that file, so I was wondering how to recreate something similar in Java. I want to have one central place that all jsp pages, servlets, classes, etc. in the webapp can access.
So what is the best way to do something like that?
Does anyone have any examples of something similar that they did?
Should application scope variables be placed in a class? an xml file? a jsp page? something else?
Is it even feasible to have application scope variables a in java webapp?
Example:
It would be a place that holds say the path to an images folder, so in individual JSP pages or classes or whatever would need acces to that images folder, you could reference the application scope variable for that path instead of writing it out in each place. Then if for some reason we needed to move the location of that images folder, we would just change the path variable in the one location and not have to update 20 places that reference that images folder.
I have had trouble finding any information on this type of thing in my research online, which is why I am asking about it here. I know it is a lot to ask for an explanation to this type of thing, but I figured I would ask and see what type of responses I could get.
Thank you for any help you can provide about this topic.
The equivalent is probably the ServletContext
In your controller servlet:
ServletContext context = request.getSession().getServletContext();
Just like in the session object you can store attributes in the servlet context as well
context.setAttribute("someValue", "aValue");
Object attribute = context.getAttribute("someValue");
If you're starting out with Java and you have a non-trivial application to build, I would recommend using a popular framework like Spring or Struts

WCF: Should all datacontracts use the same namespace?

I have several service contracts exposed over WCF, which use multiple datacontracts. The service is to be consumed by Adobe Flex. I've run into many problems getting Flex to consume the WSDL produced by the server. I used the procedure outlined here to squeeze the WSDL into a single file (I used FlatWsdl and not WcfExtras, if it matters).
Now I'm getting a bunch of errors when using VS2010's own wsdl.exe tool to extract my metadata. Specifically, I'm getting the following errors:
1) Schema validation warning: Schema item 'complexType' named
'ArrayOfKeyValueOfSomeKeySomeValuep1alXzIb' from namespace
'http://schemas.microsoft.com/2003/10/Serialization/Arrays' is invalid.
Namespace 'http://My/Wcf/Namespace' is not available to be referenced
in this schema.
2) Schema validation warning: Schema item 'complexType' named 'MyComplexType'
from namespace 'http://My/Wcf/Namespace' is invalid. Namespace
'http://schemas.datacontract.org/2004/07/My.Real.Namespace' is not available
to be referenced in this schema.
Now, the Dictionary ("ArrayOfKeyValueOf...") type is apparently defined in an external schema, which is not imported by my WSDL. Please note that SomeKey and SomeValue have a datacontract namespace of My/Wcf/Namespace.
As for MyComplexType, the weird thing is that if I change its Datacontract-namespace to the same namespace used by my services, servers, and bindings, then error (2) goes away. I can't figure out why.
What I'm asking boils down to two questions:
1) How can I add an import directive of an external schema to my WSDL? I saw some solutions on-line that suggested writing a wrapper class around the containers. This is something I would really like to avoid.
2) Do I really have to put all my datacontracts into a single namespace? I don't have any technical objection to doing it, but it's going to be very cumbersome to modify the namespace of all datacontracts. Perhaps there's an automated way of achieving this?
TIA!
So just in case anyone else runs into the same problem with accessing a WCF (BasicHttpBinding) server from a Flex client:
1) No, all DataContracts need not be in the same namespace (but all ServiceContracts, service implementations, and bindings do have to be in the same namespace!).
2) The crux of the problem is that Flex expects each xsd:schema to have an "xsd:import namespace" for all the namespaces it references. This import should be of the form:
<xsd:import namespace="http://schemas.datacontract.org/2004/07/SomeNamespace" />
There doesn't seem to be a way to do this with WCF, since it automatically adds an auto-generated schemaLocation attribute to this tag, which makes Flex try to fetch this schemaLocation. The only workaround appears to be manually manipulating the WSDL at the XML level (e.g. by exposing a REST endpoint for retrieving the metadata).
Thanks to Yaron Naveh in the MSDN WCF forums for his help. The discussion can be found at http://social.msdn.microsoft.com/Forums/en/wcf/thread/b9429e30-e4d5-454f-9fbd-bae39990ff33.

Method 'XYZ' cannot be reflected

We have consumed a third party web service and are trying to invoke it from an ASP.NET web application.
However when I instantiate the web service the following System.InvalidOperationException exception is thrown:
Method 'ABC.XYZ' can not be reflected.
System.InvalidOperationException:
Method 'ABC.XYZ' can not be reflected.
---> System.InvalidOperationException: The XML element 'MyDoc' from namespace
'http://mysoftware.com/ns' references
a method and a type. Change the
method's message name using
WebMethodAttribute or change the
type's root element using the
XmlRootAttribute.
From what I can gather there appears to be some ambiguity between a method and a type in the web service.
Can anyone clarify the probably cause of this exception and is there anything I can do to rectify this or should I just go to the web service owners to rectify?
Edit: Visual Studio 2008 has created the proxy class. Unfortunately I can't provide a link to the wsdl as it is a web service for a locally installed thrid party app.
I ran into the same problem earlier today.
The reason was - the class generated by Visual Studio and passed as a parameter into one of the methods did not have a default parameterless constructor. Once I have added it, the error had gone.
It seems the problem is down to data type issues between VS and the web service that was written in Java.
Ultimately it was fixed by manually editing the class and schema files that were created by VS.
I have come across the exact same problem when I was consuming a 3rd party web service. The problem in this instance was that the mustUndertand property in the reference file was looking for a Boolean, whereby the namespace property looked for a string.
By looking through the reference i was able to idenitfy the offending property and simply add "overrides" to the method signature.
Not ideal as any time you update the service you have to do this but I couldn't find any other way around this.
To find the reference file select "all files" from the solution explorer
Hope this helps
I'm guessing the wsdl emitted by or supplied with the service is not in a form that wsdl.exe or serviceutil can understand - can you post the wsdl or link to it?
how are you creating the proxy classes?
Also you might like to try and validate the wsdl against the wsdl schema to check its valid
In my case I was getting a "method cannot be reflected" error due to that fact that in the class being returned by method, I had failed to expose a default parameter-less constructor.
I was working in VB.NET. In my return class I had declared a "New(..)" method that took a couple parameters (because that is how I wanted to use it in my code). But by doing so, I had supressed the default (hidden) parameterless New() constructor that VB adds behind the scenes. Apparently the web service handler requires that a parameterless constructor be available. As soon as I added back into my class a parameterless New() constructor, it all worked fine.
I got the same message but mine was caused by a missing System.Runtime.Serialization.dll since I tried to run a 3.5 application on a machine with only .NET 2.0 installed.
I had the same issue but I found that one of the WebMethod parameters has a member that is of type interface that is why VS could not serialise it. here is the exception when trying to download the disco file
System.InvalidOperationException: Cannot serialize member
'Leopard.JobDespatchParameters.SendingUser'
of type 'Leopard.Interfaces.IUser', see inner exception for more
details. ---> System.NotSupportedException: Cannot serialize member
Leopard.JobDespatchParameters.SendingUser
of type Leopard.Interfaces.IUser because it is an interface.
Old thread but I had a different issue, Maybe of help to someone. referenced dlls were mixed up between two versions on data layer and service layer that caused the problem.
Another scenario where this error can happen: I simply had another web method with the same name (but different parameters)in my web service that slipped in during a code merge. After I deleted the old method it worked.

Resources