Hi

I have written a servlet which implements SingleThreadModel
and used already existing public static syncronized classes to access
database.
these classes were used for standalone application.
does static synchronized has any problem with servlets????

when I deployment my servlet and try to  run it gives me error, its stack
trace is below.

when login reaches to access static synchronized class member or static
synchronized class method Iam getting
problem.

Funny thing is sames servlet and same code works in java web server. Do I
need to do some thing else in
tomcat 4.0.4-b1 to make it work. I tried with tomcat 4.0.3 also.
I have seen similar problem in archives but that work around does not work
for me.

______________________________  Error _____________________________

javax.servlet.ServletException: Invoker service() exception
        at
org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java
:508)
        at
org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:180)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
        at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:213)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
        at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:213)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:243)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:190)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
        at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
.java:475)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
        at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
46)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
        at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:170)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170
)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
        at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
1017)
        at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1115
)
        at java.lang.Thread.run(Thread.java:484)


root cause 

java.lang.ClassFormatError: com/CellFusion/Relational/RelConnection (Illegal
Variable name "")
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
        at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
        at
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLo
ader.java:1643)
        at
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.jav
a:937)
        at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
a:1372)
        at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
a:1254)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
        at
com.CellFusion.Relational.RelTransaction.beginNewTransaction(RelTransaction.
java:22)
        at Login.doGet(Login.java:133)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java
:450)
        at
org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:180)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
        at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:213)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
        at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:213)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:243)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:190)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
        at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
.java:475)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
        at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
46)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
        at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:170)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170
)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
        at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
1017)
        at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1115
)
        at java.lang.Thread.run(Thread.java:484)





______________________________code
description___________________________________________

public class Login extends HttpServlet implements SingleThreadModel


In this one Iam trying to access oracle database using custom developed
classes



/**
 * defineCFDatabase creates the Data Dictionary for 'cf'
 **/
public static synchronized boolean defineCFDatabase()
{
        
        try{
        if (!gDBInitialized) {
                
                gDBInitialized = dbCFDefinition.defineCFDatabase( false );
                if (gDBInitialized) {
                
                        gDB = dbCFDefinition.getDatabase();
                        dboCF = gDB;
                }
        }
        
        if (gDBInitialized && !gVariablesInitialized) {
                gVariablesInitialized = initializeVariables();
        }
        } catch(Exception e) {
                Util.log("*********  Exception :" + e.toString());      
        }
        
        return gDBInitialized && gVariablesInitialized;
}

In dbCFDefinition class
public static synchronized boolean defineCFDatabase( boolean forceAllTables
){

Access a class called DscDomain trying to get defaultId;

return boolean
}


DscDomain class calls a method as follows


public String getGenericType(String dataType , int length)      {
                
                if(!RelConnection.gDefaultConnectionIsOracle && mSQLServer){
                        //now only for SQLServer
                        if (dataType.toLowerCase().equals("varchar2")){
                                dataType = "varchar";
                        }
                        else if (dataType.toLowerCase().equals("number")){
                                dataType = "numeric";
                        }
                        else if (dataType.toLowerCase().equals("date")){
                                dataType = "datetime";
                        }
                        else{
                                dataType = "varchar";
                                length = 0;
                        }
                        
                } 
                if ( length == 0) { 
                        Util.log("------- 2 if dataType" + dataType + "
length: " + length);
                        return dataType;
                        
                        }
                else {
                    Util.log("------- else dataType" + dataType + " length:
" + length);
                        return dataType + "(" + length + ")" ;
                        }
        }


when RelConnection.gDefaultConnectionIsOracle is accessed Iam getting
problem
java.lang.ClassFormatError: com/CellFusion/Relational/RelConnection
(Illegal Variable name "")

RelConnection is a public class with static members and static methods
In the same package it is able to get other methods. when it is trying to
access static variable iam getting this error.

gDefaultConnectionIsOracle is defined as
static public boolean   gDefaultConnectionIsOracle = false;


Thanks a lot
Umamaheswar




--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to