Tuesday, June 23, 2009

Oracle Driver Missing for Reports

Check Oracle Driver Missing Info

1. java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
Hi everybody

I'm new in java Platform and i have problems trying to load a JDBC driver using Class.forname, but JVM can not find it. I configured classpath enviroment path pointig to libraries

OS: Windows XP
Java Version 1.6
IDE Eclipse 3.2.2

classpath = .;C:\Program Files\Altova\xmlspy\XMLSpyInterface.jar;c:\program files\Microsoft SQL Server 2000 Driver for JDBC\lib\msbase.jar;c:\program files\Microsoft SQL Server 2000 Driver for JDBC\lib\msutil.jar;c:\program files\Microsoft SQL Server 2000 Driver for JDBC\lib\mssqlserver.jar;D:\oracle\ora92\jdbc\lib\ classes12.zip


java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at bpos.Db.Conectar(Db.java:20)
at bpos.Process.main(Process.java:19)


Can anybody help me about this? It will appreciate.

Leo


2. Hello Leo,

Try putting the full path to the Oracle classes12.zip file at the front of the CLASSPATH. Also remove the extra space between the \ and classes12.zip.

Before you test with an app, ensure the driver returns version information by running this command on the command line:

java oracle.jdbc.driver.OracleDriver

If that command does not work, you still have environment problems and need to revisit before you test with the app.

Best regards,
Netrista Khatam
Technical Services Manager
OpenLink Product Support


3. Hi Netrista.. thank you for your help.. I checked my enviroment variables and i didn't find problems. I think that was copy paste mistake. I put first the oracle driver library reference into the classpath enviroment variable

C:\>echo %classpath%
.;D:\oracle\ora92\jdbc\lib\classes12.zip;C:\Progra m Files\Altova\xmlspy\XMLSpyInterface.jar;c:\program files\Microsoft SQL Server 2000 Driver for JDBC\lib\msbase.jar;c:\program files\Microsoft SQL Server 2000 Driver for JDBC\lib\msutil.jar;c:\program files\Microsoft SQL Server 2000 Driver for JDBC\lib\mssqlserver.jar

I performed your suggested command and i couldn't get the version of each class i'm trying to use

C:\>java oracle.jdbc.driver.OracleDriver
Exception in thread "main" java.lang.NoSuchMethodError: main

C:\>java com.microsoft.jdbc.sqlserver.SQLServerDriver
null

any other thing that it could be used? thanks!

Leo


4. Hello Leo,

This is what I would recommend:

1. Verify that the following path is correct:

D:\oracle\ora92\jdbc\lib\classes12.zip

2. Insure no permissions issues exist on that file or directory structure, which is unlikely since it is Windows.

3. Run this command to get your java version:

java -version

4. Insure that the java version of the JVM/JDK that you have installed on Windows is compatible with the requirements of the driver.

Can you state whether or not you can use the other JDBC drivers to get a connection using the application, even though they error on the commandline with DOS. I've seen that before, so it's important to ascertain whether the app connectivity issue is specific to Oracle or generalized to all JDBC connections.


Best regards,
Netrista Khatam
Technical Services Manager
OpenLink Product Support

5. Fixed!
Thank you very much.

The classpath was correct. I proved on command line and it worked correctly. So i have to change my approach looking for into my IDE project definition parameters. I' m using Eclipse and i found that i have to define a classpath for the project.

Ups! I'm new in Eclipse too.. and i forgot mention it. Your description of the solution helped me to find the final solution. Thank you!

Leo


Quote:

Try putting the full path to the Oracle classes12.zip file at the front of the CLASSPATH. Also remove the extra space between the \ and classes12.zip.

Before you test with an app, ensure the driver returns version information by running this command on the command line:

java oracle.jdbc.driver.OracleDriver

If that command does not work, you still have environment problems and need to revisit before you test with the app.

Best regards,
Netrista Khatam
Technical Services Manager
OpenLink Product Support

Tuesday, June 9, 2009

Customize JBoss log file size

Customize JBoss log file size


Some of the logging configuration changes that you might want to make include:
• Specifying a rolling log file.
• Limiting the amount of logging produced.
• Adding logging for your application.
• Defining a new log file.


Each of these topics is covered in the following text.

Rolling the server log file
The server.log file is created new each time the server is launched, and grows until the server is stopped, or until midnight. This behavior, while appropriate for a development environment, is not optimal for a production environment. In production you should specify a rolling log file, which when it reaches a certain size creates a new log file. Listing 1 shows how you can change the appender for the server.log file to create at most 20 log files of 10 megabytes (MB) in size each. All of the changes are highlighted.

Listing 1 Defining a rolling log appender

01.<log4j:...>
02. <appender name="FILE"
03. class="org.jboss.logging.appender.RollingFileAppender"> #1
04. <errorHandler .../>
05. <param name="File" value="${jboss.server.log.dir}/server.log"/> #2
06. <param name="Append" value="true"/> #3
07. <param name="MaxFileSize" value="10MB"/> #4
08. <param name="MaxBackupIndex" value="20"/> #5
09. <layout .../>
10. appender>
11. ...
12.log4j>

#1: Changed to use the rolling appender
#2: Location of log file
#3: Append to existing file on startup
#4: Limit log file size to 10MB
#5: Keep only the last 20 log files

We did not change the errorHandler or layout settings from the default. By the way, the various appenders defined in the org.jboss.logging.appender package are simple subclasses of the Log4J appenders defined in the org.apache.log4j package that automatically create the server/xxx/log directory.
The system property jboss.server.log.dir defines the location of the log file (#2).