CLASSPATH problem with Application Server 8.2
Hello everyone.
i am new to using the App server 8.2 for deploying a web application. we decided to use it because we were having too many problems with Web Server.
We successfully deployed the application and it runs. however, when accessing a page with database connectivity, we get the following error:
=================================================
com.sun.rave.web.ui.appbase.ApplicationException: javax.servlet.ServletException: java.lang.RuntimeException: java.sql.SQLException: Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : com.sun.sql.datasource.DriverAdapter
com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.destroy(ViewHandlerImpl.java: 601)
com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.renderView(ViewHandlerImpl.ja va:316)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87 )
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:221)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
sun.reflect.GeneratedMethodAccessor261.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja va:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
java.security.AccessController.doPrivileged(Native Method)
com.sun.rave.web.ui.util.UploadFilter.doFilter(UploadFilter.java:194)
=================================================
I don't really know what that means but it looks like i need to set some sort of classpath properties. under web server 6.1, the classpath settings were those of the server's JAR file path.
i used Studio creator's remote deployment tool to deploy to AppSvr8.2.
i followed the tutorial step by step.
can someone please help me
# 1
Hi!
Creator's application uses driveradapter.jar for work with DB and therefore You should add it to classpath of remote application server. You can just copy $Creator_Dir\SunAppServer8\lib\driveradapter.jar to lib directory of remote application server (SunAppServer_Dir\lib\). If it won't help try to copy driveradapter.jar and add it to classpath suffix with Admin Console.
Thanks,
Roman.
Grif at 2007-7-7 3:41:16 >

# 2
Hi. Thanks for the reply.
i did what you suggested. i do not get the same error anymore. i now get a different one, see below:
=====================================================
com.sun.rave.web.ui.appbase.ApplicationException: javax.servlet.ServletException: java.lang.RuntimeException: java.sql.SQLException
com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.destroy(ViewHandlerImpl.java: 601)
com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.renderView(ViewHandlerImpl.ja va:316)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87 )
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:225)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:194)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja va:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
java.security.AccessController.doPrivileged(Native Method)
com.sun.rave.web.ui.util.UploadFilter.doFilter(UploadFilter.java:194)
======================================================
i have no idea what this error means, why it is generated, or how to fix it. i really would appreciate any help from anyone. it would be unfortunate that i worked so hard with Sun JSC for so long only to have an application that cant be run on the server!!
# 3
just for more info:
i did everything i found in any tutorial. there was one post somewhere that i found that said the driveradapter files and classpath links should be in the <install_dir>/lib/JDBCRESOURCES....i did that too.
this is what i have in JVM settings:
Server Classpath:
--
${com.sun.aas.installRoot}/lib/install/applications/jmsra/imqjmsra.jar
${com.sun.aas.imqLib}/jaxm-api.jar
${com.sun.aas.imqLib}/fscontext.jar
${com.sun.aas.antLib}/ant.jar
Classpath Prefix:
--
${com.sun.aas.installRoot}/lib/driveradapter.jar
${com.sun.aas.installRoot}/lib/jdbcdrivers/driveradapter.jar
Classpath Suffix:
--
${com.sun.aas.installRoot}/lib/driveradapter.jar
${com.sun.aas.installRoot}/lib/jdbcdrivers/driveradapter.jar
PLEASE HELP!!
# 4
Hi!I can't say anything after looking at log, but try to add path to DB driver JAR file to CLASSPATH. Maybe it will help.Thanks,Roman.
Grif at 2007-7-7 3:41:16 >

# 5
i DID add it. to classpath prefix AND suffix. nothing works!
# 6
Hi!Did you do this for driveradapter.jar only or also for jar file of your DB. I am asking this because of I don't see anything concerning it in your post with JVM settings.Thanks,Roman.
Grif at 2007-7-7 3:41:16 >

# 7
thanks for the prompt replies!!i am not sure what you mean by jar file for DB. my DB is Oracle 10g. the only thing in classpath that ive done is add the paths for driveradapter.jar.what else can i do?thanks a lot!
# 8
Hi!
You should have drivers for work with your DB. Application Server which bundled with Creator contain such drivers, but they can be used only with server bundled with Creator. You have to have free drivers for your DB. AFAIK drivers for Oracle is ojdbc14.jar (or just ojdbc.jar). And You have to add it to CLASSPATH.
driveradapter.jar is only adapter between application and DB drivers.
Thanks,
Roman.
Grif at 2007-7-7 3:41:16 >

# 9
i did what you suggested and now i get a different error: Connection could not be allocated because: com.sun.sql.jdbc.oracle.OracleDriver
see page below:
================================================
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
com.sun.rave.web.ui.appbase.ApplicationException: javax.servlet.ServletException: java.lang.RuntimeException: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: com.sun.sql.jdbc.oracle.OracleDriver
com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.destroy(ViewHandlerImpl.java: 601)
com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.renderView(ViewHandlerImpl.ja va:316)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87 )
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:221)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja va:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
java.security.AccessController.doPrivileged(Native Method)
com.sun.rave.web.ui.util.UploadFilter.doFilter(UploadFilter.java:194)
================================================
thank you so much for all your help thus far!!
# 10
Hi!Did You configure JDBC resource for your application? You can find how it should be done here: http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/app serverdeploy.htmlThanks,Roman.
Grif at 2007-7-7 3:41:16 >

# 11
Hi,
your last stack trace looks like the app server found the driveradapter.jar, that's good.
But now it tries to use the automatically configured datasource information. But that works for Oracle only for appservers which have the license to use the Sun JDBC drivers:-( (The properties are different for the normal Oracle driver:-()
Now you have a couple of choices, I don't like any of them much:-(
* Use the normal Oracle drivers and configure your datasources by hand. Then you can give the JNDI name to Creator for the remote deployment. But, there are some bugs/limitations in the Oracle drivers which you might hit:-(
* Buy the Oracle drivers from DataDirect or i-net software. We test with the DataDirect drivers and they work as far as we know. I did some tests with the i-net drivers and I did not see any problem. But both drivers cost money and you still have to configure your datasources by hand.
* Install a complete JS Creator 2.1 on your remote system and use the bundled appserver. That bundle is licensed to use the Sun JDBC drivers. So all the automatic configuration should just work.
* Install a Sun Application Server 8.1 EE/SE (with the latest patches!!) on your remote system. Again, you get the license for the Sun JDBC drivers but you'll have to copy the driveradapter.jar.
I hope that helps.
Thanks,
-- Marco
mw46 at 2007-7-7 3:41:16 >

# 12
I did not need to set the JDBC properties. it seems like the remote deployment tool of JSC2 did all that automatically
# 13
Thanks mw46 for the comprehensive reply.
i will try installing JSC2 on the server PC and use its bundled application server. I will also try the DataDirect driver..
could you describe what i need to do use either the JSC2 bundled server or the DataDirect driver?
but all this seems too complicated for the simple task of deploying the web applications. none of these issues are mentioned in any of the tutorials about deployment.
# 14
When you use a JS Creator bundle on the remote PC, simply point the first JS Creator at the remote PE. All the drivers and the driveradapter should already be there. Do a remote deployment and it should work;-)
With the DataDirect drivers, you have to configure the JDBC Connection Pool and the JDBC Resource in the remote PE. Then you tell Creator to use custom JNDI resources and supply the JNDI names of theresources you created.
Why is it that complicated? Because pieces from different companies have to play together. The Oracle driver has some limitations with it's JDBC 3.0 implementation:-( We can bundle drivers with our stuff, but they come with their own license restrictions:-(
But the good news is, it looks like we found a way to work around the Oracle limitations for our NB5.5/VWP. But that's currently not going to help you here:-(
mw46 at 2007-7-7 3:41:16 >

# 15
it WORKS!thank you so much everyone.now all i have to do is figure out how to set up the server to accept connections from accross the internet. so far, i can only connect to the application on the from PCs connected to the same network.again, thank you!!