[Tomcat, HTTPD, Servlets & JSP] - Http post memory deallocation
by vitorisaia
Hello!
I have an upload application, wich consists in an applet that sends post requests to a servlet, through the Jakarta Commons HttpClient libs. The file is uploaded in packages, so I divide the file in 100 parts and send each part per httppost. So when I upload a file I do 100 posts, one per package. What happens is, for every post, the server memory (jboss 4.0.3SP1 - uses Tomcat 5) increases according to the post size. At the end of the process, the server do not deallocate that memory. So after I upload a few large files, I have an out of memory exception. I don't know how to deallocate that memory, actually should I? I think the server should know that memory is not used any more and then deallocate it. At the and of the doPost servlet's method, I placed a System.gc() but did not change anything. Any suggestions?
I did a preview search and didn't find anything about this issue...
Thanks a lot for any help.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3969531#3969531
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3969531
19 years, 7 months
[JBoss Messaging] - Re: Problem getting correct IP for CallbackServer
by clebert.suconic@jboss.com
I will fix this by getting the IP from serverLocator.
This way, we will get the same IP configured.
| protected Connector startCallbackServer(InvokerLocator serverLocator) throws Exception
| {
| if (log.isTraceEnabled()) { log.trace(this + " setting up connection to " + serverLocator); }
|
| final int MAX_RETRIES = 50;
| boolean completed = false;
| Connector server = null;
| String serializationType = null;
| int count = 0;
|
| String thisAddress = serverLocator.getHost();
|
| boolean isSSL = serverLocator.getProtocol().equals("sslsocket");
| Map params = serverLocator.getParameters();
|
| if (params != null)
| {
| serializationType = (String)params.get("serializationtype");
| }
|
| while (!completed && count < MAX_RETRIES)
| {
| try
| {
| int bindPort = PortUtil.findFreePort(thisAddress);
|
| String callbackServerURI;
|
| if (isSSL)
| {
| // See http://jira.jboss.com/jira/browse/JBREM-470
| callbackServerURI =
| "sslsocket://" + thisAddress + ":" + bindPort + CALLBACK_SERVER_PARAMS +
| "&" + SSLSocketBuilder.REMOTING_SERVER_SOCKET_USE_CLIENT_MODE + "=true";
| }
| else
| {
| callbackServerURI = serverLocator.getProtocol() + "://" + thisAddress +
| ":" + bindPort + CALLBACK_SERVER_PARAMS;
| }
|
| if (serializationType != null)
| {
| callbackServerURI += "&serializationType=" + serializationType;
| }
|
| InvokerLocator callbackServerLocator = new InvokerLocator(callbackServerURI);
|
| log.debug(this + " starting callback server " + callbackServerLocator.getLocatorURI());
|
| server = new Connector();
| server.setInvokerLocator(callbackServerLocator.getLocatorURI());
| server.create();
| server.addInvocationHandler(JMS_CALLBACK_SUBSYSTEM, new CallbackManager());
| server.start();
|
| if (log.isTraceEnabled()) { log.trace("callback server started"); }
|
| completed = true;
| }
| catch (Exception e)
| {
| log.warn("Failed to start connection. Will retry", e);
|
| // Intermittently we can fail to open a socket on the address since it's already in use
| // This is despite remoting having checked the port is free. This is probably because
| // of the small window between remoting checking the port is free and getting the
| // port number and actually opening the connection during which some one else can use
| // that port. Therefore we catch this and retry.
|
| count++;
|
| if (count == MAX_RETRIES)
| {
| final String msg = "Cannot start callbackserver after " + MAX_RETRIES + " retries";
| log.error(msg, e);
| throw new MessagingJMSException(msg, e);
| }
| }
| }
|
| return server;
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3969529#3969529
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3969529
19 years, 7 months
[EJB 3.0] - Help!!! Simple problem
by qwertyyy
Hi all!
I wrote a simple EJB 3 component:
in a separate files on EJB project:
| @javax.ejb.Local
| public interface TestSessionLocal {
| public String getTestString();
| }
| ..........
| @javax.ejb.Stateless
| public class TestSessionBean implements my.ejb.TestSessionLocal {
| public String getTestString(){
| return "Hello, world!";
| }
| }
|
|
and a simple code in the web application:
| ..........
| class MyServlet extends HttpServlet{
| @EJB
| public TestSessionLocal tsLocal;
| .........
|
I don't write any configuration files - how I understand, this don't requisite: they exists, but they is empty (e.g. ). Or that not right?
When procees method doRequest() in MySrevlet field tsLocal==null
When i run this application in Sun App Server - all works ok! And when i deploy this application in JBoss application server tsLocal field==null.
I use NetBeans 5.5 (Enterprise Application project)
Thank you.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3969528#3969528
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3969528
19 years, 7 months
[EJB 3.0] - New to EJB3 - OnetoOne not creating correct tables!!
by hanland
Hi,
I am using postgres JDBC driver: PostgreSQL Native Driver, version: PostgreSQL 8.1devel JDBC3 with SSL (build 400) and JBoss4.0.4GA.
Working through the Mastering EJB3 book from Wiley I came to Java persistence and the first example @Onetoone relationships. having copied the example from the book I get two tables auto generated on deployment but instead of a foriegn key mapping I get the second entity "shipment" embedded in the first as a bytea. The tables generated and the POJOs entities are given below.
When persisting the first entity I indeed get the second entities data embedded in the first and the second entity table is empty!!
It must be something pretty simple!
CREATE TABLE order1to1
| (
| id int4 NOT NULL,
| ordername varchar(255),
| shipment bytea,
| CONSTRAINT order1to1_pkey PRIMARY KEY (id)
| )
|
| CREATE TABLE shipment1to1
| (
| id int4 NOT NULL,
| city varchar(255),
| zipcode varchar(255),
| CONSTRAINT shipment1to1_pkey PRIMARY KEY (id)
| )
|
the java is as follows ..
package uk.hsoft;
|
| import java.io.Serializable;
|
| import javax.persistence.CascadeType;
| import javax.persistence.Entity;
| import javax.persistence.Id;
| import javax.persistence.OneToOne;
|
| @Entity(name = "Order1to1")
| public class OneToOneUni implements Serializable {
|
| /**
| *
| */
| private static final long serialVersionUID = -8964029485294348182L;
|
| @Id
| private int id;
|
| private String orderName;
|
| private Shipment shipment;
|
| public OneToOneUni() {
| super();
| id = (int) System.nanoTime();
| }
|
| public String getOrderName() {
| return orderName;
| }
|
| public void setOrderName(String orderName) {
| this.orderName = orderName;
| }
|
| @OneToOne(cascade = { CascadeType.PERSIST })
| public Shipment getShipment() {
| return shipment;
| }
|
| public void setShipment(Shipment shipment) {
| this.shipment = shipment;
| }
|
| public int getId() {
| return id;
| }
| }
| package uk.hsoft;
|
| import java.io.Serializable;
|
| import javax.persistence.Entity;
| import javax.persistence.Id;
|
| @Entity(name="Shipment1to1")
|
| public class Shipment implements Serializable {
|
| @Id
| private int id;
| private String city;
| private String zipCode;
|
| public Shipment() {
| super();
| id = (int)System.nanoTime();
| }
|
| /**
| *
| */
| private static final long serialVersionUID = -2447771500427072057L;
|
| public int getId() {
| return id;
| }
|
| public String getZipCode() {
| return zipCode;
| }
|
| public void setZipCode(String zipCode) {
| this.zipCode = zipCode;
| }
|
| public void setCity(String city) {
| this.city = city;
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3969524#3969524
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3969524
19 years, 7 months