You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2004/07/27 16:21:32 UTC

DO NOT REPLY [Bug 30347] New: - embedded:standardContext.addResource(string, string) throw npe

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30347>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=30347

embedded:standardContext.addResource(string, string) throw npe

           Summary: embedded:standardContext.addResource(string, string)
                    throw npe
           Product: Tomcat 5
           Version: 5.0.27
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: mmoiroux@sopragroup.com


Hello,
I am using tomcat 5.0.27 embedded (great!) and i need to use datasource. I 
have tried two differents ways to append a datasource to standardContext.
First way work nice:
     StandardContext standardContext = embedded.createContext(...,...)     
     ...
     ContextResource contextResource = new ContextResource();
     contextResource.setType(DataSource.class.getName());
     contextResource.setName("jdbc/name");
     standardContext.addResource(contextResource);
     ....
but i was expected the second way works too (as it seems to me be only a 
shorter way to proceed):
     StandardContext standardContext = embedded.createContext(...,...)     
     ...
     standardContext.addResource("jdbc/name",DataSource.class.getName());
     ...
but it throw a nullPointerException line 5220 in StandardContext because a 
variable (namely "managed") is null after a call to Registry.findManagedBean
("ContextResource")...

I hope it could help you. 
Regards,
Matthieu Moiroux

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org