Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2005

Tip: Looking for answers? Try searching our database.

Unable to catch Exception

Thread view: 
Bruce Lee - 11 Nov 2005 12:24 GMT
How do you catch this error? It's not actually caught in the try{} but
deeper in the jffmpeg code. Would I need to look into jffmpeg or a way to
try and get this resource before starting the player?

void startPlayer(){
try{
       player = Manager.createRealizedPlayer(new java.net.URL(url));
         player.start();
        }catch(java.util.MissingResourceException rr){
       System.out.println("Missing Resource");
       return;
      }
}

throws.......

java.util.MissingResourceException: Can't find resource for bundle
java.util.Pro
pertyResourceBundle, key MJPG.JavaClass
       at java.util.ResourceBundle.getObject(ResourceBundle.java:326)
       at java.util.ResourceBundle.getString(ResourceBundle.java:286)
       at net.sourceforge.jffmpeg.JffmpegVideoFormat.getCodecClass(Unknown
Sour
ce)
       at net.sourceforge.jffmpeg.VideoDecoder.setInputFormat(Unknown
Source)
       at
com.sun.media.SimpleGraphBuilder.verifyInput(SimpleGraphBuilder.java:
923)
       at
com.sun.media.SimpleGraphBuilder.matches(SimpleGraphBuilder.java:888)

       at
com.sun.media.SimpleGraphBuilder.doBuildGraph(SimpleGraphBuilder.java
:322)
       at
com.sun.media.SimpleGraphBuilder.buildGraph(SimpleGraphBuilder.java:1
68)
       at
com.sun.media.SimpleGraphBuilder.buildGraph(SimpleGraphBuilder.java:8
4)
       at
com.sun.media.PlaybackEngine$PlayerTControl.buildTrack(PlaybackEngine
.java:2102)
       at com.sun.media.PlaybackEngine.doRealize1(PlaybackEngine.java:326)
       at com.sun.media.PlaybackEngine.doRealize(PlaybackEngine.java:300)
       at
com.sun.media.RealizeWorkThread.process(BasicController.java:1400)
       at
com.sun.media.StateTransitionWorkThread.run(BasicController.java:1339
)
Roedy Green - 11 Nov 2005 12:48 GMT
On Fri, 11 Nov 2005 12:24:27 GMT, "Bruce Lee"
<blah@blahbllbllahblah.com> wrote, quoted or indirectly quoted someone
who said :

>java.util.MissingResourceException: Can't find resource for bundle
>java.util.Pro
>pertyResourceBundle, key MJPG.JavaClass

Find the jar that contains this MJPG resource bundle and make sure it
is on the classpath, i.e. in the ext directory.

see http://mindprod.com/products1.html#JARLOOK

will help you find it.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Bruce Lee - 11 Nov 2005 14:11 GMT
> On Fri, 11 Nov 2005 12:24:27 GMT, "Bruce Lee"
> <blah@blahbllbllahblah.com> wrote, quoted or indirectly quoted someone
[quoted text clipped - 11 lines]
> will help you find it.
> --

I've got the jffmpeg jar in the class path, and looked through the unzipped
src. Can't find the uncatchable error though.
Roedy Green - 11 Nov 2005 14:32 GMT
On Fri, 11 Nov 2005 14:11:19 GMT, "Bruce Lee"
<blah@blahbllbllahblah.com> wrote, quoted or indirectly quoted someone
who said :

>I've got the jffmpeg jar in the class path, and looked through the unzipped
>src. Can't find the uncatchable error though.

please cut/paste your classpath here.

Note there must be no nugatory ; or :
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Bruce Lee - 11 Nov 2005 15:27 GMT
> On Fri, 11 Nov 2005 14:11:19 GMT, "Bruce Lee"
> <blah@blahbllbllahblah.com> wrote, quoted or indirectly quoted someone
[quoted text clipped - 6 lines]
>
> Note there must be no nugatory ; or :

I don't think it's a classpath issue -  I've unzipped the class tree
directly into my program directory. (I've also added the jar to the runtime
classpath -still the same)
E11 - 11 Nov 2005 15:32 GMT
Try catching Throwable and see what happens...

Regards,
Edwin
Babu Kalakrishnan - 11 Nov 2005 18:07 GMT
> Try catching Throwable and see what happens...

Dont think it'll help. From what the OP reported, it looked like the
library is catching the error already and printing out a stacktrace. I'd
think that one should be able to figure out the reason by looking at the
stacktrace . It most likely has to do with something missing in the
ResourceBundle - probably an entry that says MJPG.JavaClass = something

(Not having used the said library, I'm afraid I don't have any further
clues to help the OP)

BK
Babu Kalakrishnan - 11 Nov 2005 19:06 GMT
>> Try catching Throwable and see what happens...
>
[quoted text clipped - 6 lines]
> (Not having used the said library, I'm afraid I don't have any further
> clues to help the OP)

Sorry - ignore that. The problem isn't that the library is catching the
error, the exception is occurring in a different thread than where the
OP has the catch block.

BK
Roedy Green - 12 Nov 2005 04:14 GMT
On Fri, 11 Nov 2005 15:27:59 GMT, "Bruce Lee"
<blah@blahbllbllahblah.com> wrote, quoted or indirectly quoted someone
who said :

>I don't think it's a classpath issue -  I've unzipped the class tree
>directly into my program directory. (I've also added the jar to the runtime
>classpath -still the same)

By definition it is. The resource is not on your classpath.

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Oliver Wong - 11 Nov 2005 18:39 GMT
> How do you catch this error? It's not actually caught in the try{} but
> deeper in the jffmpeg code. Would I need to look into jffmpeg or a way to
[quoted text clipped - 47 lines]
> com.sun.media.StateTransitionWorkThread.run(BasicController.java:1339
> )

   You cannot catch this exception using the technique above. It's being
thrown in a different thread from the one in which the catch statement
occurs. Did you notice that your method, startPlayer(), is not even
mentioned in the stack trace?

<SSCCE>
import sun.reflect.generics.reflectiveObjects.NotImplementedException;

public class ThreadExceptionTest {
 public static void main(String args[]) {
   Thread thread = new Thread() {

     @Override
     public void run() {
       throw new NotImplementedException();
     }

   };

   try {
     thread.run();
   } catch (Throwable throwable) {
     System.out.println("Gotcha from run!");
   }

   try {
     thread.start();
   } catch (Throwable throwable) {
     System.out.println("Gotcha from start!");
   }
 }
}
</SSCCE>

   If you try to run this code, you'll notice that you can catch the first
throwable, but not the second.

   What you can do is try to wrap your player in your own thread. Something
like:

void startPlayer(){
 player = Manager.createRealizedPlayer(new java.net.URL(url));
 Thread thread = new Thread() {
   run() {
     try {
       player.run();
     } catch(java.util.MissingResourceException rr) {
       System.out.println("Missing Resource");
       return;
     }

   }
 }
}

   This assumes that player.start() has not been overridden, depending on
what class player actually is (I assume it's a subclass of Thread).

   - Oliver


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.