isis-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Haywood <...@haywood-associates.co.uk>
Subject Re: Starting app with AppManifest (1.12.1)
Date Tue, 03 May 2016 07:34:56 GMT
On 2 May 2016 12:49, "Erik de Hair" <e.dehair@pocos.nl> wrote:
>
> Hi Dan,
>
> While trying to create a simple app I found out the problem was in my
code. I had a method with @PostConstruct where a field (with @Injected)
being called was null. Shouldn't an injected field be set before the
PostConstruct-method is called?
>

Yes, they should, and I believe this works. I just added a quick
@PostConstruct methods to the SimpleObjects domain service in the simpleapp
archetype, and I can see that the RepositoryService is correctly injected.

Possible reason for null.. if might be that there's a superclass that also
has this field, meaning that the subclass field isn't injected into... I
think I once saw this.
Otherwise, not sure, is the service injected subsequently/at all? Need a
rest case app to reproduce problem, I think.

> I can go on for now because I solved this in another way.
>
> But now I've got another problem. I'm running the app in prototyping mode
using WebServer-class. It starts without context-path set and I can't open
any page. Should the context path be configured somewhere?
>

Hmm, perhaps. I guess I'm not sure, actually. In the simpleapp archetype it
serves up the index.html, swagger-ui/index.html and application.css files
directly from their respective directories under src/main/webapp, are none
of these being served fire you either?

Again, think I need a test case app to reproduce.  Also, would be
worthwhile doing a directory-wise diff of your current app vs that
generated by the simpleapp archetype.

HTH,
Dan

> Erik
>
>
> On 04/29/2016 04:11 PM, Dan Haywood wrote:
>>
>> Bit difficult to say without seeing the reason for the
NullPointerException.
>>
>> You might want to use the current simpleapp archetype to generate a blank
>> webapp, and then do a merge over.  Steve Cameron did something similar
>> recently, didn't seem to take him long...
>>
>>
>>
>> On 29 April 2016 at 14:53, Erik de Hair <e.dehair@pocos.nl> wrote:
>>
>>> Hi Dan,
>>>
>>> On 04/29/2016 03:35 PM, Dan Haywood wrote:
>>>
>>>> remove the line:
>>>>
>>>>    bind(AppManifest.class).to(PortalModuleAppManifest.class);
>>>>
>>>> from the PortalApplication... I think the error says its already
>>>> configured, probably because the isis.appManifest property is set in
>>>> isis.properties (or equivalently specified as -m flag to
o.a.i.WebServer).
>>>>
>>>> If that's the case, it might be a documentation issue that needs
fixing.
>>>>
>>> Removing the line and setting the manifest property in isis.properties
>>> does work but now I get another exception:
>>>
>>> 15:50:23,239  [IsisWicketApplication main       ERROR]  Failed to
>>> initialize
>>> com.google.inject.ProvisionException: Unable to provision, see the
>>> following errors:
>>>
>>> 1) Error in custom provider,
>>>
org.apache.isis.core.runtime.system.transaction.IsisTransactionManagerException:
>>> java.lang.NullPointerException
>>>    at
>>>
org.apache.isis.core.runtime.runner.IsisInjectModule.provideIsisSystem(IsisInjectModule.java:127)
>>>    at
>>>
org.apache.isis.core.runtime.runner.IsisInjectModule.provideIsisSystem(IsisInjectModule.java:127)
>>>    while locating org.apache.isis.core.runtime.system.IsisSystem
>>>      for field at
>>>
org.apache.isis.viewer.wicket.viewer.IsisWicketApplication.isisSystem(IsisWicketApplication.java:149)
>>>    while locating webapp.PortalApplication
>>>
>>> 1 error
>>>      at
>>>
com.google.inject.internal.Errors.throwProvisionExceptionIfErrorsExist(Errors.java:482)
>>>      at
>>>
com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:67)
>>>      at
>>>
com.google.inject.internal.InjectorImpl.injectMembers(InjectorImpl.java:984)
>>>      at
>>>
org.apache.isis.viewer.wicket.viewer.IsisWicketApplication.init(IsisWicketApplication.java:264)
>>>      at webapp.PortalApplication.init(PortalApplication.java:102)
>>>
>>>
>>>> let me know...
>>>>
>>>> Dan
>>>>
>>>>
>>>> On 29 April 2016 at 14:31, Erik de Hair <e.dehair@pocos.nl> wrote:
>>>>
>>>> Hi,
>>>>>
>>>>> When trying to run our application with org.apache.isis.WebServer
using
>>>>> an
>>>>> AppManifest I get the following error:
>>>>>
>>>>> 15:07:14,497  [IsisWicketApplication main       ERROR]  Failed to
>>>>> initialize
>>>>> com.google.inject.CreationException: Unable to create injector, see
the
>>>>> following errors:
>>>>>
>>>>> 1) A binding to org.apache.isis.applib.AppManifest was already
configured
>>>>> at
>>>>>
>>>>>
org.apache.isis.core.runtime.runner.IsisInjectModule.configure(IsisInjectModule.java:107).
>>>>>     at webapp.PortalApplication$1.configure(PortalApplication.java:94)
>>>>> (via
>>>>> modules: com.google.inject.util.Modules$OverrideModule ->
>>>>> webapp.PortalApplication$1)
>>>>>
>>>>> 1 error
>>>>>       at
>>>>>
>>>>>
com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:466)
>>>>>       at
>>>>>
>>>>>
com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:155)
>>>>>       at
>>>>>
>>>>>
com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
>>>>>       at com.google.inject.Guice.createInjector(Guice.java:96)
>>>>>       at com.google.inject.Guice.createInjector(Guice.java:73)
>>>>>       at com.google.inject.Guice.createInjector(Guice.java:62)
>>>>>       at
>>>>>
>>>>>
org.apache.isis.viewer.wicket.viewer.IsisWicketApplication.init(IsisWicketApplication.java:262)
>>>>>       at webapp.PortalApplication.init(PortalApplication.java:104)
>>>>>       at
>>>>> org.apache.wicket.Application.initApplication(Application.java:823)
>>>>>
>>>>>
>>>>> ThenewIsisWicketModule-method of our PortalApplication:
>>>>>
>>>>> @Override
>>>>> protectedModule newIsisWicketModule()
>>>>> {
>>>>>      finalModule isisDefaults =super.newIsisWicketModule();
>>>>>
>>>>>      finalModule resellerPortalOverrides =newAbstractModule()
>>>>>      {
>>>>>         @Override
>>>>>         protected voidconfigure()
>>>>>         {
>>>>>            bind(PageClassList.class).to(PortalPageClassList.class);
>>>>>
>>>>>
>>>>>
bind(String.class).annotatedWith(Names.named("applicationName")).toInstance("ITCO
>>>>> Portal");
>>>>>
>>>>>
>>>>>
bind(String.class).annotatedWith(Names.named("applicationCss")).toInstance("css/application.css");
>>>>>
>>>>>
>>>>>
bind(String.class).annotatedWith(Names.named("applicationJs")).toInstance("scripts/application.js");
>>>>>
>>>>>
>>>>>
bind(String.class).annotatedWith(Names.named("welcomeMessage")).toInstance(readLines("welcome.html"));
>>>>>
>>>>>
>>>>>
bind(String.class).annotatedWith(Names.named("aboutMessage")).toInstance(readLines("about.html"));
>>>>>
>>>>>
>>>>>
bind(String.class).annotatedWith(Names.named("brandLogoHeader")).toInstance("/portal/images/Pocos-Logo-Powering-portal.png");
>>>>>
>>>>>
>>>>>
bind(String.class).annotatedWith(Names.named("brandLogoSignin")).toInstance("/portal/images/Pocos-Logo-Powering-portal.png");
>>>>>
>>>>>
>>>>>
bind(InputStream.class).annotatedWith(Names.named("metaInfManifest")).toProvider(Providers.of(getServletContext().getResourceAsStream("/META-INF/MANIFEST.MF")));
>>>>>
>>>>>
>>>>>
bind(ComponentFactoryRegistrar.class).to(PortalComponentFactoryRegistrar.class);
>>>>>            bind(AppManifest.class).to(PortalModuleAppManifest.class);
>>>>>         }
>>>>>      };
>>>>>
>>>>>
 returnModules.override(isisDefaults).with(resellerPortalOverrides);
>>>>> }
>>>>>
>>>>> Did I forget something?
>>>>>
>>>>> Erik
>>>>>
>>>>>
>>>>>
>>>>>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message