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 2013/10/25 13:50:00 UTC

[Bug 55703] New: Error in the JNDI Generic JavaBean Resources documentation

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.quaresima@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 55703] Error in the JNDI Generic JavaBean Resources documentation

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55703

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
          Component|Documentation               |Documentation
         Resolution|---                         |FIXED
            Product|Tomcat 6                    |Tomcat 7
   Target Milestone|default                     |---

--- Comment #4 from Mark Thomas <ma...@apache.org> ---
JNDI how-to updated in 7.0.x for 7.0.48 onwards and 8.0.x for 8.0.0-RC6
onwards.

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

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


[Bug 55703] Error in the JNDI Generic JavaBean Resources documentation

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55703

Giulio Quaresima <gi...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|Documentation               |Documentation
            Product|Tomcat 7                    |Tomcat 6
   Target Milestone|---                         |default

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

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


[Bug 55703] Error in the JNDI Generic JavaBean Resources documentation

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55703

--- Comment #2 from Mark Thomas <ma...@apache.org> ---
This behavior is controlled by the singleton attribute of the factory. The
default is to create singleton resources as that is what users expect even
though the J2EE spec suggests that a new object should be created on each
lookup.

I'll go through the JNDI docs and expand any statements like the one you quote
below so that the full picture is available.

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

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


[Bug 55703] Error in the JNDI Generic JavaBean Resources documentation

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55703

--- Comment #3 from Giulio Quaresima <gi...@gmail.com> ---
OK, this is true for Tomcat 7 but it's not, as I can see, for the still
supported 6.x version.

Moreover, I think it would be better to mention the 'singleton' option also in
the documentation page I refer to, in order do avoid misunderstanding.

Thanks

(In reply to Mark Thomas from comment #2)
> This behavior is controlled by the singleton attribute of the factory. The
> default is to create singleton resources as that is what users expect even
> though the J2EE spec suggests that a new object should be created on each
> lookup.
> 
> I'll go through the JNDI docs and expand any statements like the one you
> quote below so that the full picture is available.

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

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


[Bug 55703] Error in the JNDI Generic JavaBean Resources documentation

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55703

--- Comment #1 from Giulio Quaresima <gi...@gmail.com> ---
Created attachment 30969
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30969&action=edit
server.xml and the test classes in maven format

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

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