liferay error on superclassing IFramePortlet - iframe

In the developing of liferay portlet, If I use IFramePortlet(com.liferay.portlet.iframe.IFramePortlet) in portlet-class tag in portlet xml
ERROR like this -
Registering portlets for gospel-for-asia-portlet
06:08:00,712
ERROR [localhost-startStop-6][PortletBagFactory:411] java.lang.ClassNotFoundException: com.liferay.portlet.iframe.IFramePortlet
(sometimes NoClassDefFoundError happens)
This error occurs on registering not building. I did add External Jars with portal-impl.jar for this.
That source is presented on github. I didn't change anything.
I am struggling with this problem for couple of days. Any clues would be welcomed.
Thank you.

You must not add portal-impl.jar to your custom portlets. This is the problem: IFramePortlet is part of portal-impl.jar, so it's part of Liferay's implementation. You don't have access to this class from a plugin. If you want it, you'll have to get the sourcecode and implement it yourself.
Adding portal-impl.jar will try to initialize all kind of portal infrastructure for a second time. Plus, you'll not want to depend on such a big library just for a tiny trivial portlet implementation.

Related

How to integrate spring-security.xml file into spring boot ? using Annotation base only

I have searched and didn't find any helpful solution that's why i am going to post this question.
Actually i have spring boot project which is completely configure based upon 'Annotation'.
Now for some reason, i need to add spring-security into this project.
for that i am getting spring-security-XXX.xml file from other co-worker.
Now, i am thinking how can i wrote some Annotation which will automatically load that spring-serity-xxx.xml file into my current project environment without change any other part, so that i can achieve security feature as per spring-serity-xxx.xml file.
For example, #Configuration(classpath:spring-security-config.xml) something like, is it possible ?.
if it's possible then provide me completed list of configuration.
NOTE : security added to get OAuth integration.
Any Help Appreciate..!!
Use #ImportResource annotation.

MassTransit Unity Example

I have been attempting to configure masstransit in my Web Application's UnityConfig.cs file with no success. I have attempted several methods and read many articles, but still have not gotten it to work. I looked at the example that is on the MassTransit site but can not seem to get it to work. The first issue that I am having is the I cannot figure out what assembly the "TypeFinder" class lives in, nor can I find the "FindTypesWhichImplement" method.
Is the example on the masstransit page suppose to work or is it more of "This is what it may look like" example.
The Starbucks sample (https://github.com/MassTransit/RabbitMQ-Samples/tree/master/Starbucks) has Winsor, StructureMap, and NInject but no Unity. I don't think any of the core team uses Unity.
Though I'd start with making sure you have Unity integration NuGet package included. Check your namespaces (using MassTransit;). It's all extension methods, and should be in the MassTransit namespace. We might have misplaced a type in the wrong namespace somewhere but my quick check of the source doesn't show any.

ASP.NET with Unity 2.0

Can anyone help point me to some good resources for working with Unity 2.0 in an ASP.NET that doesn't talk about ASP.NET MVC?!?
We are not using MVC and I am struggling to get Unity to inject dependencies into my pages following the couple of examples I've read (which are all based on David Hayden's work so they are all presenting the same examples and code).
UPDATE
I tried to go the PageHandlerFactory route but the example (here) is incomplete and no source code is available to accompany the article.
So, I decided to try the custom HttpModule approach described here and here. Again, no source code is available beyond what is shown so it is difficult to troubleshoot issues.
The problem I have now is that all of the plumbing appears to be wiring up correctly but the Buildup method does nothing to my page. I can see all of the types are registered in the container when I set a break-point in the module code and the code is executing as expected. But a break-point in the Page_Load event handler shows that the dependencies are all null.
The property in question is public, with a setter and getter, and is marked with the Dependency attribute. I've tried with and without the attribute, with and without a mapping name, ... every combination I could think of and nothing works.
What am I missing???
It depends what you expect. Most exemples targeting MVC present custom controller factory which allows creating controllers with dependency injection. This is indeed also possible with web forms but instead of controller you must inject dependencies into pages. To do this you must replace PageHandlerFactory with custom implementation.
You can create your own implementation of PageHandlerFactory which will be able to resolve pages directly and inject dependencies defined in constructor or you can use one of these (here, here and here) which instead uses stantandard PageHandlerFactory and builds page instance (resolve property dependencies).

silverlight error - the opreation is not supported for a relative uri

I've just started developing silverlight applications. I've created a webserivce in my asp.net project. Now, when I try to connect to it through my silverlight project I receive the following error:
"the opreation is not supported for a relative uri"
I am using the following url -->
http://192.168.1.2/MyWebsite/SubVersionedHistory.svc
I can find the class and its methods, but I receive this horrific error when I add it.
Thank you for your help and advice,
Vondiplo
I don't think you're alone in hitting this problem. I hit it today with VS2008SP1 + SL2 trying to create a Service Reference for an ADO.NET Data Service. First time I've hit the error.
Others have detailed similar experiences to reach this error:
http://silverlight.net/forums/t/87535.aspx
http://silverlight.net/forums/t/56629.aspx
It's not entirely clear at this point if the issue is with the IDE "Add Service Reference" dialog or something specific in the services causing this error. In my case, however, my code still worked despite the error message. I simply passed the URL to my service in the constructor of my DataService proxy client, like this:
var context = new DataServiceContext(new Uri("NorthwindDataService.svc", UriKind.Relative));
Summary point: Just because you hit this error in the IDE, your service reference may still work. Give it a try and let us know if you're seeing errors at run time.
Hope that helps.
[UPDATE] Based on some other advice I've found and tested, you can also try:
deleting your Service Reference
deleting your ServiceReferences.ClientConfig file
saving your solution
and then closing and reopening it in VS.
The simple act of closing and reopening your project has been shown to fix several problems with the Add Service wizard. Re-run the Add Service Ref wizard and you may have better luck. I personally tested this solution on a project today and can confirm it works. Hope that adds extra help to finding your solution.
You should be more specific about your problem. For example, are you having this problem when adding the reference or when you actually try to consume the service?
It sounds like you need to be using a full path, including the "http://" but that is just a shot in the dark based on the error message you provide.
[edit]If you are using the built in ASP.NET server instead of IIS then be sure you set a specific port number and use it in your path. For example, I have used http://localhost:4940/MyService.svc for testing[/edit]
Maybe this response can help you
You cannot use AbsolutePath, You need to use AbsoluteURL. Build your URL this way:
Uri url = new Uri(App.Current.Host.Source, "../settings.xml");client.DownloadStringAsync(url);
http://silverlight.net/forums/p/28912/95541.aspx
HTH
Braulio
Check the ServiceReferences.ClientConfig
if there are multiple endpoints there you will get this exception. one thing that can cause this is referencing a service using casini, later switiching to IIS express and rereferencing the service.

Can Microsoft Code Contracts be used with an ASP.NET Website?

I'm currently using Microsoft Code Contracts in an ASP.NET MVC application without any issues but I can not seem to get it quite running in a basic ASP.NET Web site. I'm not entirely sure it was made to work with this type of project (although it shouldn't matter) so I wanted to bring it up to everyone.
I can compile the contracts just fine but the code skips over them since I'm assuming it hasn't been enabled through the Properties Page like you would do in other project types (ie ASP.NET MVC). I've gone to the property page of the project (which displays a dialog instead of the typical properties page) in my ASP.NET web site but it does not yield the same menu options and as such, doesn't have a section devoted to Code Contracts.
Also, I have Microsoft Code Contracts properly enabled within a class library project that I use to separate my business logic from the web site. The contracts compile fine but when a contract is violated, it throws a rather uninformative "Exception of type 'System.ExecutionEngineException' was thrown" error with no inner exception. My contract specifies a message to display upon violation but it is nowhere within the exception. It simply halts the execution of the process (which I believe is the default functionality for Microsoft Code Contracts).
I can't find anywhere that explicitly states that a particular project type can or can't (or shouldn't) be used with Contracts so I just wanted to see if anyone has had this issue.
Thanks for any help!
I had the same problem and this is how I solved it:
In the Referenced Class Libraries, right click -> properties -> code contracts.
Make sure "perform contract checking" is checked. I had mine set to "Full"
Contract Reference Assembly: make sure it is set to "Build"
Save your changes.
In the Referenced Class Libraries that have no contracts in their code, set the Contract Reference Assembly to "Do Not Build".
Then in the MVC project, have the Code Contracts "perform contract checking" checked. I had mine set to "Full".
Hope that helps somebody.
This sounds less like a Contracts and more like a build/config issue. Have you tried to deploy a prebuilt website? Are you sure that your website code sees the contracts code? Is the ASP.NET runtime using the CLR 4.0, or does it see the earlier Microsoft.Contracts.dll? Etc.

Resources