clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay_33_g$(...).style_86_g$ is not a function - gwt

Well, all of a sudden everything seems to be broken. I can't recall what I changed. I cleaned the whole project, I checked out an older version of it, I removed all code-server compiled files, restarted Eclipse etc. but I am getting the following error here:
Caused by: com.google.gwt.core.client.JavaScriptException: (TypeError) : this.get_clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay_17_g$(...).style_48_g$ is not a function
ConsoleLogger.java:32 TypeError: this.get_clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay_17_g$(...).style_48_g$ is not a function
at Jmg_g$ [as build_style_17_g$] (HomeView_BinderImpl.java:74)
at Dmg_g$ (HomeView_BinderImpl.java:43)
at ymg_g$ [as createAndBindUi_17_g$] (HomeView_BinderImpl.java:31)
at zmg_g$ [as createAndBindUi_0_g$] (HomeView_BinderImpl.java:28)
at tmg_g$ (HomeView.java:20)
at qng_g$ [as com$mz$client$application$admin$home$HomeView_com$mz$client$application$admin$home$HomeView_methodInjection_0_g$] (com_gwtplatform_mvp_client_DesktopGinjector_DesktopGinjectorGinjector_fragment.java:116)
at xng_g$ [as get_Key$type$com$mz$client$application$admin$home$HomeView$_annotation$$none$$_0_g$] (com_gwtplatform_mvp_client_DesktopGinjector_DesktopGinjectorGinjector_fragment.java:106)
at ung_g$ [as get_Key$type$com$mz$client$application$admin$home$HomePresenter$MyView$_annotation$$none$$_0_g$] (com_gwtplatform_mvp_client_DesktopGinjector_DesktopGinjectorGinjector_fragment.java:30)
at vng_g$ [as get_Key$type$com$mz$client$application$admin$home$HomePresenter$_annotation$$none$$_0_g$] (com_gwtplatform_mvp_client_DesktopGinjector_DesktopGinjectorGinjector_fragment.java:57)
at Gng_g$ [as get_27_g$] (com_gwtplatform_mvp_client_DesktopGinjector_DesktopGinjectorGinjector_fragment.java:78)
at Hng_g$ [as get_21_g$] (com_gwtplatform_mvp_client_DesktopGinjector_DesktopGinjectorGinjector_fragment.java:77)
at I5f_g$ [as get_16_g$] (StandardProvider.java:47)
at b7d_g$ [as getPresenter_0_g$] (ProxyImpl.java:44)
at lag_g$ [as handleRequest_0_g$] (ProxyPlaceAbstract.java:263)
at xag_g$ [as onPlaceRequest_0_g$] (ProxyPlaceAbstract.java:201)
at L6d_g$ [as dispatch_54_g$] (PlaceRequestInternalEvent.java:130)
at K6d_g$ [as dispatch_1_g$] (PlaceRequestInternalEvent.java:129)
at W6b_g$ [as dispatch_0_g$] (GwtEvent.java:76)
at Ngc_g$ (EventBus.java:40)
at rhc_g$ [as doFire_0_g$] (SimpleEventBus.java:193)
at yhc_g$ [as fireEventFromSource_0_g$] (SimpleEventBus.java:96)
at x4d_g$ [as fireEvent_1_g$] (PlaceManagerImpl.java:158)
at v4d_g$ [as doRevealPlace_0_g$] (PlaceManagerImpl.java:133)
at R4d_g$ [as revealPlace_1_g$] (PlaceManagerImpl.java:354)
at Q4d_g$ [as revealPlace_0_g$] (PlaceManagerImpl.java:335)
at Jxg_g$ [as redirectToLoggedOnPage_0_g$] (LoginPresenter.java:169)
at Mug_g$ [as loggedInAndInitialized_0_g$] (LoginPresenter.java:125)
at Vug_g$ [as done_1_g$] (LoginPresenter.java:115)
at Wce_g$ [as onChildRequestFailure_0_g$] (ParallelRequest.java:144)
at Xce_g$ [as onChildRequestSuccess_0_g$] (ParallelRequest.java:120)
at gde_g$ [as onSuccess_0_g$] (Request.java:68)
at Lfd_g$ [as onResponseReceived_0_g$] (RequestCallbackAdapter.java:232)
at pjc_g$ [as fireOnResponseReceived_0_g$] (Request.java:250)
at xkc_g$ [as onReadyStateChange_0_g$] (RequestBuilder.java:412)
at XMLHttpRequest.<anonymous> (XMLHttpRequest.java:329)
at DI_g$ (Impl.java:233)
at GI_g$ (Impl.java:285)
at XMLHttpRequest.<anonymous> (Impl.java:71)
It is happening now after I login and reveal the home place which looks like this:
private void revealAdminHomePlace() {
this.placeManager.revealPlace(new PlaceRequest.Builder()
.nameToken(AdminNameTokens.home)
.build());
}
Here is the HomeModule:
public class HomeModule extends AbstractPresenterModule {
#Override
protected void configure() {
this.bindPresenter(HomePresenter.class, HomePresenter.MyView.class,
HomeView.class, HomePresenter.MyProxy.class);
}
}
The HomePresenter
public class HomePresenter extends Presenter<HomePresenter.MyView, HomePresenter.MyProxy> {
private final static Logger LOGGER = Logger.getLogger(HomePresenter.class.getName());
public interface MyView extends View {
}
#ProxyStandard
#NameToken(AdminNameTokens.home)
public interface MyProxy extends ProxyPlace<HomePresenter> {
}
#Inject
public HomePresenter(EventBus eventBus, MyView view, MyProxy proxy) {
super(eventBus, view, proxy, AdminToolPresenter.SLOT_AdminToolMainContent);
}
#Override
protected void onReveal() {
LOGGER.fine("HomePresenter.onReveal()");
super.onReveal();
}
}
The HomeView:
public class HomeView extends ViewImpl implements HomePresenter.MyView {
public interface Binder extends UiBinder<Widget, HomeView> {
}
#Inject
public HomeView(Binder uiBinder) {
this.initWidget(uiBinder.createAndBindUi(this));
}
}
As well as the HomeView.ui.xml file:
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:m="urn:import:gwt.material.design.client.ui"
xmlns:m.addins="urn:import:gwt.material.design.addins.client.ui">
<ui:style>
</ui:style>
<g:HTMLPanel>
<m:MaterialLabel text="Welcome home!"/>
</g:HTMLPanel>
</ui:UiBinder>
I have no idea what is wrong here and I can't seem to figure out the problem. I have absolutely no clue what this is all of a sudden..

In my case this seemed to have been caused by including some modern CSS in the widget's ui:style... No idea how that caused the error but I suspect the offending line is this: grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));. Once I put this piece of styling in a normal CSS file everything worked.

Just make sure you have enabled
<generateJsInteropExports>true</generateJsInteropExports>
when using gwt-maven-plugin.

I ran into this as well, turned out my browser was still having SuperDev mode turned on and I had recompiled the whole project.
Turning SuperDev mode off, and the issue was gone.

Yes this error was caused by <ui:style> element.
You may need just clear cache of codeserver under SuperDevMode by clicking on "clean" Button.

Related

"java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7" error when I try to run a REST Assured test class

I have JDK 1.8 installed and below is the class I run in Eclipse:
import io.restassured.RestAssured;
import static org.hamcrest.Matchers.equalTo;
import static io.restassured.RestAssured.given;
public class test {
public static void main(String[] args) {
RestAssured.baseURI = "https://jsonplaceholder.typicode.com";
given()
.queryParam("posts", "1")
.body("")
.when()
.get()
.then()
.assertThat().statusCode(200)
.body("userId", equalTo(2));
}
}
I get the following error:
java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7
at org.codehaus.groovy.vmplugin.VMPluginFactory.<clinit>(VMPluginFactory.java:43)
at org.codehaus.groovy.reflection.GroovyClassValueFactory.<clinit>(GroovyClassValueFactory.java:35)
at org.codehaus.groovy.reflection.ClassInfo.<clinit>(ClassInfo.java:107)
at org.codehaus.groovy.reflection.ReflectionCache.getCachedClass(ReflectionCache.java:95)
at org.codehaus.groovy.reflection.ReflectionCache.<clinit>(ReflectionCache.java:39)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.registerMethods(MetaClassRegistryImpl.java:209)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:107)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:85)
at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:36)
at org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:86)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.createMap(ScriptBytecodeAdapter.java:635)
at io.restassured.internal.ResponseParserRegistrar.<init>(ResponseParserRegistrar.groovy)
at io.restassured.RestAssured.<clinit>(RestAssured.java:346)
at test.main(test.java:12)
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.reflection.ReflectionCache
at org.codehaus.groovy.runtime.dgmimpl.NumberNumberMetaMethod.<clinit>(NumberNumberMetaMethod.java:33)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128)
at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:350)
at java.base/java.lang.Class.newInstance(Class.java:645)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.createMetaMethodFromClass(MetaClassRegistryImpl.java:257)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:110)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:85)
at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:36)
at org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:86)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.createMap(ScriptBytecodeAdapter.java:635)
at io.restassured.internal.ResponseParserRegistrar.<init>(ResponseParserRegistrar.groovy)
at io.restassured.RestAssured.<clinit>(RestAssured.java:346)
at test.main(test.java:12)
Run mvn dependency:tree to view the whole dependency tree. You check if you see a problem here.
And try upgrading the maven-plugin version.

How to write into Ionic's `ion-input` with Protractor?

I'm just starting out with Ionic and looking at the documentation I figured I would go down the route of using the built-in stuff over plain HTML.
So I have this HTML:
<ion-item>
<ion-input type="tel"
autofocus="true"
placeholder="Phone number"
name="phoneNumber"
formControlName="phoneNumber"></ion-input>
</ion-item>
And in my e2e test I want to write to that field so I tried to do:
$('ion-input[name="phoneNumber"]').sendKeys('12345678');
To which I get the following stack trace:
Failed: unknown error: cannot focus element
(Session info: chrome=68.0.3440.106)
(Driver info: chromedriver=2.41.578706 (5f725d1b4f0a4acbf5259df887244095596231db),platform=Mac OS X 10.13.6 x86_64)
WebDriverError: unknown error: cannot focus element
(Session info: chrome=68.0.3440.106)
(Driver info: chromedriver=2.41.578706 (5f725d1b4f0a4acbf5259df887244095596231db),platform=Mac OS X 10.13.6 x86_64)
at Object.checkLegacyResponse (/home/ba/workspace/ionic-test/node_modules/selenium-webdriver/lib/error.js:546:15)
at parseHttpResponse (/home/ba/workspace/ionic-test/node_modules/selenium-webdriver/lib/http.js:509:13)
at doSend.then.response (/home/ba/workspace/ionic-test/node_modules/selenium-webdriver/lib/http.js:441:30)
at process._tickCallback (internal/process/next_tick.js:68:7)
From: Task: WebElement.sendKeys()
at Driver.schedule (/home/ba/workspace/ionic-test/node_modules/selenium-webdriver/lib/webdriver.js:807:17)
at WebElement.schedule_ (/home/ba/workspace/ionic-test/node_modules/selenium-webdriver/lib/webdriver.js:2010:25)
at WebElement.sendKeys (/home/ba/workspace/ionic-test/node_modules/selenium-webdriver/lib/webdriver.js:2174:19)
at actionFn (/home/ba/workspace/ionic-test/node_modules/protractor/built/element.js:89:44)
at Array.map (<anonymous>)
at actionResults.getWebElements.then (/home/ba/workspace/ionic-test/node_modules/protractor/built/element.js:461:65)
at ManagedPromise.invokeCallback_ (/home/ba/workspace/ionic-test/node_modules/selenium-webdriver/lib/promise.js:1376:14)
at TaskQueue.execute_ (/home/ba/workspace/ionic-test/node_modules/selenium-webdriver/lib/promise.js:3084:14)
at TaskQueue.executeNext_ (/home/ba/workspace/ionic-test/node_modules/selenium-webdriver/lib/promise.js:3067:27)
at asyncRun (/home/ba/workspace/ionic-test/node_modules/selenium-webdriver/lib/promise.js:2927:27)Error
at ElementArrayFinder.applyAction_ (/home/ba/workspace/ionic-test/node_modules/protractor/built/element.js:459:27)
at ElementArrayFinder.(anonymous function).args [as sendKeys] (/home/ba/workspace/ionic-test/node_modules/protractor/built/element.js:91:29)
at ElementFinder.(anonymous function).args [as sendKeys] (/home/ba/workspace/ionic-test/node_modules/protractor/built/element.js:831:22)
at UserContext.<anonymous> (/home/ba/workspace/ionic-test/e2e/src/app.e2e-spec.ts:29:28)
at /home/ba/workspace/ionic-test/node_modules/jasminewd2/index.js:112:25
at new ManagedPromise (/home/ba/workspace/ionic-test/node_modules/selenium-webdriver/lib/promise.js:1077:7)
at ControlFlow.promise (/home/ba/workspace/ionic-test/node_modules/selenium-webdriver/lib/promise.js:2505:12)
at schedulerExecute (/home/ba/workspace/ionic-test/node_modules/jasminewd2/index.js:95:18)
at TaskQueue.execute_ (/home/ba/workspace/ionic-test/node_modules/selenium-webdriver/lib/promise.js:3084:14)
at TaskQueue.executeNext_ (/home/ba/workspace/ionic-test/node_modules/selenium-webdriver/lib/promise.js:3067:27)
From: Task: Run it("displays the login/signup screen") in control flow
at UserContext.<anonymous> (/home/ba/workspace/ionic-test/node_modules/jasminewd2/index.js:94:19)
at attempt (/home/ba/workspace/ionic-test/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:4297:26)
at QueueRunner.run (/home/ba/workspace/ionic-test/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:4217:20)
at runNext (/home/ba/workspace/ionic-test/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:4257:20)
at /home/ba/workspace/ionic-test/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:4264:13
at /home/ba/workspace/ionic-test/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:4172:9
at /home/ba/workspace/ionic-test/node_modules/jasminewd2/index.js:64:48
at ControlFlow.emit (/home/ba/workspace/ionic-test/node_modules/selenium-webdriver/lib/events.js:62:21)
at ControlFlow.shutdown_ (/home/ba/workspace/ionic-test/node_modules/selenium-webdriver/lib/promise.js:2674:10)
at shutdownTask_.MicroTask (/home/ba/workspace/ionic-test/node_modules/selenium-webdriver/lib/promise.js:2599:53)
From asynchronous test:
Error
at Suite.<anonymous> (/home/ba/workspace/ionic-test/e2e/src/app.e2e-spec.ts:16:3)
at addSpecsToSuite (/home/ba/workspace/ionic-test/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:1107:25)
at Env.describe (/home/ba/workspace/ionic-test/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:1074:7)
at describe (/home/ba/workspace/ionic-test/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:4399:18)
at Object.<anonymous> (/home/ba/workspace/ionic-test/e2e/src/app.e2e-spec.ts:5:1)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Module.m._compile (/home/ba/workspace/ionic-test/node_modules/ts-node/src/index.ts:439:23)
at Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Object.require.extensions.(anonymous function) [as .ts] (/home/ba/workspace/ionic-test/node_modules/ts-node/src/index.ts:442:12)
By looking at the HTML I notice that the actual input is inside the shadow DOM so I tried accessing it by using:
element(by.deepCss('input[name="phoneNumber"]')).sendKeys('12345678');
But it gave me: Failed: element not visible and it seems like it's finding the <input type="hidden" …> that ion-input creates. So I changed it to search for input[type="tel"] as that's unique, but no luck as it now instead says there isn't any item.
The shadow DOM is new to me and I don't really know much about it, am I missing something obvious with how I should behave with it? I've attached a screenshot from my Chrome inspector view.
In ionic4, you can handle ion-input with this:
element(by.css('ion-input[name="phoneNumber"] input')).sendKeys('91296754')
After posting this I found the protractor-uisref-locator Protractor locator plugin which added support for another Ionic component. So I took that and changed it a bit and created this locator that can find my inner input for me. I have no idea why by.deepCss didn't work and would love to understand that better.
by.addLocator('ionInput', (name, opt_parentElement) => {
const using = opt_parentElement || document,
ionInput = using.querySelector('ion-input[name="' + name + '"]');
if (ionInput) {
return ionInput.shadowRoot.querySelector('input');
} else {
return;
}
});
And usage:
element(by.ionInput('phoneNumber')).sendKeys('12345678');
In Ionic 5, I needed to use the following:
var email_input = element(by.css('ion-input[ng-reflect-name="email"] input'));
email_input.sendKeys("somemail#somedomain.it")

ionic 3 build VirtualStats stopped

Yesterday my app was working fine on browser but now I get an error:
[21:01:05] transpile started ...
[21:01:11] typescript: .../feederhorgasz/node_modules/#ionic/app-scripts/dist/util/virtual-file-utils.d.ts, line: 3
Class 'VirtualStats' incorrectly implements interface 'Stats'. Property 'atimeMs' is missing in type
'VirtualStats'.
L2: export declare class VirtualStats implements Stats {
L3: protected _path: string;
L4: protected _ctime: Date;
Error: Failed to transpile program
at BuildError.Error (native)
at new BuildError (C:\Users\Thomas\mobiledevelopment\feederhorgasz\node_modules\#ionic\app-scripts\dist\util\errors.js:16:28)
at C:\Users\Thomas\mobiledevelopment\feederhorgasz\node_modules\#ionic\app-scripts\dist\transpile.js:159:20
at transpileWorker (C:\Users\Thomas\mobiledevelopment\feederhorgasz\node_modules\#ionic\app-scripts\dist\transpile.js:107:12)
at Object.transpile (C:\Users\Thomas\mobiledevelopment\feederhorgasz\node_modules\#ionic\app-scripts\dist\transpile.js:64:12)
at C:\Users\Thomas\mobiledevelopment\feederhorgasz\node_modules\#ionic\app-scripts\dist\build.js:106:82
Put this code on Your project folder\node_modules#ionic\app-scripts\dist\util\virtual-file-utils.d.ts
readonly atimeMs: any;
readonly mtimeMs: any;
readonly ctimeMs: any;
readonly birthtimeMs: any;

Play Dependency Injection Error

I am trying to use DI to inject a webservice client in my application. I get runtime exception as i refer current application in the object being injected. Below is the skeletal of my code.
**import play.api.Play.Current**
#Singleton
class MicorServiceClient#Inject()(ws: WSclient) {
// References curret.configuraiton.getString(
....
}
class Application #Inject()(microServiceClient: MicorServiceClient) extends Controller {
def someMethod= Action {
//Calls the micorservicelient.getResponse()
}
}
I see following error when my api is called.
#709lj5bmd: Unexpected exception
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:170)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:126)
at scala.Option.map(Option.scala:146)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:126)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:124)
at scala.util.Success.flatMap(Try.scala:231)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:124)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:116)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1689)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: com.google.inject.ProvisionException: Unable to provision, see the following errors:
1) Error injecting constructor, java.lang.RuntimeException: There is no started application
Ah, solved the issue, i need to pass play.api.Configuration to the Client and remove the references to current
so my MicroServiceClient definition looks like below
class MicroServiceClient(ws: WSclient, configuration: play.api.Configuration) {
}

Unity 3: The type does not have an accessible constructor

I have a following interface and implementation
namespace ProjectName.Web
{
public interface IWebUtil
{
}
}
namespace ProjectName.Web
{
public class WebUtil : IWebUtil
{
}
}
in my config i have this registration. I am using Unity 3.
<unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
<assembly name="ProjectName.Web" />
...
<register name="WebUtil" type="ProjectName.Web.IWebUtil" mapTo="ProjectName.Web.WebUtil">
<lifetime type="transient" />
</register>
...
When I try to resolve this configuration I am getting this error:
Exception is: InvalidOperationException - The type IWebUtil does not have an accessible constructor.
-----------------------------------------------
At the time of the exception, the container was:
Resolving ProjectName.Web.IWebUtil,(none)
I have tried to add empty public constructor but no sucess.
Can anybody help with this? thanks.
The first step is to ensure that you are loading the Unity configuration since this is not done by default. To do this:
using Microsoft.Practices.Unity.Configuration;
container.LoadConfiguration();
I'm assuming you've done this. I'm also going to assume that you are trying to resolve IWebUtil using the following code:
container.Resolve<IWebUtil>();
This throws an InvalidOperationException because IWebUtil is configured as a named registration (with name "WebUtil"). So either resolve using the configured name:
container.Resolve<IWebUtil>("WebUtil");
Or change the registration to be a default (unnamed) registration:
<register name="" type="ProjectName.Web.IWebUtil" mapTo="ProjectName.Web.WebUtil">
<lifetime type="transient" />
</register>