[Beginners Corner] - Re: Look-up ejb class getInterfaces shows my home interface,
by MainLineDude
An addendum:
After posting, I tried creating a new bean and it worked fine. I had been noticing startup errors for InstanceAlreadyExistsException, so I wondered if I had been using a cached version of the original bean instead of the latest. So I edited my new bean by adding another method, redeployed it, and it now fails the same way.
So I'm thinking that my JSP is wanting to use one definition of my class, and JBoss is supplying a different version of it, thus the ClassCastException (I have a vague recollection that Java is smart enough to see that two classes that coincidentally have the same name can't be cast to one another).
So, if that is the case, how do I flush out the old bean definitions? (I already tried deleting everything in the server\default\tmp\deploy directory, but that didn't help)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3957928#3957928
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3957928
19 years, 9 months
[Beginners Corner] - Managed Connection Pools
by mastrivens
I am getting the 'NoManagedConnections' Exception this only happens after a while, but I confess I am confused by the JBoss documentation and the few examples of servlets working with JBoss don't seem to be much help.
I get a new connection object when I call the init method of each of my servlets (there are about 20), that is the only connection object I use for that servlet (I pass it as a parameter to the various factory classes I use within the servlet to do database access).
But if I understand correctly, there is only one instance of each servlet - so it shoud only be using one connection? So I should only be using the same number of connections as servlets?
Do I really need to close and create connections whenever I use JDBC?
Is there somewhere I can put a close command that wouldn't be too much rework? Or is there a timeout for spotting dead connections?
I already have a fairly large application and this would be painful to put it mildly... I thought that was the point of a managed connection pool? I have included the datasource XML file and also the code for getting a connection.
Thank-you in advance
Mark
I have project-ds.xml file to set-up a connection pool with Postgres:
| <datasources>
| <local-tx-datasource>
| <jndi-name>MtrdbDS</jndi-name>
| <connection-url>jdbc:postgresql://myserver:5434/myDb</connection-url>
| <driver-class>org.postgresql.Driver</driver-class>
| <user-name>someUser</user-name>
| <password>somepassword</password>
| <metadata>
| <type-mapping>PostgreSQL 8.0</type-mapping>
| </metadata>
| </local-tx-datasource>
|
I use a JNDI call to get a connection from that pool:
| public Connection getConnection() throws SQLException
| {
| Connection conn = null;
| Context ctx = null;
| DataSource ds = null;
| String sourceName = "";
|
| try
| {
| ctx = new InitialContext();
|
| if(ctx == null )
| throw new NamingException("Error 'Db.getConnection' - No Context");
|
| sourceName = this.getDbName(ctx);
|
| ds = (DataSource)ctx.lookup(sourceName);
| }
| catch (NamingException e)
| {
| MtrErr.writeExc(MtrErr.OTHER_SOURCE,this.getClass().toString(),"getConnection",e);
| }
| catch (Exception e)
| {
| MtrErr.writeExc(MtrErr.OTHER_SOURCE,this.getClass().toString(),"getConnection",e);
| }
|
| if (ds != null)
| {
| conn = ds.getConnection();
| }
|
| return(conn);
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3957921#3957921
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3957921
19 years, 9 months
[Installation, Configuration & Deployment] - Re: JBoss 3.2.5 fails startup with -Xmx1536m
by PeterJ
The Sun JVM attempts to allocate a contiguous section of memory from its available address space. Considering that on a 32-bit box you have only 2GB of available address per process, and that typical application stuff (code and whatnot) takes up low memory space and that the majority of the Windows DLLs take up high memory, you will end up with a significantly smaller amount of memory avaiulable for the heap. So you will have to decrease your heap size. I can't recall the maximum heap we have ever gotten out of Windows 2003, though 1.4 GB comes to mind.
Also, setting the /3GB boot option will not help because even with that option there is not enough contiguous memory available for the size of heap you want.
However, you could use a JVM that doesn't need contiguous memory space to allocate the heap, and such a JVM might be able to allocate a big heap even without the /3GB heap option. The Unisys JVM (available at http://ecommunity.unisys.com/ecommunity/templates/longdescription.aspx?Do..., requires free registration) does not require contiguous memory. If I recall correctly, we have gotten heaps of about 1.7GB without the /3GB boot option and around 2.7GB with the /3GB boot option. Of course, your mileage may vary.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3957919#3957919
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3957919
19 years, 9 months