https://issues.apache.org/bugzilla/show_bug.cgi?id=55703

            Bug ID: 55703
           Summary: Error in the JNDI Generic JavaBean Resources
                    documentation
           Product: Tomcat 7
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Documentation
          Assignee: dev@tomcat.apache.org
          Reporter: giulio.quares...@gmail.com

http://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html#Generic_JavaBean_Resources

In this page of the Tomcat 7 documentation - but this is true for all versions
- there is the following statement:

"The resource factory will create a new instance of the appropriate bean class
every time a lookup() for this entry is made."

But that seems not true. I created an example foo.bar.Bean, which simply
increment a static int at each creation. Then, I configured a BeanFactory in
the global resources section of server.xml, and I deployed a servlet which
simply lookup 1000 thousand times for the bean and print its string
representation in the response. 

To reproduce, follow the steps below using the targz attached:

1) configure a resource with a BeanFactory, as in the server.xml attached;
2) put the bean-factory-bug-bean.jar in the common classpath of the container;
3) start the container;
4) deploy the bean-factory-bug-web.war file in the appbase folder;
5) open http://localhost:8080/bean-factory-bug-web/BeanServlet

As for one can read from the documentation, the expected output is 

Bean #1
Bean #2
Bean #3
...
Bean #999
Bean #1000

But the actual output is

Bean #1
Bean #1
Bean #1
...
Bean #1
Bean #1

I think that the actual behaviour of the container is the most advisable
behaviour, but would be better to update the documentation to match it and
avoid misleading.

Thanks.

Giulio Quaresima (Ph.D) - Perugia - Italy

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

Reply via email to