This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!

S Guru

Greenhorn
+ Follow
since Jan 19, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by S Guru

I beleive I address the proper forum Java Forums/Servlet. I was asking about the HTTPServletRequest how to read the compressed request body. Its not a General java question. Its a Servlet question only
8 years ago
Thanks,

But I was trying to decompress(unzip) using the follwoing code. But it didnt even work out. I post the zipped xml file thought POST request.

final int BUFFER = 2048;
StringBuilder xmlData = new StringBuilder();
try{
ZipInputStream zis = new ZipInputStream(request.getInputStream());
ZipEntry entry;
while ((entry = zis.getNextEntry()) != null) {
System.out.println("Extracting: " + entry);
int count;
byte data[] = new byte[BUFFER];

while ((count = zis.read(data, 0, BUFFER)) != -1) {
xmlData.append(data);
}

}
}catch(Exception e)
{

}

The problem is, the code is not getting in to the while loop. I believe the ZipInputStream is not taking the request.getInputStream(). I tried to pass the zipped file like ,

FileInputStream fis = new FileInputStream(
"c:\\TEST\\unit_test2_zip.zip");
ZipInputStream zis = new ZipInputStream(
new BufferedInputStream(fis));

It was working good. Tried to put the same logic by request.getInputStream(). It failed. Should I need to do like identifying the compressed format and proceed? Any solution ?

Thanks,
SXP
8 years ago
Hi ,

Client is sending us the compressed format of request body message. How can I decompress it and read the file. If anyone has Servlet code for this please pass me.

Thanks,
sxp
8 years ago
Thanks for the reply. Actually I resolved the issue earlier by giving the service name as host:port/servicename in the URL. It started working good. Anyway thanks for the link. In our side we are advised to use servicename instead of sid. Our production support team are planning not to support sid for some reason.
Hi ,

In our application we are creating connection pool using context.xml. Everything works good if I give SID . If I change SID to service name..application raises exception. IS there any alternative to use Service name instead of SID in url?

Context.xml,

<Resource name="jdbc/Oracle-dev"
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
username="abc"
password="abc"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc: oracle:thin:@10.112.200.29:1521:STT41"
maxWait="2000"
removeAbandoned="true"
maxActive="20"
maxIdle="10"
initialSize="5"
testOnBorrow="true"
validationQuery="select 1 from dual"
removeAbandonedTimeout="60"
logAbandoned="true"/>


Exception , when I change SID(STT41) to servicename(devstt),

SQLException when creating connection. error msg:Cannot create PoolableConnectionFactory (Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
10.112.200.29:1521:devstt), error info:Cannot create PoolableConnectionFactory (Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
10.112.200.29:1521:devstt
)
Anyone please suggest how can I achive this following mapping in web.xml,

Sample call,
1.)city/abc/street/*
2.)city/abd/street/*
3.)city/*/street/*


Please note that abc & abd are just strings. Please help.

servlet>
<servlet-name>com.city.Street</servlet-name>
<servlet-class>com.city.Street</servlet-class>
<init-param>
<param-name>city.properties</param-name>
<param-value>/WEB-INF/conf/city.properties</param-value>
</init-param>

<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>com.city.Street</servlet-name>
<url-pattern>city/*/street/*</url-pattern>
</servlet-mapping>
8 years ago
Hi,

I'm sending JMS message from Tomcat to weblogic JMS server. Its wroking well. But when I try to shut down the Tocat server, the log shows the following message,

INFO: Stopping service Catalina
Jan 19, 2011 1:32:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [/MyApp] registered the JBDC driver [oracle.jdbc.OracleDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Jan 19, 2011 1:32:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/MyApp] appears to have started a thread named [Status] but has failed to stop it. This is very likely to create a memory leak.
Jan 19, 2011 1:32:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/MyApp] appears to have started a thread named [weblogic.timers.TimerThread] but has failed to stop it. This is very likely to create a memory leak.
Jan 19, 2011 1:32:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/MyApp] appears to have started a thread named [weblogic.transaction.TxTimer: '1'] but has failed to stop it. This is very likely to create a memory leak.
Jan 19, 2011 1:32:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/MyApp] appears to have started a thread named [ExecuteThread: '0' for queue: 'default'] but has failed to stop it. This is very likely to create a memory leak.
Jan 19, 2011 1:32:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/MyApp] appears to have started a thread named [ExecuteThread: '1' for queue: 'default'] but has failed to stop it. This is very likely to create a memory leak.
Jan 19, 2011 1:32:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/MyApp] appears to have started a thread named [ExecuteThread: '2' for queue: 'default'] but has failed to stop it. This is very likely to create a memory leak.
Jan 19, 2011 1:32:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/MyApp] appears to have started a thread named [ExecuteThread: '3' for queue: 'default'] but has failed to stop it. This is very likely to create a memory leak.
Jan 19, 2011 1:32:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/MyApp] appears to have started a thread named [ExecuteThread: '4' for queue: 'default'] but has failed to stop it. This is very likely to create a memory leak.
Jan 19, 2011 1:32:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/MyApp] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak.
Jan 19, 2011 1:32:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/MyApp] appears to have started a thread named [ExecuteThread: '0' for queue: 'JmsAsyncQueue'] but has failed to stop it. This is very likely to create a memory leak.
Jan 19, 2011 1:32:15 PM org.apache.coyote.http11.Http11AprProtocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080
Jan 19, 2011 1:32:15 PM org.apache.coyote.ajp.AjpAprProtocol destroy
INFO: Stopping Coyote AJP/1.3 on ajp-8009



Basically my applcation is sending JMS message to EJB messageDriven Bean deployed under weblogic. Currently I dont see any problem with my tomcat server. I'm worried abt the issue will create any problem in future. Any information will be helpful.

Thanks.