[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 817
  • Last Modified:

connecting jsp running on tomcat on Linux server to msSQL server database

Dear experts,

I am running Tomcat 5.5.9 on a Linux Fedora server, I have web applications which suppose to connect to MSSQL Server database and get information. I downloaded and installed the driver to connect to the database. The driver is installed at: /opt/msSQLjdbc the jar files are in lib directory.
I copied the complete lib directory into my webapps/my_app/WEB-INF

When I run the application on the browser I receive the following error:
com.microsoft.jdbc.sqlserver.SQLServerDriver

The application does not load the driver from the line of code
// load the SQL driver
    Class.forName( "com.microsoft.jdbc.sqlserver.SQLServerDriver" );

I can’t figure out why.
On windows it all works fine without modifying the CLASSPATH.

Does any one know the source of the problem?

Thanks,

Jon
0
tmpllc
Asked:
tmpllc
  • 11
  • 6
  • 5
  • +1
2 Solutions
 
tmpllcAuthor Commented:
I just found out that I need to restart the server after loading the jar files into the bin directory of my application.
Who knows how to restart the tomcat 5.5.9 server on linux ?

That's an easy one... I hope.

Thanks,

Jon
0
 
KuldeepchaturvediCommented:
go to /tomcat5.5.9/bin and run shutdown.sh
0
 
tmpllcAuthor Commented:
I run the shutdown command and got the following error:

[root@localhost bin]# ./shutdown.sh
Using CATALINA_BASE:   /tomcat/jakarta-tomcat-5.5.9
Using CATALINA_HOME:   /tomcat/jakarta-tomcat-5.5.9
Using CATALINA_TMPDIR: /tomcat/jakarta-tomcat-5.5.9/temp
Using JRE_HOME:       /usr/java/jre1.5.0_02
Apr 22, 2005 6:42:03 AM org.apache.catalina.startup.Catalina stopServer
SEVERE: Catalina.stop:
java.net.ConnectException: Connection refused
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(Unknown Source)
        at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
        at java.net.PlainSocketImpl.connect(Unknown Source)
        at java.net.SocksSocketImpl.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at java.net.Socket.<init>(Unknown Source)
        at java.net.Socket.<init>(Unknown Source)
        at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:394)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:320)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:411)

Any idea ?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
KuldeepchaturvediCommented:
that means you do not have it running to stop it....
it was already shut down..
the start command is startup.sh
0
 
tmpllcAuthor Commented:
It must be started and running.
I can view my jsp webpages when going to the webaddress.

Jon
0
 
SibishCommented:
Hi,

I hope the terminal running the tomcat is open. Then press an enter key on the terminal and then type
shutdown.sh. Try this out.

Thanks and Regards,
Sibish.K.Abraham
0
 
tmpllcAuthor Commented:
The terminal is open, I tried what pressing the Enter and shutdown.sh
Still did not work.
So I restarted the Linux computer.
But now I can not view the tomcat homepage at all, can't find the server.
I tried to run startup.sh to run the tomcat server, the result I get is as follow:
[root@localhost bin]# ./startup.sh
Using CATALINA_BASE:   /tomcat/jakarta-tomcat-5.5.9
Using CATALINA_HOME:   /tomcat/jakarta-tomcat-5.5.9
Using CATALINA_TMPDIR: /tomcat/jakarta-tomcat-5.5.9/temp
Using JRE_HOME:       /usr/java/jdk1.5.0_02

any one have idea why I can't view the tomcat ?
I was able to view it before I restarted the Linux...

Thanks
0
 
TimYatesCommented:
look in tomcat/logs/catalina.out

I reckon you've got a port confilct going on...

Tim
0
 
KuldeepchaturvediCommented:
>>reckon you've got a port confilct going on...
if that was the case then Tomcat wdn't have even started right?? it would have given a bind exception..

can it be a authority problem???
0
 
TimYatesCommented:
>> it would have given a bind exception..

Yeah...in the log files...  I don't think it would give the exception at the prompt...
0
 
tmpllcAuthor Commented:
Here is the end of my file catalina.out file
I'm not sure what the problem is ???

LifecycleException:  Protocol handler start failed: java.net.BindException: Address already in use:8080
        at org.apache.catalina.connector.Connector.start(Connector.java:1003)
        at org.apache.catalina.core.StandardService.start(StandardService.java:459)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
Apr 22, 2005 11:41:09 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1745 ms
Apr 22, 2005 11:41:09 PM org.apache.catalina.core.StandardServer await
SEVERE: StandardServer.await: create[8005]:
java.net.BindException: Address already in use
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
        at java.net.ServerSocket.bind(ServerSocket.java:319)
        at java.net.ServerSocket.<init>(ServerSocket.java:185)
        at org.apache.catalina.core.StandardServer.await(StandardServer.java:346)
        at org.apache.catalina.startup.Catalina.await(Catalina.java:600)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:560)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
Apr 22, 2005 11:41:10 PM org.apache.coyote.http11.Http11Protocol pause
INFO: Pausing Coyote HTTP/1.1 on http-8080
Apr 22, 2005 11:41:10 PM org.apache.catalina.connector.Connector pause
SEVERE: Protocol handler pause failed
java.lang.NullPointerException
        at org.apache.jk.server.JkMain.pause(JkMain.java:675)
        at org.apache.jk.server.JkCoyoteHandler.pause(JkCoyoteHandler.java:209)
        at org.apache.catalina.connector.Connector.pause(Connector.java:943)
        at org.apache.catalina.core.StandardService.stop(StandardService.java:491)
        at org.apache.catalina.core.StandardServer.stop(StandardServer.java:717)
        at org.apache.catalina.startup.Catalina.stop(Catalina.java:586)
        at org.apache.catalina.startup.Catalina$CatalinaShutdownHook.run(Catalina.java:629)
Apr 22, 2005 11:41:11 PM org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
Apr 22, 2005 11:41:11 PM org.apache.catalina.connector.MapperListener destroy
WARNING: Error unregistering MBeanServerDelegate
java.lang.NullPointerException
        at org.apache.catalina.connector.MapperListener.destroy(MapperListener.java:161)
        at org.apache.catalina.connector.Connector.stop(Connector.java:1044)
        at org.apache.catalina.core.StandardService.stop(StandardService.java:521)
        at org.apache.catalina.core.StandardServer.stop(StandardServer.java:717)
        at org.apache.catalina.startup.Catalina.stop(Catalina.java:586)
        at org.apache.catalina.startup.Catalina$CatalinaShutdownHook.run(Catalina.java:629)
Apr 22, 2005 11:41:11 PM org.apache.coyote.http11.Http11Protocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080
Apr 22, 2005 11:41:11 PM org.apache.catalina.connector.Connector stop
SEVERE: Coyote connector has not been started
0
 
KuldeepchaturvediCommented:
>>java.net.BindException: Address already in use:8080
:-) thats what me and Tim are saying..
your address 8080 is already in use..
there are two possibilities.. either tomcat is already up & running or there is something else who is using port 8080.. I reckon  first option has a higher priority..
0
 
TimYatesCommented:
I reckon (as you are running Linux) that the standard Httpd install is on port 8080

OR you are running JBoss or something...

edit server.xml  change "8080" to "1024"

then start Tomcat

and go to http://localhost:1024

Tim.
0
 
tmpllcAuthor Commented:
what does reckon mean, how do I do that ?

Jon
0
 
TimYatesCommented:
open up

    tomcat/conf/server.xml

search for 8080

replace with 1024

save file

start tomcat

go to http://localhost:8080

OR

Do:

    netstat -ap

and look for the process that's using port 8080, and kill it ;-)
0
 
TimYatesCommented:
>> go to http://localhost:8080

I mean:

   go to http://localhost:1024

sorry...
0
 
tmpllcAuthor Commented:
I am running only the tomcat 5.5.9 from apache on Linux fedora

Jon
0
 
TimYatesCommented:
Yeah, but something else is running on port 8080

so tomcat can't "bind" to it...
0
 
tmpllcAuthor Commented:
I changed the server.xml from port 8080 to 1024 , didn't work for me.
I changed to 8000 I run shutdown.sh and then startup.sh and still doesn't work.
I'm working from a remote computer to a server.
When I try to view the file I go to http://192.168.0.122:8000
still nothing...
Here is my netstat -ap result  

[root@localhost bin]# netstat -ap
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 localhost.localdo:32769 *:*                     LISTEN      1924/xinetd
tcp        0      0 *:mysql                 *:*                     LISTEN      2019/mysqld-max
tcp        0      0 localhost.localdoma:783 *:*                     LISTEN      1962/spamd -d -c -a
tcp        0      0 *:sunrpc                *:*                     LISTEN      1551/portmap
tcp        0      0 *:ftp                   *:*                     LISTEN      2508/vsftpd
tcp        0      0 localhost.localdoma:ipp *:*                     LISTEN      1702/cupsd
tcp        0      0 localhost.localdom:smtp *:*                     LISTEN      1942/sendmail: acce
tcp        0      0 192.168.0.122:ftp       192.168.0.137:4266      ESTABLISHED 2511/vsftpd
tcp        0      0 *:8000                  *:*                     LISTEN      2739/java
tcp        0      0 localhost:8005          *:*                     LISTEN      2739/java
tcp        0      0 *:8009                  *:*                     LISTEN      2739/java
tcp        0      0 *:http                  *:*                     LISTEN      2483/httpd
tcp        0      0 *:ssh                   *:*                     LISTEN      1911/sshd
tcp        0      0 ::ffff:192.168.0.12:ssh ::ffff:192.168.0.1:4373 ESTABLISHED 2544/1
udp        0      0 *:32768                 *:*                                 1570/rpc.statd
udp        0      0 *:898                   *:*                                 1570/rpc.statd
udp        0      0 *:bootpc                *:*                                 1470/dhclient
udp        0      0 *:sunrpc                *:*                                 1551/portmap
udp        0      0 *:ipp                   *:*                                 1702/cupsd
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags       Type       State         I-Node PID/Program name    Path
unix  2      [ ACC ]     STREAM     LISTENING     3080   1971/gpm            /dev/gpmctl
unix  2      [ ACC ]     STREAM     LISTENING     3147   2024/xfs            /tmp/.font-unix/fs7100
unix  2      [ ACC ]     STREAM     LISTENING     2811   1691/acpid          /var/run/acpid.socket
unix  2      [ ACC ]     STREAM     LISTENING     3166   2019/mysqld-max     /var/lib/mysql/mysql.sock
unix  2      [ ACC ]     STREAM     LISTENING     3194   2054/dbus-daemon-1  /var/run/dbus/system_bus_socket
unix  12     [ ]         DGRAM                    2525   1520/syslogd        /dev/log
unix  2      [ ]         DGRAM                    3921   2511/vsftpd
unix  3      [ ]         DGRAM                    3918   2511/vsftpd
unix  3      [ ]         DGRAM                    3917   2511/vsftpd
unix  2      [ ]         DGRAM                    3151   2024/xfs
unix  2      [ ]         DGRAM                    3098   1981/crond
unix  2      [ ]         DGRAM                    3079   1971/gpm
unix  2      [ ]         DGRAM                    3061   1962/spamd -d -c -a
unix  2      [ ]         DGRAM                    3043   1951/clientmqueue
unix  2      [ ]         DGRAM                    3026   1942/sendmail: acce
unix  2      [ ]         DGRAM                    2971   1924/xinetd
unix  2      [ ]         DGRAM                    2591   1570/rpc.statd
unix  2      [ ]         DGRAM                    2535   1524/klogd
unix  2      [ ]         STREAM     CONNECTED     2422   1470/dhclient
0
 
KuldeepchaturvediCommented:
your netstat says that you are listenin at 8000

tcp        0      0 *:8000                  *:*                     LISTEN      2739/java

so http://machineip:8080 shd return the tomcat home page..
0
 
tmpllcAuthor Commented:

you mean http://machineip:8000

still can't see the tomcat homepage not on http://machineip:8000 or on http://machineip:8080
It was working before I started the Linux server.

Jon
0
 
tmpllcAuthor Commented:
Problem solved.
The firewall was enabled therefore I couldn't see the webpages.
0
 
tmpllcAuthor Commented:
Thank you guys for the help

Jon
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 11
  • 6
  • 5
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now