aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes Class name is wrong or classpath is not set    Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Class name is wrong or classpath is not set    " Watch "Class name is wrong or classpath is not set    " New topic
Author

Class name is wrong or classpath is not set

Siddhant Mahajan
Greenhorn

Joined: Jul 10, 2009
Posts: 2
Hi, i'm newbe in JDBC and i need somehelp here if it is possible.

I m using netbeans 6.5.1 with glassfish v2 server

The error showing is ::: Class name is wrong or classpath is not set for : com.microsoft.sql.jdbcx.sqlserver.SQLServerDataSource

this error is shown when i run the servlet file and is shown in the browser window
Sun resource shows ::
---------------------------------------------------
<resources>
<jdbc-resource enabled="true" jndi-name="jdbc/myDatasource" object-type="user" pool-name="connectionPool">
<description/>
</jdbc-resource>
<jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="auto-commit" datasource-classname="com.microsoft.sql.jdbcx.sqlserver.SQLServerDataSource" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="true" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" name="connectionPool" non-transactional-connections="false" pool-resize-quantity="2" res-type="javax.sql.DataSource" statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false">
<property name="URL" value="jdbc:sun:sqlserver://server_name[:portNumber];databaseName=database;selectMethod=cursor"/>
<property name="User" value="sa"/>
<property name="Password" value="niit"/>
<property name="databaseName" value="mydb1"/>
<property name="serverName" value="PCV"/>
<property name="portNumber" value="1437"/>
</jdbc-connection-pool>
</resources>

----------------------------------

And the servlet file is ::
-----------------------------------
package sp;

import java.io.;
*import javax.servlet.;
*import java.sql.;
*import javax.naming.;
*import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;

public class servlet2 extends HttpServlet {

protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet servlet2</title>");
out.println("</head>");
out.println("<body>");
try{
DataSource ds = null;
Context myc = new InitialContext();
ds = (DataSource) myc.lookup("jdbc/myDatasource");
Connection con = ds.getConnection();
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("Select prod_id from mytable1");
while(rs.next()){
out.println(rs.getString(1)"
");
}
}
catch(Exception e){
out.println("THE ERROR IS : " e);
}
out.println("</body>");
out.println("</html>");

} finally {
out.close();
}
}

--------------------------------------------
also i hv copied these files to the lib folder of glassfish server v2 and then set the class suffix as
$(com.sun.aas.installRoot)/lib/msbase.jar
$(com.sun.aas.installRoot)/lib/msutil.jar
$(com.sun.aas.installRoot)/lib/mssqlserver.jar.

in the glassfish server admin console
--------------------------------------------

could anyone please help me
i can mail the whole project if needed
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

Please be sure to ask IDE questions in the IDEs forum. I have moved this post there for you.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
wood burning stoves
 
subject: Class name is wrong or classpath is not set
 
Similar Threads
lass name is wrong or classpath is not set
Connecting jsp with derby
Tutorial PostgreSQL 8.3 on Glassfish V2.1 for ConnectionPool in Netbeans 6.5.1, WindowsXP (Post 3)
Error in allocating a connection. Cause: sun.jdbc.odbc.JdbcOdbcDriver cannot be cast to javax.sql.Da
just firt web service is working