• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

NullPointerException - Alfresco Developer Manual, somecoModuleCore.bootstrapAuthorityCreator

 
Ranch Hand
Posts: 99
Postgres Database Flex Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am learning a whole bunch of things at once due to a new API I am learning. In the past, I've always jared my POJO's and distributed them as
sockets or on a web server by exploding my dir and dropping in my files. In the past week, aside from the new API I'm learning, I've been
introduced to Spring, Ant and Log4j. As a result of this, I'm not really sure where to look to solve my NPE problem.

I really appreciate any help that can be given me (and as late I have to apologize if I'm not in the right forum). I've been stuck on this for days and
while I'm learning the new API well, I can't move on until I fix this NPE problem. If I had any hair, I'd be pulling it out now.

Here's what happens. I build the following file with ant in Eclipse (I am used to using NetBeans but this API only has a tie into Eclipse so I'm using
Eclipse until I get through learning the API):



Everything compiles fine and my directories get created on Tomcat. I provide the build file as edification in case it is needed for you to help me.

Once I compile, I start Tomcat. It begins starting up until it gets to my module-context.xml file.



This file is "module-context.xml" and it is located in the WAR directory: {$WAR.dir}\classes\alfresco\module\com.someco.module.extension.Core\
module-context.xml

Once I start Tomcat and it hits the bean id="somecoModuleCore.bootstrapAuthorityCreator" line, I get a NullPointerException. The error is:



Here is the class and the line where the NPE occurs...



I have a null AuthorityService. Yet, my somecoModuleCore.bootstrapAuthorityCreator bean does have the dependencies set. Again, from
the module-context.xml file:



Can anyone help me understand why I'm getting a NPE?

Thanks so much for you help. This seems like the last hurdle to having my development environment set. If I can understand what I'm doing wrong here,
I can move on and fix this if it ever comes up in the future. I sincerely appreciate any help and please let me know if I've provided enough/relevant
information. Incidentally, I've also moved a lot of stuff around (like the order loading in the module-context.xml file). I have also tried putting declarations
in my init() method such as if(authorityService == null) {this.authorityService = new AuthorityServiceImpl();}. Nothing I have tried has worked.

Best,
Al

 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You'll need to be more specific where the exception is occurring; that's a lot of code and config to wade through.

Have you considered creating a minimal set of code and config to reproduce the error without overwhelming people with potentially unrelated detail?
 
Al Johnston
Ranch Hand
Posts: 99
Postgres Database Flex Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I appreciate that it's a lot. I included it all but tried to mark it well, knowing that I don't yet know enough about these packages to
know precisely what I need to be posting. Here's the problem in a nutshell I believe...

ERROR:


That NPE is happening when the loader get to {$WAR.dir}\alfresco\module\com.comeco.module.extension.core\module-context.xml.
The error code above goes on to say that the NPE is at line 44 of my BootstrapAuthorityCreator.
First, the declaration in module-context.xml:

SPRING BEAN


That creates the bean from BootstrapAuthorityCreator. Line 44, where I get the NPE is:

JAVA CLASS


Hope that helps and sorry for the verbosity.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is the authenticationService null?
 
Al Johnston
Ranch Hand
Posts: 99
Postgres Database Flex Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's what it appears to be. Since this is an example and I'm learning Spring due to following the example, I'm not sure how to ensure that AuthenticationService is instantiated. I would think that happens here:



Doesn't my <ref bean="authenticationService"> ensure that I have an AuthenticationService when Tomcat starts? Also, isn't that the value passed into setAuthenticationService(AuthenticationService authenticationService) in my BootstrapAuthorityCreator?

Incidentally, I did try to force AuthenticationService to be referenced. I added a line to my code in the init() method:



I still got an NPE.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It doesn't ensure there's an implementation unless you've defined a bean for it, otherwise it would have no idea what to instantiate.

If you do it manually and it's *still* throwing an NPE on the first line that uses it then something is broken with your deployment or configuration, or the NPE is coming from a different line.
 
Al Johnston
Ranch Hand
Posts: 99
Postgres Database Flex Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm sure that the NPE is coming from that line. Now if I just knew how to track down what is wrong in my config...

The classes I'm trying to use are getting created in the stack trace. The error is referenced in them before it is referenced in my object.



I'm sure it's something in my configuration. But, I'm having a hard time trying to figure out how to cure it.
 
Al Johnston
Ranch Hand
Posts: 99
Postgres Database Flex Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm going to mark this as sort-of-resolved as I was able to finally get it working.

This turns out to be an issue that can't be fixed with the Spring config. I lucked upon a google hit when searching for one of the error messages. The author of the book responded there to 'try deploying using "non-amp".' amp is a deploy configuration provided by the vendor that gives some additional support. In any event, I deployed without using the vendor's packages and everything works!
 
Al Johnston
Ranch Hand
Posts: 99
Postgres Database Flex Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear forum boss,

Upon discovery, I think that searchers would be better served if this thread were moved to the other open-source forum topic. I'm not sure how many people are searching around for Alfresco information, but from what I was finally able to dig up on the web, others have the problem I was having and this information may save them some time.

Best,
Al
reply
    Bookmark Topic Watch Topic
  • New Topic