CGIServlet problem ...
Hi,
I'm trying to use the CGIServlet to run a simple HelloWorld.pl but it
always fail.
Here is my simple perl script:
#!D:\perl\bin\perl.exe
print "Content-type:text/html\n\n";
print "HelloWorld";
exit;
Here is the in my weblogic.properties:
weblogic.httpd.register.cgi-bin=weblogic.servlet.CGIServlet
weblogic.httpd.initArgs.cgi-bin=cgiDir=C:/weblogic/myserver/cgi-bin
I'm getting this error:
cgi-bin: Failed to execute CGI script:HelloWorld.pl
THanks,
Ninou
Steven,
The CGIServlet for WebLogic will not run a CGI that doesn't have an extension.
Just add and extension to your executable and it should run fine.
jeff
"Steven" <[email protected]> wrote:
Hi all,
I am currently facing a problem with CGI binaries via CGIServlet on WLS
6.1
sp4. The web.xml file has been configured correctly as follows:
-------- start of web.xml -----------
<servlet>
<servlet-name>CGIServlet</servlet-name>
<servlet-class>weblogic.servlet.CGIServlet</servlet-class>
<init-param>
<param-name>cgiDir</param-name>
<param-value>/web/bea6.1sp2/wlserver6.1/config/ngwapp/applications/NGWWebApp
/cgi-bin</param-value>
</init-param>
<init-param>
<param-name>*.pl</param-name>
<param-value>/web/perl5/bin/perl5.00405</param-value>
</init-param>
<init-param>
<param-name>*.cgi</param-name>
<param-value>/web/perl5/bin/perl5.00405</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>CGIServlet</servlet-name>
<url-pattern>/cgi-bin/*</url-pattern>
</servlet-mapping>-------- end of web.xml ---------
When a call is made to http://.../cgi-bin/dialogserver , this results
in a
404-File Not Found error.
The contents of the cgi-bin directory have not been altered and I did
not
face this problem earlier when I was using sp2.
It only happened after I upgraded to sp4. Can anyone help?
best rgds,
steven.
Similar Messages
-
Hi,
I am running WLS 7.02.
I wanted to hookup a leagacy CGI app to the WLS.
I created the the web.xml as follows -
==========================================
<web-app>
<servlet>
<servlet-name>CGIServlet</servlet-name>
<servlet-class>weblogic.servlet.CGIServlet</servlet-class>
<init-param>
<param-name>cgiDir</param-name>
<param-value>/bea/iaps/applications/ptrax/cgi-bin</param-value>
</init-param>
<init-param>
<param-name>*.cgi</param-name>
<param-value>/bin/perl</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>CGIServlet</servlet-name>
<url-pattern>/cgi-bin/*</url-pattern>
</servlet-mapping>
</web-app>
============================================
The config.xml is configured for PTrax as follows -
============================================= =
<Application Deployed="true" Name="ptrax"
Path="/bea/iaps/applications" StagedTargets=""
StagingMode="nostage" TwoPhase="true">
<WebAppComponent Name="ptrax" Targets="nettools" URI="ptrax"/>
</Application>
===============================================
The ptrax dir is as follows -
/bea/iaps/applications/ptrax
|---- WEB-INF
|---- cgi-bin
|---- htdocs
|----- templates
The URL http://<host>:<port>/ptrax/cgi-bin/ptrax.cgi
is failing on a line, when it tries to open and read a file
./htdocs/templates/start.html
If I give the full path name as in
/bea/iaps/applications/ptrax/htdocs/templates/start.html
then it works.
My ques is -
#1. For a CGI app thats configured as above, what is the
root context ?
#2. Obviously, specifying full path name is not a good idea,
so what should be done to rectify this problem.
I would really appreciate a quick response.
Thanks in advance
-Anil VarmaHi Anil,
> For a CGI app thats configured as above, what is the root context ?
If memory serves, this is the directory of the domain to which the app
is deployed. (ie. not of the app, but of the domain)
Regards,
Jon -
CGIServlet differences between WLS 6.1 sp2 and sp4?
Hi all,
I am currently facing a problem with CGI binaries via CGIServlet on WLS 6.1
sp4. The web.xml file has been configured correctly as follows:
-------- start of web.xml -----------
<servlet>
<servlet-name>CGIServlet</servlet-name>
<servlet-class>weblogic.servlet.CGIServlet</servlet-class>
<init-param>
<param-name>cgiDir</param-name>
<param-value>/web/bea6.1sp2/wlserver6.1/config/ngwapp/applications/NGWWebApp
/cgi-bin</param-value>
</init-param>
<init-param>
<param-name>*.pl</param-name>
<param-value>/web/perl5/bin/perl5.00405</param-value>
</init-param>
<init-param>
<param-name>*.cgi</param-name>
<param-value>/web/perl5/bin/perl5.00405</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>CGIServlet</servlet-name>
<url-pattern>/cgi-bin/*</url-pattern>
</servlet-mapping>-------- end of web.xml ---------
When a call is made to http://.../cgi-bin/dialogserver , this results in a
404-File Not Found error.
The contents of the cgi-bin directory have not been altered and I did not
face this problem earlier when I was using sp2.
It only happened after I upgraded to sp4. Can anyone help?
best rgds,
steven.Steven,
The CGIServlet for WebLogic will not run a CGI that doesn't have an extension.
Just add and extension to your executable and it should run fine.
jeff
"Steven" <[email protected]> wrote:
Hi all,
I am currently facing a problem with CGI binaries via CGIServlet on WLS
6.1
sp4. The web.xml file has been configured correctly as follows:
-------- start of web.xml -----------
<servlet>
<servlet-name>CGIServlet</servlet-name>
<servlet-class>weblogic.servlet.CGIServlet</servlet-class>
<init-param>
<param-name>cgiDir</param-name>
<param-value>/web/bea6.1sp2/wlserver6.1/config/ngwapp/applications/NGWWebApp
/cgi-bin</param-value>
</init-param>
<init-param>
<param-name>*.pl</param-name>
<param-value>/web/perl5/bin/perl5.00405</param-value>
</init-param>
<init-param>
<param-name>*.cgi</param-name>
<param-value>/web/perl5/bin/perl5.00405</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>CGIServlet</servlet-name>
<url-pattern>/cgi-bin/*</url-pattern>
</servlet-mapping>-------- end of web.xml ---------
When a call is made to http://.../cgi-bin/dialogserver , this results
in a
404-File Not Found error.
The contents of the cgi-bin directory have not been altered and I did
not
face this problem earlier when I was using sp2.
It only happened after I upgraded to sp4. Can anyone help?
best rgds,
steven. -
Greetings!
In my site I am trying to call a CGI program from within a JSP (called
Test.jsp). To do this I use:
ServletContext sc = getServletConfig().getServletContext();
RequestDispatcher rd = sc.getRequestDispatcher("/cgi-bin/mycgi.exe");
rd.include(request,response);
I get the following error in the console when my JSP runs:
<ServletContext-General> cgi-bin: Failed to exec CGI script:Test.jsp
I have already added the lines in the weblogic.properties file to set up the
CGIServlet (as cgi-bin):
weblogic.httpd.register.cgi-bin=weblogic.servlet.CGIServlet
weblogic.httpd.initArgs.cgi-bin=cgiDir=c:/weblogic/myserver/public_html/cgi-
bin
I believe this part is correct since I can call my cgi program with:
http://localhost:7001/cgi-bin/mycgi.exe
and this works fine -- it calls my cgi program and returns the results to
the browser as I would expect
Does anyone know why I get the error I mentioned above? Is it invalid to
use the RequestDispatcher to include a call to a cgi program as described
above?
Thanks for any suggestions!
Matt
I'm not sure how to fix your problem, but one work around, is to simply open
a URL to the cgi and read in the output from it using a InputStreamReader
etc...
e.g.
myURL = new java.net.URL("http://some.com/cgi-bin/somecgi?" +
request.getParameter("refURL");
BufferedReader in = new BufferedReader(new
InputStreamReader(myURL.openStream()));
while ((inputLine = in.readLine()) != null) {
// read in input here...
Hope this helps in some way...
Richard Hart
"Matthew Fuchs" <[email protected]> wrote in message
news:[email protected]...
> Greetings!
>
> In my site I am trying to call a CGI program from within a JSP (called
> Test.jsp). To do this I use:
>
> ServletContext sc = getServletConfig().getServletContext();
> RequestDispatcher rd = sc.getRequestDispatcher("/cgi-bin/mycgi.exe");
> rd.include(request,response);
>
> I get the following error in the console when my JSP runs:
> <ServletContext-General> cgi-bin: Failed to exec CGI script:Test.jsp
>
> I have already added the lines in the weblogic.properties file to set up
the
> CGIServlet (as cgi-bin):
> weblogic.httpd.register.cgi-bin=weblogic.servlet.CGIServlet
>
>
weblogic.httpd.initArgs.cgi-bin=cgiDir=c:/weblogic/myserver/public_html/cgi-
> bin
>
> I believe this part is correct since I can call my cgi program with:
> http://localhost:7001/cgi-bin/mycgi.exe
> and this works fine -- it calls my cgi program and returns the results to
> the browser as I would expect
>
> Does anyone know why I get the error I mentioned above? Is it invalid to
> use the RequestDispatcher to include a call to a cgi program as described
> above?
>
> Thanks for any suggestions!
> Matt
>
>
-
I am using OracleXADataSource with ATG for
transactions.
oracle.jdbc.xa.client.OracleXADataSource
as XADataSource now it is working but i am getting
ERROR:
What is this 'JAVA_XA.XA_START_NEW' identifier ?
Error is :
java.sql.SQLException: ORA-06550: line 1, column 13:
PLS-00201: identifier 'JAVA_XA.XA_START_NEW' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
at
oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java, Compiled
Code)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java, Compiled Code)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java,
Compiled
Code)
at
oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java,
Compiled Code)
at
oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java,
Compiled Code)
at
oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java,
Compiled Code)
at
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java,
Compiled Code)
at
oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java,
Compiled Code)
at
oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java,
Compiled Code)
at
oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:171)
at atg.dtm.TransactionImpl.enlistResource(TransactionImpl.java,
Compiled Code)
at
atg.service.jdbc.MonitoredDataSource.getConnection(MonitoredDataSource.java,
Compiled Code)
at
atg.adapter.gsa.GSATransaction.getConnection(GSATransaction.java,
Compiled Code)
at
atg.adapter.gsa.GSAItemDescriptor.getConnection(GSAItemDescriptor.java,
Compiled Code)
at
atg.adapter.gsa.GSAItemDescriptor.executeQuery(GSAItemDescriptor.java,
Compiled Code)
at atg.adapter.gsa.GSAView.executeUncachedQuery(GSAView.java,
Compiled
Code)
at
atg.repository.RepositoryViewImpl.executeQuery(RepositoryViewImpl.java:297)
at
atg.repository.RepositoryViewImpl.executeQuery(RepositoryViewImpl.java:273)
at
atg.repository.RepositoryViewImpl.executeQuery(RepositoryViewImpl.java:179)
at
com.icadence.cadence.infomgmt.Glossary.searchLetter(Glossary.java:148)
at
com.icadence.cadence.infomgmt.GlossaryForm.getGlossaryItems(GlossaryForm.java:179)
at java.lang.reflect.Method.invoke(Native Method)
at
atg.droplet.DropletDescriptor.getPropertyValue(DropletDescriptor.java,
Compiled Code)
at
atg.droplet.DropletDescriptor.getPropertyValue(DropletDescriptor.java:580)
at
c003a_3._iCDNImplement._iCadence._docroot._test._Glossary._jspService(_Glossary.java:196)
at
atg.servlet.jsp.DynamoJspPageServlet.service(DynamoJspPageServlet.java:137)
at atg.servlet.DynamoPageServlet.service(DynamoPageServlet.java,
Compiled Code)
at
atg.servlet.pagecompile.PageCompileServlet.service(PageCompileServlet.java,
Compiled Code)
at atg.servlet.DynamoServlet.service(DynamoServlet.java:120)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.droplet.DropletEventServlet.service(DropletEventServlet.java,
Compiled Code)
at
atg.servlet.pipeline.PipelineableServletImpl.service(PipelineableServletImpl.java:224)
at
atg.servlet.pipeline.DispatcherPipelineServletImpl.service(DispatcherPipelineServletImpl.java:146)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.servlet.pipeline.MimeTyperPipelineServlet.service(MimeTyperPipelineServlet.java:174)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.servlet.pipeline.FileFinderPipelineServlet.service(FileFinderPipelineServlet.java:598)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.servlet.pipeline.DispatcherPipelineServletImpl.service(DispatcherPipelineServletImpl.java:163)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at atg.servlet.CgiServlet.serviceRequest(CgiServlet.java:318)
at atg.servlet.CgiServlet.service(CgiServlet.java:194)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.servlet.pipeline.WebApplicationDispatcherPipelineServlet.service(WebApplicationDispatcherPipelineServlet.java:64)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.servlet.security.FormLoginPipelineServlet.service(FormLoginPipelineServlet.java:109)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.servlet.sessionsaver.SessionSaverServlet.service(SessionSaverServlet.java:2351)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.commerce.promotion.PromotionServlet.service(PromotionServlet.java,
Compiled Code)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.userprofiling.AccessControlServlet.service(AccessControlServlet.java:530)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.userprofiling.SessionEventTrigger.service(SessionEventTrigger.java:316)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.userprofiling.PageEventTriggerPipelineServlet.service(PageEventTriggerPipelineServlet.java:128)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.userprofiling.ProfileRequestServlet.service(ProfileRequestServlet.java:343)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.servlet.pipeline.DynamoPipelineServlet.service(DynamoPipelineServlet.java:353)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.servlet.pipeline.SessionPipelineServlet.service(SessionPipelineServlet.java:316)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.servlet.pipeline.ServletPathPipelineServlet.service(ServletPathPipelineServlet.java,
Compiled Code)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.servlet.pipeline.ContextPathPipelineServlet.service(ContextPathPipelineServlet.java:95)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.servlet.pipeline.CookiePipelineServlet.service(CookiePipelineServlet.java:258)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.servlet.pipeline.URLArgumentPipelineServlet.service(URLArgumentPipelineServlet.java:268)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.servlet.pipeline.PathAuthenticationPipelineServlet.service(PathAuthenticationPipelineServlet.java:366)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.dtm.TransactionPipelineServlet.service(TransactionPipelineServlet.java:198)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.servlet.pipeline.HeadPipelineServlet.passRequest(HeadPipelineServlet.java:649)
at
atg.servlet.pipeline.HeadPipelineServlet.service(HeadPipelineServlet.java:421)
at
atg.servlet.pipeline.PipelineableServletImpl.service(PipelineableServletImpl.java:229)
at
atg.server.http.HttpConnection.serviceRequest(HttpConnection.java:571)
at
atg.server.http.HttpConnection.processSocket(HttpConnection.java:321)
at
atg.server.http.HttpConnection.handleRequest(HttpConnection.java:224)
at
atg.server.tcp.RequestServerHandler.run(RequestServerHandler.java,
Compiled Code)
java.sql.SQLException: ORA-06550: line 1, column 13:
PLS-00201: identifier 'JAVA_XA.XA_END_NEW' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
at
oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java, Compiled
Code)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java, Compiled Code)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java,
Compiled
Code)
at
oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java,
Compiled Code)
at
oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java,
Compiled Code)
at
oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java,
Compiled Code)
at
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java,
Compiled Code)
at
oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java,
Compiled Code)
at
oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java,
Compiled Code)
at
oracle.jdbc.xa.client.OracleXAResource.end(OracleXAResource.java:265)
at atg.dtm.TransactionImpl.delistResource(TransactionImpl.java,
Compiled Code)
at
atg.service.jdbc.MonitoredDataSource.connectionClosed(MonitoredDataSource.java,
Compiled Code)
at
atg.service.jdbc.PooledXAConnection.close(PooledXAConnection.java,
Compiled Code)
at
atg.service.jdbc.PooledMonitoredConnection.close(PooledMonitoredConnection.java,
Compiled Code)
at
atg.adapter.gsa.GSATransaction.closeConnection(GSATransaction.java,
Compiled Code)
at
atg.adapter.gsa.GSAItemDescriptor.close(GSAItemDescriptor.java,
Compiled Code)
at
atg.adapter.gsa.GSAItemDescriptor.close(GSAItemDescriptor.java,
Compiled Code)
at
atg.adapter.gsa.GSAItemDescriptor.executeQuery(GSAItemDescriptor.java,
Compiled Code)
at atg.adapter.gsa.GSAView.executeUncachedQuery(GSAView.java,
Compiled
Code)
at
atg.repository.RepositoryViewImpl.executeQuery(RepositoryViewImpl.java:297)
at
atg.repository.RepositoryViewImpl.executeQuery(RepositoryViewImpl.java:273)
at
atg.repository.RepositoryViewImpl.executeQuery(RepositoryViewImpl.java:179)
at
com.icadence.cadence.infomgmt.Glossary.searchLetter(Glossary.java:148)
at
com.icadence.cadence.infomgmt.GlossaryForm.getGlossaryItems(GlossaryForm.java:179)
at java.lang.reflect.Method.invoke(Native Method)
at
atg.droplet.DropletDescriptor.getPropertyValue(DropletDescriptor.java,
Compiled Code)
at
atg.droplet.DropletDescriptor.getPropertyValue(DropletDescriptor.java:580)
at
c003a_3._iCDNImplement._iCadence._docroot._test._Glossary._jspService(_Glossary.java:196)
at
atg.servlet.jsp.DynamoJspPageServlet.service(DynamoJspPageServlet.java:137)
at atg.servlet.DynamoPageServlet.service(DynamoPageServlet.java,
Compiled Code)
at
atg.servlet.pagecompile.PageCompileServlet.service(PageCompileServlet.java,
Compiled Code)
at atg.servlet.DynamoServlet.service(DynamoServlet.java:120)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.droplet.DropletEventServlet.service(DropletEventServlet.java,
Compiled Code)
at
atg.servlet.pipeline.PipelineableServletImpl.service(PipelineableServletImpl.java:224)
at
atg.servlet.pipeline.DispatcherPipelineServletImpl.service(DispatcherPipelineServletImpl.java:146)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.servlet.pipeline.MimeTyperPipelineServlet.service(MimeTyperPipelineServlet.java:174)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.servlet.pipeline.FileFinderPipelineServlet.service(FileFinderPipelineServlet.java:598)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.servlet.pipeline.DispatcherPipelineServletImpl.service(DispatcherPipelineServletImpl.java:163)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at atg.servlet.CgiServlet.serviceRequest(CgiServlet.java:318)
at atg.servlet.CgiServlet.service(CgiServlet.java:194)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.servlet.pipeline.WebApplicationDispatcherPipelineServlet.service(WebApplicationDispatcherPipelineServlet.java:64)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.servlet.security.FormLoginPipelineServlet.service(FormLoginPipelineServlet.java:109)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.servlet.sessionsaver.SessionSaverServlet.service(SessionSaverServlet.java:2351)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.commerce.promotion.PromotionServlet.service(PromotionServlet.java,
Compiled Code)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.userprofiling.AccessControlServlet.service(AccessControlServlet.java:530)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.userprofiling.SessionEventTrigger.service(SessionEventTrigger.java:316)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.userprofiling.PageEventTriggerPipelineServlet.service(PageEventTriggerPipelineServlet.java:128)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.userprofiling.ProfileRequestServlet.service(ProfileRequestServlet.java:343)
at
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java,
Compiled Code)
at
atg.servlet.pipeline.DynamoPipelineServlet.service(DynamoPipelineServlet.java:353)
Do i need to do any special settings on Oracle server ?
Thanx ,
Aruna.Hi All.
Any update on this.
I get the same problem
java.sql.SQLException: ORA-06550: line 1, column 13:
PLS-00201: identifier 'JAVA_XA.XA_START_NEW' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
I get the error in the start statement (see below)
XAConnection pc = oxds.getXAConnection();
// Get a logical connection
Connection conn1 = pc.getConnection();
// Get XA resource handle
XAResource oxar = pc.getXAResource();
System.out.println("XAResource oxar =" + oxar);
Xid xid = createXid();
System.out.println("Xid oxar =" + xid);
// Start a transaction branch
====>> oxar.start (xid, XAResource.TMNOFLAGS);
Many thanks.
Vincenzo -
CGIServlet/Perl can't seem to find my package
I am running WLS6.0 and configured the CGIServlet to run some Perl
scripts. I have some of my code in a package (common.pm) and that
package file is in the same directory as my perl scripts. I can't
seem to get any of the scripts to work that use my package. Even just
having the "use common;" statement seems to cause problems.
I can get my scripts to work by commenting out the 'use' statement and
any calls to my package and moving the code directly into the called script.
The code and package do work correctly when run from the command line.
Any ideas what I may be missing. These scripts and package have
worked on AIX under Apache. This is failing on Solaris.
Thanks in advance,
MikeYou answered my first question indirectly. You presumably are using Time Machine to bacup your Mac to the Time Capsule. Feel free to confirm that explicitly.
You ignored my second question: "What are the exact steps you're doing to try to find them?"
iMovie projects are normally kept in the "Movies" folder at the top level of your user account. Unless you specifically excluded that folder, it should have been backed up by Time Machine. -
My WLS is 8.1 SP2. I try to run the CGI/PL program in my server and I install the servlet in the web.xml file. After I run one CGI/PL program I get
" Error 500--Internal Server Error "
And I check with the log file. I get those error message:
<Jan 6, 2005 11:53:52 AM PST> <Error> <HTTP> <BEA-101017> <[ServletContext(id=20
41638322,name=PORTAL,context-path=)] Root cause of ServletException.
java.lang.NoClassDefFoundError
at weblogic.servlet.CGIServlet.init(CGIServlet.java:74)
at weblogic.servlet.internal.ServletStubImpl$ServletInitAction.run(Servl
etStubImpl.java:993)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:317)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
118)
at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubIm
pl.java:869)
at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStub
Impl.java:848)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubI
mpl.java:787)
at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.
java:518)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:362)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
Anyone have idea how does this happen and how to fix it?
Thanks advance
AllenHi Allen,
Even I am facing the same problem. Did you received any reply from anyone? or Did you found any solution for the same? I am using WebLogic Server 8.1 SP5
If someone from BEA team helps as this being a reported problem.
Thanks in Advance,
Raghuram -
Problem when configuring WebLogic 6.0 for CGI - URGENT
Hello,
Can U please write back for the below described problem.
We are using WebLogic Server 6.0 and we have configured the WLS for CGI support,so
that Oracle Report Server 6.0 cud be used to generate reports.Following is the
series of steps that have been followed for the configuration and generating
a report:
1.The Rwcgi60.exe has been copied from D:\orant\bin ( assumed that D is the drive
wherein Oracle Report Server6.0 has been installed) to the directory C:\bea\wlserver6.0\config\mydomain\applications\DefaultWebApp_myserver\cgi-bin
( assumed that C is the drive wherein Weblogic Server6.0 has been installed)
2.The web.xml in the following directory C:\bea\wlserver6.0\config\mydomain\applications\DefaultWebApp_myserver\WEB-INF,
has the following details
<?xml version="1.0" ?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 1.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<servlet>
<servlet-name>CGIServlet</servlet-name>
<servlet-class>weblogic.servlet.CGIServlet</servlet-class>
<init-param>
<param-name>cgiDir</param-name>
<param-value>/bea/wlserver6.0/config/mydomain/applications/DefaultWebApp_myserver/cgi-bin</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>CGIServlet</servlet-name>
<url-pattern>/cgi-bin/*</url-pattern>
</servlet-mapping>
</web-app>
3.Environment Variables Settings as mentioned below have been set in the registry,
REPORTS60_SHARED_CACHE = NO
REPORTS60_VIRTUAL_MAP = /CACHE
REPORTS60_PHYSICAL_MAP = D:\orant\REPORT60\SERVER\CACHE
REPORTS60_PATh = D:\orant\REPORT60\ADMIN\TEMPLATE\US;D:\orant\REPORT60;c:\web_reports\reports
REPORTS_CGIMAP = D:\orant\REPORT60\SERVER\cgicmd.dat
4.Started the startWebLogic.cmd, in the directory C:\bea\wlserver6.0\config\mydomain
5.On giving the following URL in the IE5.5, http://bet-pc0080:7001/cgi-bin/rwcgi60.exe?report=Rept4-PriceStructuresCreated.rdf+server=REP60_BET-PC0080+userid=dstnew/dstnew@dstnew+desformat=html+destype=cache+Retailer_id=001010010200103
It shows up the following error in the startWebLogic.cmd and the IE icon on the
browser keeps rotating.
java.lang.ClassCastException: weblogic.utils.Executable$Drainer
at weblogic.servlet.internal.ResponseHeaders.setDateHeader(ResponseHeaders.java:273)
at weblogic.servlet.internal.ServletResponseImpl.setDateHeader(ServletResponseImpl.java:467)
at weblogic.servlet.internal.ServletResponseImpl.writeHeaders(ServletResponseImpl.java:672)
at weblogic.servlet.internal.ServletOutputStreamImpl.flush(ServletOutputStreamImpl.java:130)
at weblogic.servlet.internal.ServletOutputStreamImpl.flushWithCheck(ServletOutputStreamImpl.java:412)
at weblogic.servlet.internal.ServletOutputStreamImpl.checkForFlush(ServletOutputStreamImpl.java:548)
at weblogic.servlet.internal.ServletOutputStreamImpl.write(ServletOutputStreamImpl.java:210)
at weblogic.servlet.internal.WLOutputStreamWriter.flushBuffer(WLOutputStreamWriter.java:139)
at weblogic.servlet.internal.WLOutputStreamWriter.write(WLOutputStreamWriter.java:104)
at weblogic.servlet.internal.WLOutputStreamWriter.write(WLOutputStreamWriter.java:67)
at java.io.PrintWriter.write(PrintWriter.java:173)
at weblogic.servlet.CGIServlet$CGICharArrayWriter.write(CGIServlet.java:292)
at weblogic.utils.Executable$Drainer.run(Executable.java:266)
Please send in a solution at the earliest.
Thanks,
KavithaHello,
Can U please write back for the below described problem.
We are using WebLogic Server 6.0 and we have configured the WLS for CGI support,so
that Oracle Report Server 6.0 cud be used to generate reports.Following is the
series of steps that have been followed for the configuration and generating
a report:
1.The Rwcgi60.exe has been copied from D:\orant\bin ( assumed that D is the drive
wherein Oracle Report Server6.0 has been installed) to the directory C:\bea\wlserver6.0\config\mydomain\applications\DefaultWebApp_myserver\cgi-bin
( assumed that C is the drive wherein Weblogic Server6.0 has been installed)
2.The web.xml in the following directory C:\bea\wlserver6.0\config\mydomain\applications\DefaultWebApp_myserver\WEB-INF,
has the following details
<?xml version="1.0" ?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 1.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<servlet>
<servlet-name>CGIServlet</servlet-name>
<servlet-class>weblogic.servlet.CGIServlet</servlet-class>
<init-param>
<param-name>cgiDir</param-name>
<param-value>/bea/wlserver6.0/config/mydomain/applications/DefaultWebApp_myserver/cgi-bin</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>CGIServlet</servlet-name>
<url-pattern>/cgi-bin/*</url-pattern>
</servlet-mapping>
</web-app>
3.Environment Variables Settings as mentioned below have been set in the registry,
REPORTS60_SHARED_CACHE = NO
REPORTS60_VIRTUAL_MAP = /CACHE
REPORTS60_PHYSICAL_MAP = D:\orant\REPORT60\SERVER\CACHE
REPORTS60_PATh = D:\orant\REPORT60\ADMIN\TEMPLATE\US;D:\orant\REPORT60;c:\web_reports\reports
REPORTS_CGIMAP = D:\orant\REPORT60\SERVER\cgicmd.dat
4.Started the startWebLogic.cmd, in the directory C:\bea\wlserver6.0\config\mydomain
5.On giving the following URL in the IE5.5, http://bet-pc0080:7001/cgi-bin/rwcgi60.exe?report=Rept4-PriceStructuresCreated.rdf+server=REP60_BET-PC0080+userid=dstnew/dstnew@dstnew+desformat=html+destype=cache+Retailer_id=001010010200103
It shows up the following error in the startWebLogic.cmd and the IE icon on the
browser keeps rotating.
java.lang.ClassCastException: weblogic.utils.Executable$Drainer
at weblogic.servlet.internal.ResponseHeaders.setDateHeader(ResponseHeaders.java:273)
at weblogic.servlet.internal.ServletResponseImpl.setDateHeader(ServletResponseImpl.java:467)
at weblogic.servlet.internal.ServletResponseImpl.writeHeaders(ServletResponseImpl.java:672)
at weblogic.servlet.internal.ServletOutputStreamImpl.flush(ServletOutputStreamImpl.java:130)
at weblogic.servlet.internal.ServletOutputStreamImpl.flushWithCheck(ServletOutputStreamImpl.java:412)
at weblogic.servlet.internal.ServletOutputStreamImpl.checkForFlush(ServletOutputStreamImpl.java:548)
at weblogic.servlet.internal.ServletOutputStreamImpl.write(ServletOutputStreamImpl.java:210)
at weblogic.servlet.internal.WLOutputStreamWriter.flushBuffer(WLOutputStreamWriter.java:139)
at weblogic.servlet.internal.WLOutputStreamWriter.write(WLOutputStreamWriter.java:104)
at weblogic.servlet.internal.WLOutputStreamWriter.write(WLOutputStreamWriter.java:67)
at java.io.PrintWriter.write(PrintWriter.java:173)
at weblogic.servlet.CGIServlet$CGICharArrayWriter.write(CGIServlet.java:292)
at weblogic.utils.Executable$Drainer.run(Executable.java:266)
Please send in a solution at the earliest.
Thanks,
Kavitha -
Another problem with CGI on WL
Here is what I got:
Sun Solaris 2.6
Weblogic6.0
In properties file I defined :
<servlet>
<servlet-name>CGIServlet</servlet-name>
<servlet-class>weblogic.servlet.CGIServlet</servlet-class>
<init-param>
<param-name>cgiDir</param-name>
<param-value>/wl_home/config/domain/applications/my_app/cgi-bin</param-value>
</init-param>
<init-param>
<param-name>*.pl</param-name>
<param-value>/usr/local/bin/perl</param-value>
</init-param>
</servlet>
RESULT:
When I try to run script from browser:
//host:port/my_app/cgi-bin/myscript.pl
or from another html file
The source code of the script is displayed.
Any idea what is the problem?
ThanksPlease don't cross post. It looks like someone answered you in
weblogic.developer.interest.servlet.
Regards,
Michael
NDJ wrote:
Here is what I got:
Sun Solaris 2.6
Weblogic6.0
In properties file I defined :
<servlet>
<servlet-name>CGIServlet</servlet-name>
<servlet-class>weblogic.servlet.CGIServlet</servlet-class>
<init-param>
<param-name>cgiDir</param-name>
<param-value>/wl_home/config/domain/applications/my_app/cgi-bin</param-value>
</init-param>
<init-param>
<param-name>*.pl</param-name>
<param-value>/usr/local/bin/perl</param-value>
</init-param>
</servlet>
RESULT:
When I try to run script from browser:
//host:port/my_app/cgi-bin/myscript.pl
or from another html file
The source code of the script is displayed.
Any idea what is the problem?
Thanks--
Developer Relations Engineer
BEA Support -
Anyone have experience with the CGIServlet? I'm getting the following
when I try to run it.
Thu Sep 21 15:15:53 EDT 2000:<I> <ServletContext-General> cgi-bin:
Failed to exec CGI script:test.pl
I'm using WL5.1 on solaris 2.7
thanks
Daniel Koetter
Hi, I ran into the same problem recently and found a solution. Check out No.
2
To run CGI:
1. Follow the instruction on weblogic documentation
(for Weblogic 5.1: http://www.weblogic.com/docs51/admindocs/http.html#cgi),
which basically update your weblogic.properties file.
Make sure you put the correct path for the cgi interpreter (if it is
interpreted), and the path to your "cgi-bin" directory.
Follow the syntax as given by the examples (other entries in
weblogic.properties file). '/' works fine for path, '\' is for
"continue-in-the-next-line". Both works the same for NT and Solaris. (If
your experience is different, please alert me.)
2. This is what Weblogic assume you know.
Update your weblogic.policy and include "permission
java.security.AllPermission;" inside all grant. This is a sweeping "grant
all" to make sure it works - however, you may need to reduce it for
production. I am also not that clear with this, but I think this article can
help:
http://developer.java.sun.com/developer/onlineTraining/Security/Fundamentals
/Security.html
3. Run Simple CGI first, increase difficulty later.
Try simple CGI that does not depends on anything else (i.e. "Hello World"),
then try others which gets input and print them out as output. If you manage
to get it running, the rest should be fine. However, be warned that if it
works on the command line, Weblogic may not run it (it is not 100%
guaranteed). I found out that "cgi-lib.pl" which is required by the perl
script to work (parse the name-value input) need to be referred in absolute
path when used with WebLogic. It would still work on command line if it is
relative, but not with weblogic.
"Common-mistakes" Watch-Out list:
1. Make sure your CGI run on the prompt.
2. (Perl only) Make sure your "shebang" (#!) refers to the correct
interpreter (For NT, you cannot refer to root as "/", but you have to
specify the correct path as in #!c:\Perl\bin\Perl.exe)
3. (Only in Unix) Make sure you give execute permission to the CGI scripts
you want to run. Do "chmod a+x scriptfilename.extension"
4. Make sure the HTML file form which submits to the CGI, refer to the CGI
in absolute path ("<form action="./cgi-bin/your_cgi.pl ...>") does not work.
It has to be "<form action="http://your_site/cgi-bin/your_cgi.pl ...>".
Aryanto
Daniel Koetter wrote in message <[email protected]>...
>Yes it runs fine from the command line.
>
>vikram wrote:
>
>> Daniel Koetter <[email protected]> wrote:
>> >Anyone have experience with the CGIServlet? I'm getting the following
>> >when I try to run it.
>> >
>> >Thu Sep 21 15:15:53 EDT 2000:<I> <ServletContext-General> cgi-bin:
>> >Failed to exec CGI script:test.pl
>>
>> i am getting the same error with an .exe on winNT
>> have u tried running the perl file on the command line
>>
>> hth
>
-
WLS6.0 problem finding perl package
I am running WLS6.0 and configured the CGIServlet to run some Perl
scripts. I have some of my code in a package (common.pm) and that
package file is in the same directory as my perl scripts. I can't
seem to get any of the scripts to work that use my package. Even just
having the "use common;" statement seems to
cause problems.
I can get my scripts to work by commenting out the 'use' statement and
any calls to my package.
Any ideas what I may be missing. These scripts and package have
worked on AIX under Apache.
Thanks in advance,
Mike
i'm a student, I have to make a project using java2sdk1.4.0 as compiler and runtime environement and textpad as texteditor, my problem is the following: our teacher wrote a package called fsa.games, when i give the classpath to the package in the textpad setting for the javac compiler, when i try to compile my sourcefiles which are supposed to import the classes from fsa.games package the compiler tells me the package doesn't exist.
I'm pretty sure the classpath is right, but i can't figure out what's wrong?
If you have any idea i would love to hear them cause i'm going crazy on this.
Thanks in advance
Dear,
Let us approach this with an example....
You have an java file as given below
package fsa.games;
public class FootBall
and consider you have stored this java file in the directory as given below
c:/javatest/FootBall.java
now change the directory to c:/javatest
compile FootBall.java
javac -d . FootBall.java
This will create a directory structure as given below
c:/javatest/fsa/games/FootBall.class
Now, set the classpath
set CLASSPATH=c:/javatest;%CLASSPATH%
Execute the java file
java fsa.games.FootBall
Hope u can understand the procedure..
Kind regards,
ArunKumar I -
I am trying to implement some kind of a server listening for requests. The listener part of the app, is a daemon thread that listens for connections and instantiates a handling daemon thread once it gets some. However, my problem is that i must be able to kill the listening thread at the user's will (say via a sto button). I have done this via the Sun's proposed way, by testing a boolean flag in the loop, which is set to false when i wish to kill the thread. The problem with this thing is the following...
Once the thread starts excecuting, it will test the flag, find it true and enter the loop. At some point it will LOCK on the server socket waiting for connection. Unless some client actually connects, it will keep on listening indefinatelly whithought ever bothering to check for the flag again (no matter how many times you set the damn thing to false).
My question is this: Is there any real, non-theoretical, applied way to stop thread in java safely?
Thank you in advance,
LeftyThis was one solution from the socket programming forum, have you tried this??
public Thread MyThread extends Thread{
boolean active = true;
public void run(){
ss.setSoTimeout(90);
while (active){
try{
serverSocket = ss.accept();
catch (SocketTimeoutException ste){
// do nothing
// interrupt thread
public void deactivate(){
active = false;
// you gotta sleep for a time longer than the
// accept() timeout to make sure that timeout is finished.
try{
sleep(91);
}catch (InterruptedException ie){
interrupt();
} -
A problem with Threads and MMapi
I am tring to execute a class based on Game canvas.
The problem begin when I try to Play both a MIDI tone and to run an infinit Thread loop.
The MIDI tone "Stammers".
How to over come the problem?
Thanks in advance
Kobi
See Code example below:
import java.io.IOException;
import java.io.InputStream;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.GameCanvas;
import javax.microedition.media.Manager;
import javax.microedition.media.MediaException;
import javax.microedition.media.Player;
public class MainScreenCanvas extends GameCanvas implements Runnable {
private MainMIDlet parent;
private boolean mTrucking = false;
Image imgBackgound = null;
int imgBackgoundX = 0, imgBackgoundY = 0;
Player player;
public MainScreenCanvas(MainMIDlet parent)
super(true);
this.parent = parent;
try
imgBackgound = Image.createImage("/images/area03_bkg0.png");
imgBackgoundX = this.getWidth() - imgBackgound.getWidth();
imgBackgoundY = this.getHeight() - imgBackgound.getHeight();
catch(Exception e)
System.out.println(e.getMessage());
* starts thread
public void start()
mTrucking = true;
Thread t = new Thread(this);
t.start();
* stops thread
public void stop()
mTrucking = false;
public void play()
try
InputStream is = getClass().getResourceAsStream("/sounds/scale.mid");
player = Manager.createPlayer(is, "audio/midi");
player.setLoopCount(-1);
player.prefetch();
player.start();
catch(Exception e)
System.out.println(e.getMessage());
public void run()
Graphics g = getGraphics();
play();
while (true)
tick();
input();
render(g);
* responsible for object movements
private void tick()
* response to key input
private void input()
int keyStates = getKeyStates();
if ((keyStates & LEFT_PRESSED) != 0)
imgBackgoundX++;
if (imgBackgoundX > 0)
imgBackgoundX = 0;
if ((keyStates & RIGHT_PRESSED) != 0)
imgBackgoundX--;
if (imgBackgoundX < this.getWidth() - imgBackgound.getWidth())
imgBackgoundX = this.getWidth() - imgBackgound.getWidth();
* Responsible for the drawing
* @param g
private void render(Graphics g)
g.drawImage(imgBackgound, imgBackgoundX, imgBackgoundY, Graphics.TOP | Graphics.LEFT);
this.flushGraphics();
}You can also try to provide a greater Priority to your player thread so that it gains the CPU time when ever it needs it and don't harm the playback.
However a loop in a Thread and that to an infinite loop is one kind of very bad programming, 'cuz the loop eats up most of your CPU time which in turn adds up more delays of the execution of other tasks (just as in your case it is the playback). By witting codes bit efficiently and planning out the architectural execution flow of the app before start writing the code helps solve these kind of issues.
You can go through [this simple tutorial|http://oreilly.com/catalog/expjava/excerpt/index.html] about Basics of Java and Threads to know more about threads.
Regds,
SD
N.B. And yes there are more articles and tutorials available but much of them targets the Java SE / EE, but if you want to read them here is [another great one straight from SUN|http://java.sun.com/docs/books/tutorial/essential/concurrency/index.html] .
Edited by: find_suvro@SDN on 7 Nov, 2008 12:00 PM -
Hi all,
I would like to ask you for a help. I need to write a small program at my university. I started to write a midlet which function would be to countdown time for sports activities. I woul like to start a new thread - the one that counts down - and at the same time make the main thread sleep. After the "countdown" thread finishes, the main thread wakes up and waits for user input. The problem is that when the "countdown" thread finishes his work, I've got Uncaught exception java/lang/NullPointerException. error and the midlet halts.
Below you can find the code
import java.lang.*;
import java.util.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class intervals extends MIDlet implements CommandListener
public Display ekran;
private SweepCanvas sweeper;
private Form rundy;
private TextField round0, round1, round2, round3, round4, round5, round6, round7, round8;
private long czas,x;
private Command exitCommand;
private Command addRound;
private Command delRound;
private Command start;
private TextField repeat;
private Form odliczanie;
private Alert ostrz;
Licznik thread;
String test;
StringItem test1;
int parz,i,j,k;
static int l;
int ilrund;
int ilpowt;
Item sec;
long sec1;
public intervals()
rundy = new Form("Interwały sportowe");
exitCommand = new Command("Wyjście", Command.EXIT, 2);
addRound = new Command("Dodaj","Dodaj rundę", Command.ITEM,1);
delRound = new Command("Usuń","Usuń ostatnią rundę", Command.ITEM,1);
start = new Command("Start", Command.ITEM,1);
odliczanie = new Form("Odliczanie");
TextField dodaj(TextField kolej)
kolej=new TextField("Podaj czas (s) rundy "+parz,null, 4, TextField.NUMERIC);//stworzenie nowej instancji do wybierania czasu trwania rundy
if(rundy.size()==0)
rundy.insert(rundy.size(),kolej);
else
rundy.insert(rundy.size()-1, kolej);
return kolej;
void odliczanie(TextField round)
monitor m=new monitor();
k=Integer.parseInt(round.getString());
ekran.setCurrent(odliczanie);
thread=new Licznik(k,odliczanie);
thread.start();
ekran.setCurrent(rundy);
public void startApp()// throws MIDletStateChangeException
rundy.deleteAll();
repeat = new TextField("Podaj ilość powtórzeń",null,1,TextField.NUMERIC);
rundy.addCommand(addRound);
rundy.addCommand(exitCommand);
rundy.setCommandListener(this);
Canvas obrazek = new MyCanvas();
ekran = Display.getDisplay(this);
ekran.setCurrent(obrazek);
czas=System.currentTimeMillis();
while (System.currentTimeMillis()<czas+1000)
continue;
ekran.setCurrent(rundy);
public void pauseApp()
public void destroyApp(boolean unconditional)
notifyDestroyed();
public void commandAction(Command c, Displayable s)
if (c == exitCommand)
destroyApp(false);
notifyDestroyed();
else if(c==addRound)
if(rundy.size()==0)//Sprawdzenie ilości elementów w celu poprawnego wyświetlania liczby rund w formie
parz=1;
else
parz=rundy.size();
switch(parz)
case 1:
round0=dodaj(round0);break;
case 2:
round1=dodaj(round1);break;
case 3:
round2= dodaj(round2);break;
case 4:
round3=dodaj(round3);break;
case 5:
round4=dodaj(round4);break;
default:
ostrz=new Alert("Uwaga","Maksymalna liczba rund wynosi 9", null, AlertType.INFO);
ostrz.setTimeout(3000);
ekran.setCurrent(ostrz);
if(rundy.size()==1)
rundy.append(repeat);
rundy.addCommand(start);
rundy.addCommand(delRound);
else if(c==delRound)
if(rundy.size()!=0)
rundy.delete(rundy.size()-2);
if (rundy.size()==1)
rundy.deleteAll();
if(rundy.size()==0)
rundy.removeCommand(delRound);
rundy.removeCommand(start);
else if(c==start)
ilrund=rundy.size()-1;
if(this.repeat.size()>0)
ilpowt=Integer.parseInt(this.repeat.getString());
ekran = Display.getDisplay(this);
for (i=1; i<=ilpowt;i++)
odliczanie= new Form("Odliczanie");
for (j=0;j<ilrund;j++)
switch(j)
case 0:
odliczanie(round0);
break;
case 1:
odliczanie(round1);
break;
case 2:
odliczanie(round2);
break;
case 3:
odliczanie(round3);
break;
case 4:
odliczanie(round4);
break;
case 5:
odliczanie(round5);
break;
case 6:
odliczanie(round6);
break;
case 7:
odliczanie(round7);
break;
case 8:
odliczanie(round8);
break;
class Licznik extends Thread
int czas1,k;
Form forma;
monitor m;
public Licznik(int k,Form formap)
czas1=k;
forma=formap;
public synchronized void run()
while(czas1>0)
forma.deleteAll();
forma.append("Czas pozostały (s): "+czas1);
try{Thread.sleep(1000);} catch(InterruptedException e){e.printStackTrace();}
czas1--;
if(czas1<=0)
m.put();
}and monitor class
public class monitor
boolean busy=false;
synchronized void get()
if(!busy)
try
wait();
}catch(InterruptedException e){e.printStackTrace();}
notify();
synchronized void put()
if(busy)
try
wait();
}catch(InterruptedException e){e.printStackTrace();}
busy=true;
notify();
}Can anybody help me with this?Groovemaker,
Your Licznik class has a member m of type monitor, which has not been instantiated (in other words is null) hence, when calling m.put() you get NullPointerException. Please also mind, that using Thread.sleep(1000) is not an accurate way of measuring time.
If I may, please use recommended for Java class naming conventions - some of your names use lower case, while other don't which is confusing to the reader.
Daniel -
Problem with threads within applet
Hello,
I got an applet, inside this applet I have a singleton, inside this singleton I have a thread.
this thread is running in endless loop.
he is doing something and go to sleep on and on.
the problem is,
when I refresh my IE6 browser I see more than 1 thread.
for debug matter, I did the following things:
inside the thread, sysout every time he goes to sleep.
sysout in the singleton constructor.
sysout in the singleton destructor.
the output goes like this:
when refresh the page, the singleton constructor loading but not every refresh, sometimes I see the constructor output and sometimes I dont.
The thread inside the singleton is giving me the same output, sometime I see more than one thread at a time and sometimes I dont.
The destructor never works (no output there).
I don't understand what is going on.
someone can please shed some light?
thanks.
btw. I am working with JRE 1.1
this is very old and big applet and I can't convert it to something new.Ooops. sorry!
I did.
public void start() {
public void stop() {
public void destroy() {
try {
resetAll();
Configuration.closeConnection();
QuoteItem.closeConnection();
} finally {
try {
super.finalize();
} catch (Throwable e) {
e.printStackTrace();
}
Maybe you are looking for
-
Modules not Visible in client machine
Hi I have given full authorization to one user.but when i open that user in client machine then those modules are not visible though all are enable when i click modules from header from the window of SAP B1. How can i see them? Thanks
-
8600 all in one not printing wireless
My 8600 printer is not printing wireless. We moved and it was set up with the new router and it printed once. It has not printed since. I have turned it off and back on. I have uninstalled and reinstalled. I did scan doctor and it told me to uni
-
When I have been away from my computer for several hours, I am not surprised to have to provide my password, but I am surprised to see the computer starting up again, opening all my login items, etc etc. This takes time I'd rather save. I have checke
-
I need to compress about 1,000 jpg images and I'm using the "save for web" feature in Photoshop 7 but I'm running into problems because my file names are very long and its cutting them off. I found the workaround by editing the output settings and un
-
Windows XP, SP3: 'Skype has encountered a problem ...
I have seen quite a few people have this issue on here, but despite countless forum searches and multiple uninstalls/re-installs, I have not been able to fix my problem. I have not had any issues will Skype on my other computer. But I have recently g