Your "con" is null, my guess is your not getting a connection in your
linktomysql() and your swallowing the exception.

Paul

On 8/16/07, Max Gieselmann <[EMAIL PROTECTED]> wrote:
>
> Hey Carl!
> Thanks for your answer!
>
> I took a look at line 60. But I can't see any error.
>
> Line 60:  stmt = con.createStatement();
>
> stmt is declared as Statement stmt = null;
>
> con is linked to a funtion that connects to the mysql database as I wrote
> in my last mail.
> con = linktomysql();
>
> The whole function:
>
> public static String streamName(String sid) {
>   Connection con = null;
>   Statement stmt = null;
>   ResultSet rs = null;
>   String StreamName = "noname";
>
>
> try {
>        con = linktomysql();
>
>       stmt = con.createStatement();  //LINE 60 !!!
>
>
>       rs = stmt.executeQuery("SELECT `stream_name` FROM `eingeloggte_user`
> WHERE `sid`='"+sid+"'");
>       while ( rs.next() ){
>        StreamName = rs.getString(1);
>
>         }
>
>       rs.close();
>       stmt.close();
>       con.close();
>     }
>
>
>
>
>
>     catch ( SQLException e ){
>      e.printStackTrace();
>       System.exit(1);
>     }
>
>
>
>
>     return StreamName;
> }
>
>
>
> Thanks
> Max
>
> On 8/15/07, Carl Sziebert <[EMAIL PROTECTED]> wrote:
> >
> > Actually the exception is pointing to something else missing from your
> > application class:
> >
> > Caused by: java.lang.NullPointerException
> >         at video.application.streamName(application.java:60)
> >         ... 19 more
> >
> > Take a look at line 60 of application.java and make sure that all the
> > variables there have been initialized properly.
> >
> > Carl
> >
> > On 8/15/07, Max Gieselmann < [EMAIL PROTECTED]> wrote:
> > > Hey,
> > >
> > > I developed an application for red5 which connects to a Mysql database
> > and
> > > SELECTs a set of data. On my Windows PC everything works fine.
> > > I installed the mysql-connector-java-5.0.7-bin.jar. I made
> > > a directory called "lib" in the WEB-INF folder of my project and
> > copied the
> > > mysql-connector-java-5.0.7-bin.jar to this location.
> > >
> > > When I try to use the application on Linux it crashes with the
> > following
> > > error message:
> > >
> > > (streamName is a function of the application.java.)
> > > [ERROR] 498512 pool-3-thread-2:(
> > > org.red5.server.service.ServiceInvoker.invoke ) Error
> > > executing call: Service: null Method: streamName Num Params: 10:
> > > 08355b01d350a3467802eeea612fdbde
> > > [ERROR] 498517 pool-3-thread-2:(
> > > org.red5.server.service.ServiceInvoker.invoke ) Service
> > > invocation error
> > > java.lang.reflect.InvocationTargetException
> > >         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.red5.server.service.ServiceInvoker.invoke
> > > (ServiceInvoker.java:181)
> > >         at
> > > org.red5.server.service.ServiceInvoker.invoke (ServiceInvoker.java
> > :115)
> > >         at
> > > org.red5.server.net.rtmp.RTMPHandler.invokeCall(RTMPHandler.java:154)
> > >         at org.red5.server.net.rtmp.RTMPHandler.onInvoke
> > > (RTMPHandler.java:368)
> > >         at
> > > org.red5.server.net.rtmp.BaseRTMPHandler.messageReceived(
> > BaseRTMPHandler.java:143)
> > >         at
> > > org.red5.server.net.rtmp.RTMPMinaIoHandler.messageReceived(
> > RTMPMinaIoHandler.java:120)
> > >          at
> > >
> > org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageReceived
> > (AbstractIoFilterChain.java:703)
> > >         at
> > >
> > org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(
> > AbstractIoFilterChain.java
> > > :362)
> > >         at
> > > org.apache.mina.common.support.AbstractIoFilterChain.access$1100(
> > AbstractIoFilterChain.java:54)
> > >         at
> > >
> > org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(
> > AbstractIoFilterChain.java
> > > :800)
> > >         at
> > > org.apache.mina.filter.executor.ExecutorFilter.processEvent(
> > ExecutorFilter.java:247)
> > >         at
> > >
> > org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(
> > ExecutorFilter.java:307)
> > >         at
> > > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
> > ThreadPoolExecutor.java:650)
> > >         at
> > > java.util.concurrent.ThreadPoolExecutor$Worker.run(
> > ThreadPoolExecutor.java :675)
> > >         at java.lang.Thread.run(Thread.java :595)
> > > Caused by: java.lang.NullPointerException
> > >         at video.application.streamName(application.java:60)
> > >         ... 19 more
> > >
> > > I think java cannot find the mysql connector?
> > > Or do I connect in a wrong way?
> > >
> > >
> > > Some excerpts of my application.java ( I am not so advanced in
> > programming
> > > with java ;) ).
> > >
> > > import java.sql.*;
> > > [...]
> > >
> > > java.sql.Connection conn = null;
> > > try {
> > > Class.forName("com.mysql.jdbc.Driver ").newInstance();
> > > }
> > >
> > > [...]
> > >
> > > public static String streamName(String sid) {
> > >       rs = stmt.executeQuery("SELECT `stream_name` FROM
> > `eingeloggte_user`
> > > WHERE `sid`='"+sid+"'");
> > >       while ( rs.next () ){
> > >        StreamName = rs.getString(1);
> > >         }
> > >       rs.close();
> > >       stmt.close();
> > >       con.close();
> > > }
> > >
> > > [...]
> > > conn = java.sql.DriverManager.getConnection (
> > >  "jdbc:mysql://localhost/test?user=m_giesel&password=...");
> > >
> > > [...]
> > >
> > >
> > > Thanks!
> > > Max
> > >
> > > _______________________________________________
> > > Red5 mailing list
> > > [email protected]
> > > http://osflash.org/mailman/listinfo/red5_osflash.org
> > >
> > >
> >
> >
> > --
> > Be who you are and say what you feel, because those who mind don't
> > matter and those who matter don't mind.
> >   - Dr. Seuss
> >
> > _______________________________________________
> > Red5 mailing list
> > [email protected]
> > http://osflash.org/mailman/listinfo/red5_osflash.org
> >
>
>
> _______________________________________________
> Red5 mailing list
> [email protected]
> http://osflash.org/mailman/listinfo/red5_osflash.org
>
>


-- 
It is difficult to free fools from the chains they revere. - Voltaire
_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org

Reply via email to