Can we use threads in servlets
Hi,
can we use threads in servlets.
cheers
Sen
You can also use java.io.Serializable at the end of you class
eg:
public class MyClass implements java.io.Serializable{
Similar Messages
-
Can I use data from Servlet in my static html page?
First of all, I can NOT use jsp because of web server's restriction.
I have a servlet which will give me some image links in html file via doGET and doPOST method. I also need the sizes of the images and compress the images if too large.
My question is how I can pass the image sizes to the html page and how I can use them in html files.
Please advise me some solutions to this problem.Yeah, you have 2 choices:
1) Change your web server to one that allows JSP.
2) Re-build the JSP system from scratch so that the one you make will work in your server. This would involve changing your so called static HTML to have markings (like <% %> tags) where you should insert the values you need to insert. You would then have a servlet that reads the 'static' HTML, parses our the insertion tags, and inserts the values. It would then stream the results back to the user.
Of course, your HTML is not really static, it is dynamic because the values you are inserting are capable of changing.
If you don't want to upgrade the server to one that supports JSPs (if yours really doesn't), the have fun making your own system. -
Can we use threads in Clusters?
Hi,
My application is previously running on Iplanet4 webserver. We are migrating it to weblogic application server for reducing load on the application. We want to utilise the weblogic clustering concept for load balancing.
Now when we deploy our application in weblogic we are getting below warning...
<Web application: ServletContext(id=13686851,name=CCTS3_5May,context-path=/CCTS3_5May)
tried to place a non-serializable attribute: ccsession into the session: C61wF726pZpozohwzPefgQaX7yaXXHOJY7S9XufjU3tWmvA09z6o!789533662!1115354608350. This attribute will be lost upon redeployment. This message is logged only once per session.>
That is coming because one thread object is there in the CCSession class. When we are trying to serialize the object of that CCSession class we are getting warning of the above.
And i had seen in one of the forums that "when threads are there in any web application, it is impossible to use clustering"? Is any other way is there for migrating my application to weblogic server and use the clustering concept.
We are using weblogic especially for clustering concept only.
Is there any solution for this problem?
Please share your suggestions,
Thanks in advance,
Chandra Sekhar.Hi
You can use objects that extents java.io.Serializable class ...
Jin -
How can i use my helloworld servlet in apache-tomcat-mod_jk?
hi
i copied
helloworld.java helloworld.class
to
jakarta-tomcat-3.3.1/webapps/examples/WEB-INF/classes
i can use example servlets in that directory by accessing localhost/examples/servlets
and click links..(but if i type them in browser address bar, they dont' work either)
what setting am i missing?
thank youi didn't touch web.xml server.xml at all..
i got this with logs files
/usr/local/apache/logs/error_log
[Thu Jul 25 14:14:00 2002] [notice] Apache/1.3.26 (Unix) PHP/4.1.2 mod_jk/1.1.0 configured -- resuming normal operations
[Thu Jul 25 14:14:00 2002] [notice] Accept mutex: sysvsem (Default: sysvsem)
[Thu Jul 25 14:19:19 2002] [notice] caught SIGTERM, shutting down
[root@beautifulmind logs]#
[root@beautifulmind logs]# cat mod_jk.log
how does the link to jsp/servelt works and, not direct typing at address bar?
mod_jk.conf
<IfModule !mod_jk.c>
LoadModule jk_module libexec/mod_jk.so
</IfModule>
JkWorkersFile "/usr/local/jakarta-tomcat-3.3.1/conf/jk/workers.properties"
JkLogFile "/usr/local/jakarta-tomcat-3.3.1/logs/mod_jk.log"
JkLogLevel emerg
<Directory "/usr/local/jakarta-tomcat-3.3.1/webapps/examples">
Options Indexes FollowSymLinks
</Directory>
JkMount /admin ajp13
JkMount /admin/* ajp13
JkMount /examples ajp13
JkMount /examples/* ajp13
#added by eugene
JkMount /examples/servlet/* ajp13
#added by eugene
httpd.conf
Include /usr/local/jakarta-tomcat-3.3.1/conf/auto/mod_jk.con -
How can i upload a image file to server by using jsp or servlet.
Hi,
I m gurumoorthy. how can i upload a image file to server by using jsp or servlet without using third party API. pls anyone send me atleast outline of the source code.
Pls send me anyone.
Regards,
Gurumoorthy.I'm not an applet programmer so I can't give you much advice there.
If you want to stream the file from the server before it's entirely uploaded, then I don't believe you can treat it like a normal file. If you're just wanting to throw it up there and then listen to it, then you can treat it like a normal file.
But again, I'm not entirely certain. You might be able to stream the start of the file from the server while you're still uploading the end of it, but it probably depends on what method you're using to do the transfer. -
How can i Use SERVLET with RMI to avoid trust certificate
I know that for begining RMI, you must launch the server and the client.
for the server i use :
java -Djavax.net.ssl.trustStore=server.keystore -Djavax.net.ssl.keyStore=server.keystore -Djavax.net.ssl.keyStorePassword=server TestServer
for the client I use :
java -Djavax.net.ssl.trustStore=client.keystore -Djavax.net.ssl.keyStore=client.keystore -Djavax.net.ssl.keyStorePassword=client TestClient
and all work fine.
but i want to use a servlet for rmi client and i wrote this:
public class AppelServlet extends HttpServlet
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
try
System.out.println("Registering secure RMI socket factory ...");
java.rmi.server.RMISocketFactory.setSocketFactory(new SecureRMISocketFactory());
TestRemote test = (TestRemote) Naming.lookup("rmi://127.0.0.1:7123/TestClient");
String reponse=test.toLowerCase("HELLO WORLD");
System.out.println("la reponse est : "+reponse);
catch (Exception e)
System.out.println("test client exception: " +e);
PrintWriter out = response.getWriter();
response.setContentType("text/html");
and i have the following error on tomcat:
Registering secure RMI socket factory ...
test client exception: java.rmi.ConnectIOException: error during JRMP connection
establishment; nested exception is:
javax.net.ssl.SSLHandshakeException: Couldn't find trusted certificate
i think i must precise how to indicate the truststore like in the first case.
help me please.
hamdiHi,
Try doing the following steps.
Assuming you have a certificate obtained
Export the certificate into a .cer file.
On IE, goto tools->internet options->content->certificates, and export to a .cer file.
Using keytool of java import the certificate to the store that can be used doing the following command.
keytool -import -alias <ailas> -file < .cer filename> -keystore <storename here>
set the javax.net.ssl.trustStore and javax.net.ssl.trustStorePassword properties at the command prompt using the command below.
java -Djavax.net.ssl.trustStore=<storename> -Djavax.net.ssl.trustStorePassword=<password> <classname>
Let me know if this helped.
Also take a look at this link for using RMI with SSL
http://java.sun.com/products/jdk/1.2/docs/guide/rmi/SSLInfo.html
Regards,
Roopasri Vittal
Developer Technical Support
Sun Microsystems
http://sun.com/developers/support -
How can i upload files in servlets and also using jsp
means that uploading files(.doc) or any files by using servlets and jsps
yawmark wrote:
saichand wrote:
means that uploading files(.doc) or any files by using servlets and jsps
[http://www.google.com/search?q=How+can+i+upload+files+in+servlets+and+also+using+jsp]
~Good topic titles are indeed brilliant search keywords. It's sad to see that it won't even come in the mind of the topicstarters to Google it before posting the topic. -
Can I use XSQL pages & XSQL Servlet for oracle 7.3 ?
Can I use XSQL pages & XSQL Servlet
for oracle 7.3 or not?,if it is possible
please give me reply.
Thanks.
Ramesh Nallapu.Can I use XSQL pages & XSQL Servlet
for oracle 7.3 or not?,if it is possible
please give me reply.
Thanks.
Ramesh Nallapu.
null -
How can I get System dates with time scheduler using threads
how can I get System dates with time scheduler using threads.is there any idea to update Date in my application along with system Date automatic updation...
What the heck are you talking about and whatr has it to do with threads?
Current time: System.currentTimeMillis. Date instances are not supposed to be updated. -
Can I use servlet as my welcome file
How can I use servlet as my welcome file? I know how to use jsp or html pages as my welcome file but that doesn't work for servlets. I modified my web.xml for making jsps and html as my welcome pages but that <welcome-file-list> tag is not working for servlets.
This was a bug that occured in older Tomcat programs, not sure if it still occurs or not.
Basically, when this happens, you have to have a physical file with the welcome file name. So you would have to create a file named index.do in each of your directories you wanted the welcome to work for. The index.do wouldn't have to actually do anything. It just had to exist. Then when the URL was used to create content, the servlet would be called to create that content. -
BufferedWriter can use threaded i/o?
Dear all,
I read BufferedWriter.java from java source code, and found that it is not using thread to flushBuffer. I am wondering if we use thread to write out buffer when buffer is full, whether it will improve the write performance? -- That is, when the buffer size > nChars (the capacity of the buffer), we just use another thread to write out this buffer.
Is it possible to do so? How this can be implemented? Since I need to write out a very large file, but requires the processing time to be minimized.
void flushBuffer() throws IOException {
ensureOpen();
if (nextChar == 0) return;
out.write(cb, 0, nextChar);
nextChar = 0;
public void write(int c) throws IOException {
ensureOpen();
if (nextChar >= nChars)
flushBuffer();
cb[nextChar++] = (char) c;
}Thanks!No doubt it could be done, although there's obviously
no flag to tell the existing BufferedWriters to do it.
You would have to write your own version. One thread
writing full buffers, another one creating new buffers
and filling them. Could be an interesting project.
Would also be interesting to find out whether that
shortened the total time required to write the file at
all.Thanks DrClap, I think I only need to modify the flushBuffer() method in BufferedWriter code, since all other write() method will call this method when the
buffer is full. In flushBuffer(), first set nextChar = 0; then just create a thread for io output, such as:
new WriterThread(buffer); // inner class
// in constructor call run()
and in thread run method, do actually write:
public void run() {
if (buffer.length == 0) return;
ensureOpen(); // ensure the writer is open
out.write(buffer, 0, buffer.length ); // write out buffer
}Is this ok?
Thanks! -
How can I use the same thread to display time in both JPanel & status bar
Hi everyone!
I'd like to ask for some assistance regarding the use of threads. I currently have an application that displays the current time, date & day on three separate JLabels on a JPanel by means of a thread class that I created and it's working fine.
I wonder how would I be able to use the same thread in displaying the current time, date & day in the status bar of my JFrame. I'd like to be able to display the date & time in the JPanel and JFrame synchronously. I am developing my application in Netbeans 4.1 so I was able to add a status bar in just a few clicks and codes.
I hope somebody would be able to help me on this one. A simple sample code would be greatly appreciated.
Thanks in advance!As you're using Swing, using threads directly just for this kind of purpose would be silly. You might as well use javax.swing.Timer, which has done a lot of the work for you already.
You would do it something like this...
ActionListener timerUpdater = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
// DateFormat would be better, but this is an example.
String timeString = new Date().toString();
statusBar.setText(timeString);
someOtherLabel.setText(timeString);
new Timer(1000, timerUpdater).start();That code will update the time once a second. If you aren't going to display seconds, you might as well increase the delay.
The advantage of using a timer over using an explicit thread, is that multiple Swing timers will share a single thread. This way you don't blow out your thread count. :-) -
How can I use a 3rd party XML parser such as xerces with OC4J ?
Hi all tech experts,
I am using Oracle Application Server 10g Release 2 (10.1.2) and i have
installed Portal and Wireless and OracleAS Infrastructure on the same
computer.
i tried all the solutions on this thread
Use of Xerces Parser in out application with Oracle App Server 9.0.4
but still fighting.
I have also posted this query on OTN on following thread
How can I use a 3rd party XML parser such as xerces with OC4J?
but no reply....
Please help me on this issue.
Since OC4J is preconfigured to use the Oracle XML parser which is xmlparserv2.jar.
i have read the following article which states that
OC4J is preconfigured to use the Oracle XML parser. The Oracle XML parser is fully JAXP 1.1 compatible and will serve the needs of applications which require JAXP functionality. This approach does not require the download, installation, and configuration of additional XML parsers.
The Oracle XML parser (xmlparserv2.jar) is configured to load as a system level library of OC4J through it's inclusion as an entry in the Class-Path entry of the oc4j.jar Manifest.mf file. This results in the Oracle XML parser being used for all common deployment and packaging situations. You are not permitted to modify the Manifest.mf file of oc4j.jar.
It must be noted that configuring OC4J to run with any additional XML parser or JDBC library is not a supported configuration. We do know customers who have managed to successfully replace the system level XML parser and the Oracle JDBC drivers that ship with the product, but we do not support this type of configuration due to the possibility of unexpected system behavior and system errors that might occur from replacing the tested and certified libraries.
If you absolutely must use an additional XML parser such as xerces, then you have to start OC4J such that the xerces.jar file is loaded at a level above the OC4J system classpath. This can be accomplished using the -Xbootclasspath flag of the JRE.
i have also run the following command
java -Xbootclasspath/a:d:\xerces\xerces.jar -jar oc4j.jar
but no success.
How could i utilize my jar's like xerces.jar and xalan.jar for parsing instead of OC4J in-built parser ?
All reply will be highly appreciated.
Thnx in advance to all.
Neeraj Sidhaye
try_catch_finally @ Y !Hi Neeraj Sidhaye,
I am trying to deploy a sample xform application to the Oracle Application Server (10.1.3). However, I encountered the class loader issue that is similar to your stuation. I tried all the three solutions but the application is still use the Oracle xml paser class. I am wondering if you have any insight about this?
Thanks for your help.
Xingsheng Qian
iPass Inc.
Here is the error message I got.
Message:
java.lang.ClassCastException: oracle.xml.parser.v2.XMLElement
Stack Trace:
org.chiba.xml.xforms.exception.XFormsException: java.lang.ClassCastException: oracle.xml.parser.v2.XMLElement
at org.chiba.xml.xforms.Container.dispatch(Unknown Source)
at org.chiba.xml.xforms.Container.dispatch(Unknown Source)
at org.chiba.xml.xforms.Container.initModels(Unknown Source)
at org.chiba.xml.xforms.Container.init(Unknown Source)
at org.chiba.xml.xforms.ChibaBean.init(Unknown Source)
at org.chiba.adapter.servlet.ServletAdapter.init(ServletAdapter.java:153)
at org.chiba.adapter.servlet.ChibaServlet.doGet(ChibaServlet.java:303)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:719)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376)
at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:299)
at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:187)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.ClassCastException: oracle.xml.parser.v2.XMLElement
at org.chiba.xml.xforms.Instance.iterateModelItems(Unknown Source)
at org.chiba.xml.xforms.Bind.initializeModelItems(Unknown Source)
at org.chiba.xml.xforms.Bind.init(Unknown Source)
at org.chiba.xml.xforms.Initializer.initializeBindElements(Unknown Source)
at org.chiba.xml.xforms.Model.modelConstruct(Unknown Source)
at org.chiba.xml.xforms.Model.performDefault(Unknown Source)
at org.chiba.xml.xforms.XFormsDocument.performDefault(Unknown Source)
at org.chiba.xml.xforms.XFormsDocument.dispatchEvent(Unknown Source)
at org.apache.xerces.dom.NodeImpl.dispatchEvent(Unknown Source)
... 18 more -
How can I know whether the Servlet is sending a response!!!
Hello,
My question is this :
How do I know whether that server outputstream is sending me a response or not?
I have opened the Client InputStream to recieve a response from a servlet,but how
can i be sure that i will receive a response from the servlet?
I cud be waiting for an 15 expecting a response but havent received one..
Is there any way to check whether the servlet is sending me a response?
The reason I am asking is this.
I have written a Java Client that connects to a servlet.It has to wait for a
response from the servlet.It will wait for 5 seconds and if this doesnt recieve
a response,it will return back else it will display the response.
I have set a timer on my client for 5 seconds and a timer on the servlet for 15 seconds.
Essentially,when the client connects,the servlet response is held for 15 seconds
and the client tries for 5 seconds.
But the client is unable to exit without a response.The response comes back in 15 seconds.
The client shud have the message 'Connection Timed Out' after 5 seconds.
This means there is an error somewhere.
As the response takes 15 seconds,the client shudnt recieve one.
So,is there a way I can block the servlet response?
I am using threads and Inner classes for the timer purposes..
Please can any one help me?
ajay
Client code:
public class HttpHandler {
private static String sURL="localhost";
static String sMessage="Hello Server..Client sending Data";
static DataInputStream dis = null;
static HttpURLConnection hpCon=null;
public static void main(String[] args)
sendData(sMessage);
public void TimerTest() {
NewThread nt = new NewThread();
public static void sendData(String sMess)
String response=null;
try{
// Invoke Timer
new HttpHandler.TimerTest();
URL url=null;
String uri = "http://" + sURL + ":8080/servlet/threads.Recieve_Http_Data1";
url = new URL(uri);
hpCon=null;
hpCon = (HttpURLConnection)url.openConnection();
hpCon.setDoOutput(true);
hpCon.setDoInput(true);
// Transfer Data over http
DataOutputStream dos = new DataOutputStream(hpCon.getOutputStream());
dos.writeUTF(sMess);
}catch(IOException e)
{System.out.println("Error in Client " + e); e.printStackTrace();}
} // End of Method sendData
// Inner Class
class NewThread extends Thread
String response;
int i=0;
NewThread()
start();
public void run()
try {
while(i < 5)
System.out.println(i);
Thread.sleep(1000);
try {
dis = new DataInputStream(hpCon.getInputStream());
response = dis.readUTF();
// If response recieved, break off else Loop back.
if(dis !=null)
System.out.println("SERVER RESPONSE : " + response);
dis.close();
break;
}catch(IOException e){System.out.println("Here : " + e);}
i++;
} // End of While.
}catch(InterruptedException e){}
The Servlet
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.io.*;
import java.sql.*;
import java.math.*;
public class Recieve_Http_Data1 extends HttpServlet {
private static final String CONTENT_TYPE = "text/html";
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
doPost(request,response);
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
System.out.println("Server Ready to receive Message from application :");
System.out.println();
BufferedReader br=null;
// Data Read by the Servlet
String sMess="";
DataInputStream dis = new DataInputStream(request.getInputStream());
sMess = dis.readUTF();
System.out.println("Received from Client: " + sMess);
// Send response back after 15 seconds Only.
try {
for(int i=0;i<15;i++)
System.out.println(i);
DataOutputStream dos = new DataOutputStream(response.getOutputStream());
String sResponse = "Hello Client...This is server sending response";
dos.writeUTF(sResponse);
Thread.sleep(1000);
}catch(InterruptedException e){}I don't know whether you solve your problem or not! Anyway, I have the same problem. The program hangs when getInputStream is called.
DataInputStream dis = new DataInputStream(request.getInputStream());
If you have the answer, please let me know. Thanks!! -
How can WLS use JSP pages in a Web Application (either a .war file or a war directory structure) without a java compiler?
I suspect either the JSP specification is flawed (i.e. it doesn't take account of servers using just a JRE), or BEA's implementation is broken.
Production servers do not have a JDK installed. They only have a JRE. Therfore a java compiler is not present on the machine that the Web Application is deployed onto.
On the development machine, when the server is requested to load the JSP it creates a tmpwar directory within the Web Application directory structure. This is then included in the resultant .war file thus:
D:\war>jar -tf gmi.war
META-INF/
META-INF/MANIFEST.MF
gmiService.jsp
WEB-INF/
WEB-INF/classes/
WEB-INF/classes/com/
WEB-INF/classes/com/bt/
WEB-INF/classes/com/bt/gmi/
WEB-INF/classes/com/bt/gmi/gmiService.class
WEB-INF/getList.xsl
WEB-INF/getListByConnection.xsl
WEB-INF/getListByDistrict.xsl
WEB-INF/getListByDistrictConnection.xsl
WEB-INF/lib/
WEB-INF/source/
WEB-INF/source/build.bat
WEB-INF/source/gmiService.java
WEB-INF/web.xml
WEB-INF/weblogic.xml
tmpwar/
tmpwar/jsp_servlet/
tmpwar/jsp_servlet/_gmiservice.class
tmpwar/jsp_servlet/_gmiservice.java
When deployed on the production server with the web.xml file set to use the following values (note XML stripped):
weblogic.jsp.pageCheckSeconds
-1
weblogic.jsp.precompile
false
weblogic.jsp.compileCommand
javac
weblogic.jsp.verbose
true
weblogic.jsp.packagePrefix
jsp_servlet
weblogic.jsp.keepgenerated
false
And in the weblogic.properties file:
weblogic.httpd.webApp.gmi=war/gmi
I've also tried with the .war file, but that insists on creating another tmpwar directory outside of the .war file.
Then, although I have set pageCheckSeconds to -1 (don't check and don't recompile) ter production server still attempts to recompile the JSP's:
Mon Sep 25 11:40:11 BST 2000:<I> <WebAppServletContext-gmi> *.jsp: init
Mon Sep 25 11:40:11 BST 2000:<I> <WebAppServletContext-gmi> *.jsp: param verbose initialized to: true
Mon Sep 25 11:40:11 BST 2000:<I> <WebAppServletContext-gmi> *.jsp: param packagePrefix initialized to: jsp_servlet
Mon Sep 25 11:40:11 BST 2000:<I> <WebAppServletContext-gmi> *.jsp: param compileCommand initialized to: javac
Mon Sep 25 11:40:11 BST 2000:<I> <WebAppServletContext-gmi> *.jsp: param srcCompiler initialized to weblogic.jspc
Mon Sep 25 11:40:11 BST 2000:<I> <WebAppServletContext-gmi> *.jsp: param superclass initialized to null
Mon Sep 25 11:40:11 BST 2000:<I> <WebAppServletContext-gmi> *.jsp: param workingDir initialized to: /opt/wls-servers/gmiServer/weblogic/war/gmi/_tmp_war
Mon Sep 25 11:40:11 BST 2000:<I> <WebAppServletContext-gmi> *.jsp: param pageCheckSeconds initialized to: -1
Mon Sep 25 11:40:11 BST 2000:<I> <WebAppServletContext-gmi> *.jsp: initialization complete
Mon Sep 25 11:40:12 BST 2000:<I> <WebAppServletContext-gmi> Generated java file: /opt/wls-servers/gmiServer/weblogic/war/gmi/_tmp_war/jsp_servlet/gmiService.java
Mon Sep 25 11:40:14 BST 2000:<E> <WebAppServletContext-gmi> Compilation of /opt/wls-servers/gmiServer/weblogic/war/gmi/_tmp_war/jsp_servlet/gmiService.java failed: Exception in thread "main" java.lang.NoClassDefFoundError: sun/tools/javac/Main
java.io.IOException: Compiler failed executable.exec([Ljava.lang.String;[javac, -classpath, /opt/Solaris_JRE_1.2.1_04/lib/rt.jar:/opt/Solaris_JRE_1.2.1_04/lib/i18n.jar:/opt/Solaris_JRE_1.2.1_04/classes:/var/wls/5.1/weblogic/lib/weblogic510sp4boot.jar:/var/wls/5.1/weblogic/classes/boot:/var/wls/5.1/weblogic/eval/cloudscape/lib/cloudscape.jar:/var/wls/5.1/weblogic/lib/wleorb.jar:/var/wls/5.1/weblogic/lib/wlepool.jar:/var/wls/5.1/weblogic/lib/weblogic510sp4.jar:/var/wls/5.1/weblogic/license:/var/wls/5.1/weblogic/classes:/var/wls/5.1/weblogic/lib/weblogicaux.jar:/opt/wls-servers/gmiServer/weblogic/gmiServer/serverclasses:/opt/wls-servers/gmiServer/weblogic/lotusxsl.jar:/opt/wls-servers/gmiServer/weblogic/xerces.jar:/opt/wls-servers/gmiServer/weblogic/logging.jar::/opt/wls-servers/gmiServer/weblogic/war/gmi/WEB-INF/classes:/opt/wls-servers/gmiServer/weblogic/war/gmi/_tmp_war, -d, /opt/wls-servers/gmiServer/weblogic/war/gmi/_tmp_war, /opt/wls-servers/gmiServer/weblogic/war/gmi/_tmp_war/jsp_servlet/gmiService.java])
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.io.IOException.<init>(Compiled Code)
at weblogic.utils.compiler.CompilerInvoker.compileMaybeExit(Compiled Code)
at weblogic.utils.compiler.CompilerInvoker.compile(CompilerInvoker.java:200)
at weblogic.servlet.jsp.JspStub.compilePage(Compiled Code)
at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:173)
at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:187)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:118)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:142)
at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:744)
at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:692)
at weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContextManager.java:251)
at weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:363)
at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:263)
at weblogic.kernel.ExecuteThread.run(Compiled Code)
The default Java compiler from sun lives in the tools.jar that comes with
the JDK. Just add that to your set of JARs which are deployed in production
and you should be fine. No need to install the full JDK - just make the
tools.jar available to WebLogic.
Regards
James
James Strachan
=============
email: [email protected]
web: http://www.metastuff.com
"Martin Webb" <[email protected]> wrote in message
news:[email protected]...
>
> How can WLS use JSP pages in a Web Application (either a .war file or a
war directory structure) without a java compiler?
>
> I suspect either the JSP specification is flawed (i.e. it doesn't take
account of servers using just a JRE), or BEA's implementation is broken.
>
> Production servers do not have a JDK installed. They only have a JRE.
Therfore a java compiler is not present on the machine that the Web
Application is deployed onto.
>
> On the development machine, when the server is requested to load the JSP
it creates a tmpwar directory within the Web Application directory
structure. This is then included in the resultant .war file thus:
>
> D:\war>jar -tf gmi.war
> META-INF/
> META-INF/MANIFEST.MF
> gmiService.jsp
> WEB-INF/
> WEB-INF/classes/
> WEB-INF/classes/com/
> WEB-INF/classes/com/bt/
> WEB-INF/classes/com/bt/gmi/
> WEB-INF/classes/com/bt/gmi/gmiService.class
> WEB-INF/getList.xsl
> WEB-INF/getListByConnection.xsl
> WEB-INF/getListByDistrict.xsl
> WEB-INF/getListByDistrictConnection.xsl
> WEB-INF/lib/
> WEB-INF/source/
> WEB-INF/source/build.bat
> WEB-INF/source/gmiService.java
> WEB-INF/web.xml
> WEB-INF/weblogic.xml
> tmpwar/
> tmpwar/jsp_servlet/
> tmpwar/jsp_servlet/_gmiservice.class
> tmpwar/jsp_servlet/_gmiservice.java
>
> When deployed on the production server with the web.xml file set to use
the following values (note XML stripped):
>
> weblogic.jsp.pageCheckSeconds
> -1
>
> weblogic.jsp.precompile
> false
>
> weblogic.jsp.compileCommand
> javac
>
> weblogic.jsp.verbose
> true
>
> weblogic.jsp.packagePrefix
> jsp_servlet
>
> weblogic.jsp.keepgenerated
> false
>
>
> And in the weblogic.properties file:
>
> weblogic.httpd.webApp.gmi=war/gmi
>
> I've also tried with the .war file, but that insists on creating another
tmpwar directory outside of the .war file.
>
>
> Then, although I have set pageCheckSeconds to -1 (don't check and don't
recompile) ter production server still attempts to recompile the JSP's:
>
>
> Mon Sep 25 11:40:11 BST 2000:<I> <WebAppServletContext-gmi> *.jsp: init
> Mon Sep 25 11:40:11 BST 2000:<I> <WebAppServletContext-gmi> *.jsp: param
verbose initialized to: true
> Mon Sep 25 11:40:11 BST 2000:<I> <WebAppServletContext-gmi> *.jsp: param
packagePrefix initialized to: jsp_servlet
> Mon Sep 25 11:40:11 BST 2000:<I> <WebAppServletContext-gmi> *.jsp: param
compileCommand initialized to: javac
> Mon Sep 25 11:40:11 BST 2000:<I> <WebAppServletContext-gmi> *.jsp: param
srcCompiler initialized to weblogic.jspc
> Mon Sep 25 11:40:11 BST 2000:<I> <WebAppServletContext-gmi> *.jsp: param
superclass initialized to null
> Mon Sep 25 11:40:11 BST 2000:<I> <WebAppServletContext-gmi> *.jsp: param
workingDir initialized to:
/opt/wls-servers/gmiServer/weblogic/war/gmi/_tmp_war
> Mon Sep 25 11:40:11 BST 2000:<I> <WebAppServletContext-gmi> *.jsp: param
pageCheckSeconds initialized to: -1
> Mon Sep 25 11:40:11 BST 2000:<I> <WebAppServletContext-gmi> *.jsp:
initialization complete
> Mon Sep 25 11:40:12 BST 2000:<I> <WebAppServletContext-gmi> Generated java
file:
/opt/wls-servers/gmiServer/weblogic/war/gmi/_tmp_war/jsp_servlet/gmiService.
java
> Mon Sep 25 11:40:14 BST 2000:<E> <WebAppServletContext-gmi> Compilation of
/opt/wls-servers/gmiServer/weblogic/war/gmi/_tmp_war/jsp_servlet/gmiService.
java failed: Exception in thread "main" java.lang.NoClassDefFoundError:
sun/tools/javac/Main
>
> java.io.IOException: Compiler failed
executable.exec([Ljava.lang.String;[javac, -classpath,
/opt/Solaris_JRE_1.2.1_04/lib/rt.jar:/opt/Solaris_JRE_1.2.1_04/lib/i18n.jar:
/opt/Solaris_JRE_1.2.1_04/classes:/var/wls/5.1/weblogic/lib/weblogic510sp4bo
ot.jar:/var/wls/5.1/weblogic/classes/boot:/var/wls/5.1/weblogic/eval/cloudsc
ape/lib/cloudscape.jar:/var/wls/5.1/weblogic/lib/wleorb.jar:/var/wls/5.1/web
logic/lib/wlepool.jar:/var/wls/5.1/weblogic/lib/weblogic510sp4.jar:/var/wls/
5.1/weblogic/license:/var/wls/5.1/weblogic/classes:/var/wls/5.1/weblogic/lib
/weblogicaux.jar:/opt/wls-servers/gmiServer/weblogic/gmiServer/serverclasses
:/opt/wls-servers/gmiServer/weblogic/lotusxsl.jar:/opt/wls-servers/gmiServer
/weblogic/xerces.jar:/opt/wls-servers/gmiServer/weblogic/logging.jar::/opt/w
ls-servers/gmiServer/weblogic/war/gmi/WEB-INF/classes:/opt/wls-servers/gmiSe
rver/weblogic/war/gmi/_tmp_war, -d,
/opt/wls-servers/gmiServer/weblogic/war/gmi/_tmp_war,
/opt/wls-servers/gmiServer/weblogic/war/gmi/_tmp_war/jsp_servlet/gmiService.
java])
> at java.lang.Throwable.fillInStackTrace(Native Method)
> at java.lang.Throwable.fillInStackTrace(Compiled Code)
> at java.lang.Throwable.<init>(Compiled Code)
> at java.lang.Exception.<init>(Compiled Code)
> at java.io.IOException.<init>(Compiled Code)
> at
weblogic.utils.compiler.CompilerInvoker.compileMaybeExit(Compiled Code)
> at
weblogic.utils.compiler.CompilerInvoker.compile(CompilerInvoker.java:200)
> at weblogic.servlet.jsp.JspStub.compilePage(Compiled Code)
> at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:173)
> at
weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:18
7)
> at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:118)
> at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:142)
> at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
l.java:744)
> at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
l.java:692)
> at
weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
Manager.java:251)
> at
weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:363)
> at
weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:263)
> at weblogic.kernel.ExecuteThread.run(Compiled Code)
>
>
>
Maybe you are looking for
-
How do I connect an older imac to my new imac to use as a second monitor?
Hi ! I was wondering if it were possible to connect an older imac to my new imac to use as a second monitor? My older imac is from 2006. The new one is a 2012 imac. Any advice would be appreciated. Thanks, JC
-
How to activate a custom datasource of a view
Hello folks, I'm working on BI 7.0 and ECC 6.0. I've created a z datasource on a view. It appears in RSA6. It is not visible in RSA5 which means I cannot activate it. When I replicate the datasource in BW, it appears as a modified version and not as
-
Hi please help , Certain updates were been installed and then a restart was done to install the updates successfully in my MAc Book PRO .After restarting the sytem, the system displayed a message for a restart and it happened three times.Every tim
-
Many invalid objects found after new install the R12 vision demo (12.1.1)
In AIX Server, I found many invalid objects after new install the R12 vision demo (12.1.1) with DB v11.1.0.7, can I drop the following invalid objects then upgrade to R12.1.3 ? OWNER OBJECT_NAME OBJECT_TYPE STATUS APPS XLA_00707_AAD_C_000026_PKG PACK
-
Query about slamd config and load test dsee7?
Hey Guys I am configuring slamd on a VM to do some load testing on DSEE Now i edited the slamd_client.conf and edited AUTO_CREATE_CLIENTS=5 MAX_CLIENTS=5 But the clients still show as 1 on http://127.0.0.1:8080/slamd I know i had got this to work som