Hello,
I have a mpeg player based on JMF, which runs well as a standalong
application under linux using the Linux Performance pack. However, it
fails when I tried to run it through web start. It looks like WS cannot
load the native libraries properly. I got error message claiming the
"com.sun.media.codec.video.jmpx.Jmpx" cannot be found. Following are the
JNLP file, corresponding error message, and source codes. Can anyone help?
thanks a lot.
<?xml version="1.0" encoding="utf-8"?>
<!-- JNLP File for test launch of Firewall app -->
<jnlp spec="1.0+"
codebase="file:///home/users/examples/WebStar"href="webplayer.jnlp">
<information>
<title>Testing Local Player</title>
<vendor>WebPlayer</vendor>
<homepage href="index.html"/>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.4.1+"
href="http://java.sun.com/products/autodl/j2se"/>
<jar href="lib/MpegDisplayFrame.jar"/>
</resources>
<resources os="Linux">
<j2se href="http://java.sun.com/products/autodl/j2se" version="1.4+"
initial-heap-size="100M" max-heap-size="200M"/>
<jar href="lib/jmf.jar"/>
<jar href="lib/mediaplayer.jar"/>
<jar href="lib/multiplayer.jar"/>
<jar href="lib/jmf.properties.jar"/>
<jar href="lib/jmf.properties.orig.jar"/>
<nativelib href="lib/jmf-linux-native.jar"/>
</resources>
<application-desc main-class="MpegDisplayFrame" />
</jnlp>
Here is the error log I got.
------------------------------------------------------
Unexpected Signal : 11 occurred at PC=0x401E8180
Function=(null)+0x401E8180
Library=/usr/local/j2sdk1.4.2_07/jre/lib/i386/client/libjvm.so
NOTE: We are unable to locate the function name symbol for the error
just occurred. Please refer to release documentation for possible
reason and solutions.
Current Java thread:
at com.sun.media.codec.video.jmpx.Jmpx.initMPX(Native Method)
at com.sun.media.codec.video.jmpx.Jmpx.doPrefetch(Jmpx.java:670)
at com.sun.media.PrefetchWorkThread.process(BasicController.java:1430)
at
com.sun.media.StateTransitionWorkThread.run(BasicController.java:1339)
Dynamic libraries:
08048000-08056000 r-xp 00000000 03:02 476929
/usr/local/j2sdk1.4.2_07/jre/bin/java
08056000-08059000 rw-p 0000d000 03:02 476929
/usr/local/j2sdk1.4.2_07/jre/bin/java
40000000-40015000 r-xp 00000000 03:02 525170 /lib/ld-2.3.2.so
40015000-40016000 rw-p 00015000 03:02 525170 /lib/ld-2.3.2.so
40017000-4001f000 r-xp 00000000 03:02 182015
/usr/local/j2sdk1.4.2_07/jre/lib/i386/native_threads/libhpi.so
4001f000-40020000 rw-p 00007000 03:02 182015
/usr/local/j2sdk1.4.2_07/jre/lib/i386/native_threads/libhpi.so
40020000-40024000 rw-s 00000000 03:02 197549
/tmp/hsperfdata_chuli/15808
40025000-40030000 r-xp 00000000 03:02 819267
/lib/tls/libpthread-0.34.so
40030000-40031000 rw-p 0000a000 03:02 819267
/lib/tls/libpthread-0.34.so
40033000-40036000 r-xp 00000000 03:02 524368 /lib/libdl-2.3.2.so
40036000-40037000 rw-p 00002000 03:02 524368 /lib/libdl-2.3.2.so
40038000-40436000 r-xp 00000000 03:02 182017
/usr/local/j2sdk1.4.2_07/jre/lib/i386/client/libjvm.so
40436000-40452000 rw-p 003fd000 03:02 182017
/usr/local/j2sdk1.4.2_07/jre/lib/i386/client/libjvm.so
40464000-40476000 r-xp 00000000 03:02 524372 /lib/libnsl-2.3.2.so
40476000-40477000 rw-p 00011000 03:02 524372 /lib/libnsl-2.3.2.so
40479000-4049a000 r-xp 00000000 03:02 819265 /lib/tls/libm-2.3.2.so
4049a000-4049b000 rw-p 00020000 03:02 819265 /lib/tls/libm-2.3.2.so
4049b000-4049e000 r--s 00000000 03:02 706307
/usr/local/j2sdk1.4.2_07/jre/lib/ext/dnsns.jar
4049e000-404a5000 r-xp 00000000 03:02 49544 /usr/X11R6/lib/libXp.so.6.2
404a5000-404a6000 rw-p 00006000 03:02 49544 /usr/X11R6/lib/libXp.so.6.2
404a6000-404a7000 r-xp 00000000 03:02 280314
/usr/X11R6/lib/X11/locale/lib/common/xlcUTF8Load.so.2
404a7000-404a8000 rw-p 00000000 03:02 280314
/usr/X11R6/lib/X11/locale/lib/common/xlcUTF8Load.so.2
404a9000-404b4000 r-xp 00000000 03:02 524378 /lib/libnss_files-2.3.2.so
404b4000-404b5000 rw-p 0000a000 03:02 524378 /lib/libnss_files-2.3.2.so
404b5000-404c5000 r-xp 00000000 03:02 558851
/usr/local/j2sdk1.4.2_07/jre/lib/i386/libverify.so
404c5000-404c7000 rw-p 0000f000 03:02 558851
/usr/local/j2sdk1.4.2_07/jre/lib/i386/libverify.so
404c7000-404e7000 r-xp 00000000 03:02 558852
/usr/local/j2sdk1.4.2_07/jre/lib/i386/libjava.so
404e7000-404e9000 rw-p 0001f000 03:02 558852
/usr/local/j2sdk1.4.2_07/jre/lib/i386/libjava.so
404e9000-404fd000 r-xp 00000000 03:02 558854
/usr/local/j2sdk1.4.2_07/jre/lib/i386/libzip.so
404fd000-40500000 rw-p 00013000 03:02 558854
/usr/local/j2sdk1.4.2_07/jre/lib/i386/libzip.so
40500000-41ea9000 r--s 00000000 03:02 558924
/usr/local/j2sdk1.4.2_07/jre/lib/rt.jar
41ef3000-41f09000 r--s 00000000 03:02 558876
/usr/local/j2sdk1.4.2_07/jre/lib/sunrsasign.jar
41f09000-41fe6000 r--s 00000000 03:02 558921
/usr/local/j2sdk1.4.2_07/jre/lib/jsse.jar
41fe6000-41ff7000 r--s 00000000 03:02 558877
/usr/local/j2sdk1.4.2_07/jre/lib/jce.jar
41ff7000-41ffb000 r-xp 00000000 03:02 49554
/usr/X11R6/lib/libXtst.so.6.1
41ffb000-41ffc000 rw-p 00004000 03:02 49554
/usr/X11R6/lib/libXtst.so.6.1
41ffc000-41fff000 r--s 00000000 03:02 821120
/home/chuli/.java/.deployment/javaws/cache/file/D/P-1/DMhome/DMchuli/DMexamples
/DMWebStar/DMlib/RMMpegDisplayFrame.jar
42000000-42130000 r-xp 00000000 03:02 819246 /lib/tls/libc-2.3.2.so
42130000-42133000 rw-p 00130000 03:02 819246 /lib/tls/libc-2.3.2.so
42136000-4268f000 r--s 00000000 03:02 558922
/usr/local/j2sdk1.4.2_07/jre/lib/charsets.jar
4268f000-427ae000 r--s 00000000 03:02 16663
/usr/local/j2sdk1.4.2_07/jre/javaws/javaws.jar
44856000-4485e000 r-xp 00000000 03:02 49518 /usr/X11R6/lib/libSM.so.6.0
4485e000-4485f000 rw-p 00007000 03:02 49518 /usr/X11R6/lib/libSM.so.6.0
4ca63000-4cc63000 r--p 00000000 03:02 462632
/usr/lib/locale/locale-archive
4ce67000-4ce83000 r--s 00000000 03:02 706306
/usr/local/j2sdk1.4.2_07/jre/lib/ext/sunjce_provider.jar
4ce83000-4ce90000 r--s 00000000 03:02 706309
/usr/local/j2sdk1.4.2_07/jre/lib/ext/ldapsec.jar
4ce90000-4cf4c000 r--s 00000000 03:02 706337
/usr/local/j2sdk1.4.2_07/jre/lib/ext/localedata.jar
4cf4c000-4cf64000 r--s 00000000 03:02 16564
/usr/local/j2sdk1.4.2_07/jre/javaws/javaws-l10n.jar
4cf64000-4d235000 r-xp 00000000 03:02 558862
/usr/local/j2sdk1.4.2_07/jre/lib/i386/libawt.so
4d235000-4d24b000 rw-p 002d0000 03:02 558862
/usr/local/j2sdk1.4.2_07/jre/lib/i386/libawt.so
4d270000-4d2c3000 r-xp 00000000 03:02 558861
/usr/local/j2sdk1.4.2_07/jre/lib/i386/libmlib_image.so
4d2c3000-4d2c4000 rw-p 00052000 03:02 558861
/usr/local/j2sdk1.4.2_07/jre/lib/i386/libmlib_image.so
4d2c4000-4d2ca000 r--s 00000000 03:02 229628
/usr/lib/gconv/gconv-modules.cache
4d2ca000-4d2d1000 r-xp 00000000 03:02 49550
/usr/X11R6/lib/libXrender.so.1.2.2
4d2d1000-4d2d2000 rw-p 00006000 03:02 49550
/usr/X11R6/lib/libXrender.so.1.2.2
4d2d2000-4d320000 r-xp 00000000 03:02 49552 /usr/X11R6/lib/libXt.so.6.0
4d320000-4d324000 rw-p 0004d000 03:02 49552 /usr/X11R6/lib/libXt.so.6.0
4d324000-4d331000 r-xp 00000000 03:02 49530
/usr/X11R6/lib/libXext.so.6.4
4d331000-4d332000 rw-p 0000c000 03:02 49530
/usr/X11R6/lib/libXext.so.6.4
4d332000-4d40e000 r-xp 00000000 03:02 49520
/usr/X11R6/lib/libX11.so.6.2
4d40e000-4d411000 rw-p 000db000 03:02 49520
/usr/X11R6/lib/libX11.so.6.2
4d411000-4d425000 r-xp 00000000 03:02 49514
/usr/X11R6/lib/libICE.so.6.3
4d425000-4d426000 rw-p 00013000 03:02 49514
/usr/X11R6/lib/libICE.so.6.3
4d428000-4d4e2000 r-xp 00000000 03:02 558865
/usr/local/j2sdk1.4.2_07/jre/lib/i386/libfontmanager.so
4d4e2000-4d4fd000 rw-p 000b9000 03:02 558865
/usr/local/j2sdk1.4.2_07/jre/lib/i386/libfontmanager.so
4d4fe000-4d508000 r--s 00000000 03:02 821257
/home/chuli/.java/.deployment/javaws/cache/file/D/P-1/DMhome/DMchuli/DMexamples
/DMWebStar/DMlib/RMmediaplayer.jar
4d508000-4d50a000 r--s 00000000 03:02 821263
/home/chuli/.java/.deployment/javaws/cache/file/D/P-1/DMhome/DMchuli/DMexamples
/DMWebStar/DMlib/RMjmf.properties.jar
4d50a000-4d50c000 r--s 00000000 03:02 821266
/home/chuli/.java/.deployment/javaws/cache/file/D/P-1/DMhome/DMchuli/DMexamples
/DMWebStar/DMlib/RMjmf.properties.orig.jar
4d50c000-4d514000 r-xp 00000000 03:02 49528
/usr/X11R6/lib/libXcursor.so.1.0
4d514000-4d515000 rw-p 00007000 03:02 49528
/usr/X11R6/lib/libXcursor.so.1.0
4d515000-4d531000 r-xp 00000000 03:02 279198
/usr/X11R6/lib/X11/locale/lib/common/ximcp.so.2
4d531000-4d533000 rw-p 0001c000 03:02 279198
/usr/X11R6/lib/X11/locale/lib/common/ximcp.so.2
4d839000-4d849000 r-xp 00000000 03:02 558857
/usr/local/j2sdk1.4.2_07/jre/lib/i386/libnet.so
4d849000-4d84a000 rw-p 0000f000 03:02 558857
/usr/local/j2sdk1.4.2_07/jre/lib/i386/libnet.so
4d84a000-4da16000 r--s 00000000 03:02 821169
/home/chuli/.java/.deployment/javaws/cache/file/D/P-1/DMhome/DMchuli/DMexamples
/DMWebStar/DMlib/RMjmf.jar
4db99000-4dba8000 r--s 00000000 03:02 821260
/home/chuli/.java/.deployment/javaws/cache/file/D/P-1/DMhome/DMchuli/DMexamples
/DMWebStar/DMlib/RMmultiplayer.jar
4dba8000-4dbb1000 r-xp 00000000 03:02 952219
/home/chuli/JMF-Linux/JMF-2.1.1e/lib/libjmutil.so
4dbb1000-4dbb2000 rw-p 00009000 03:02 952219
/home/chuli/JMF-Linux/JMF-2.1.1e/lib/libjmutil.so
4dbb4000-4dbd8000 r-xp 00000000 03:02 952218
/home/chuli/JMF-Linux/JMF-2.1.1e/lib/libjmmpx.so
4dbd8000-4dbda000 rw-p 00023000 03:02 952218
/home/chuli/JMF-Linux/JMF-2.1.1e/lib/libjmmpx.so
Heap at VM Abort:
Heap
def new generation total 576K, used 154K [0x44860000, 0x44900000,
0x44d40000)
eden space 512K, 28% used [0x44860000, 0x448849d8, 0x448e0000)
from space 64K, 12% used [0x448e0000, 0x448e2048, 0x448f0000)
to space 64K, 0% used [0x448f0000, 0x448f0000, 0x44900000)
tenured generation total 3244K, used 2344K [0x44d40000, 0x4506b000,
0x48860000)
the space 3244K, 72% used [0x44d40000, 0x44f8a1c0, 0x44f8a200,
0x4506b000)
compacting perm gen total 8704K, used 8504K [0x48860000, 0x490e0000,
0x4c860000)
the space 8704K, 97% used [0x48860000, 0x490ae010, 0x490ae200,
0x490e0000)
Local Time = Tue Apr 12 15:00:36 2005
Elapsed Time = 11
#
# HotSpot Virtual Machine Error : 11
# Error ID : 4F530E43505002EF
# Please report this error at
# http://java.sun.com/cgi-bin/bugreport.cgi
#
# Java VM: Java HotSpot(TM) Client VM (1.4.2_07-b05 mixed mode)
#
the codes are: MpegDisplayFrame.java
import javax.media.*;
import com.sun.media.ui.*;
import javax.media.protocol.*;
import javax.media.protocol.DataSource;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.io.*;
import java.util.Vector;
public class MpegDisplayFrame extends JFrame {
/*************************************************************************
* MAIN PROGRAM / STATIC METHODS
*************************************************************************/
public static void main(String args[]) {
MpegDisplayFrame myMpegDisplayFrame = new MpegDisplayFrame();
}
static void Fatal(String s) {
MessageBox mb = new MessageBox("JMF Error", s);
}
/*************************************************************************
* VARIABLES
*************************************************************************/
JMFrame jmframe = null;
JPanel panel;
JFileChooser chooser = null;
CheckboxMenuItem cbAutoLoop = null;
Player player = null;
//Player newPlayer = null;
String filename;
/*************************************************************************
* METHODS
*************************************************************************/
public MpegDisplayFrame() {
super("Farsight Video Player");
// Add the desktop pane
getContentPane().setLayout( new BorderLayout() );
panel = new JPanel();
panel.setDoubleBuffered(true);
getContentPane().add(panel);
setMenuBar(createMenuBar());
setSize(320, 240);
setVisible(true);
setBackground(Color.white);
setDefaultLookAndFeelDecorated(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Manager.setHint(Manager.LIGHTWEIGHT_RENDERER, new Boolean(true));
}
private MenuBar createMenuBar() {
MenuItem item;
MenuBar mb = new MenuBar();
Menu mnFile = new Menu("File");
mnFile.add(item = new MenuItem("Open"));
item.addActionListener(new MpegDisplayEventHandler("open"));
//mnFile.add(item = new MenuItem("Close"));
//item.addActionListener(new MpegDisplayEventHandler("close"));
mnFile.addSeparator();
mnFile.add(item = new MenuItem("Exit"));
item.addActionListener(new MpegDisplayEventHandler("exit"));
// Options Menu
Menu mnOptions = new Menu("Options");
cbAutoLoop = new CheckboxMenuItem("Auto replay");
cbAutoLoop.setState(true);
mnOptions.add(cbAutoLoop);
mb.add(mnFile);
mb.add(mnOptions);
return mb;
}
/**
* Open a media file.
*/
public void openFile(String filename) {
String mediaFile = filename;
Player player = null;
// URL for our media file
URL url = null;
try {
// Create an url from the file name and the url to the
// document containing this applet.
if ((url = new URL(mediaFile)) == null) {
Fatal("Can't build URL for " + mediaFile);
return;
}
// Create an instance of a player for this media
try {
player = Manager.createPlayer(url);
} catch (NoPlayerException e) {
Fatal("Error: " + e);
}
} catch (MalformedURLException e) {
Fatal("Error:" + e);
} catch (IOException e) {
Fatal("Error:" + e);
}
if (player != null) {
this.filename = filename;
System.out.println("open file name = " + filename);
JMFrame jmframe = new JMFrame(player, filename);
panel.add(jmframe);
}
}
private class MpegDisplayEventHandler
implements ActionListener {
public MpegDisplayEventHandler(String what){
myevent = what;
}
public void actionPerformed(java.awt.event.ActionEvent e){
MenuHandlerThread menuThread = new MenuHandlerThread(myevent);
menuThread.start();
}
private String myevent;
}
public class MenuHandlerThread
extends Thread {
MenuHandlerThread(String what){
myevent = what;
}
public void run(){
if(myevent == "close") closeWindow();
else if(myevent == "open") openWindow();
else if(myevent == "exit") exitWindow();
}
private String myevent;
}
public void closeWindow() {
if(player != null) player.close();
else System.out.println("player pointer null!");
if(panel != null) panel.setVisible(false);
//removeAll();
}
public void exitWindow() {
removeAll();
setVisible(false);
dispose();
System.exit(0);
}
public void openWindow() {
//panel.setVisible(true);
JFileChooser chooser = new JFileChooser();
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
chooser.addChoosableFileFilter(new MpegFilter());
chooser.setAcceptAllFileFilterUsed(false);
int returnVal = chooser.showOpenDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
//This is where a real application would open the file.
filename = file.getAbsolutePath();
System.out.println(filename);
openFile("file:" + filename);
} else {
//no implementation yet;
}
}
class JMFrame extends JInternalFrame implements ControllerListener {
Player mplayer;
Component visual = null;
Component control = null;
int videoWidth = 0;
int videoHeight = 0;
int controlHeight = 20;
int insetWidth = 0;
int insetHeight = 0;
boolean firstTime = true;
public JMFrame(Player player, String title) {
super(title, true, true, true, true);
//((javax.swing.plaf.basic.BasicInternalFrameUI) getUI()).setNorthPane(null);
getContentPane().setLayout( new BorderLayout() );
Dimension panelSize = panel.getSize();
//setSize(300, 220);
setSize(panelSize);
setLocation(0, 0);
setVisible(true);
mplayer = player;
mplayer.addControllerListener((ControllerListener) this);
mplayer.realize();
addInternalFrameListener( new InternalFrameAdapter() {
public void internalFrameClosing(InternalFrameEvent ife) {
mplayer.close();
}
} );
}
public void displose(){super.dispose();}
public void controllerUpdate(ControllerEvent ce) {
if (ce instanceof RealizeCompleteEvent) {
mplayer.prefetch();
} else if (ce instanceof PrefetchCompleteEvent) {
if (visual != null)
return;
if ((visual = mplayer.getVisualComponent()) != null) {
Dimension size = visual.getPreferredSize();
videoWidth = size.width;
videoHeight = size.height;
getContentPane().add("Center", visual);
} else
videoWidth = 300;
if ((control = mplayer.getControlPanelComponent()) != null) {
controlHeight = control.getPreferredSize().height;
getContentPane().add("South", control);
}
setSize(videoWidth + insetWidth,
videoHeight + controlHeight + insetHeight);
validate();
mplayer.start();
} else if (ce instanceof EndOfMediaEvent) {
mplayer.setMediaTime(new Time(0));
mplayer.start();
}
}
}
}
MpegFilter.java:
import java.io.File;
import javax.swing.*;
import javax.swing.filechooser.*;
/* ImageFilter.java is a 1.4 example used by FileChooserDemo2.java. */
public class MpegFilter extends FileFilter {
//Accept all directories and all gif, jpg, tiff, or png files.
public boolean accept(File f) {
if (f.isDirectory()) {
return true;
}
String extension = Utils.getExtension(f);
if (extension != null) {
if (extension.equals(Utils.mpeg) ||
extension.equals(Utils.mpg)) {
return true;
} else {
return false;
}
}
return false;
}
//The description of this filter
public String getDescription() {
return "Just MPEG";
}
}
Utils.java:
import java.io.File;
import javax.swing.ImageIcon;
/* Utils.java is a 1.4 example used by FileChooserDemo2.java. */
public class Utils {
public final static String mpeg = "mpeg";
public final static String mpg = "mpg";
/*
* Get the extension of a file.
*/
public static String getExtension(File f) {
String ext = null;
String s = f.getName();
int i = s.lastIndexOf('.');
if (i > 0 && i < s.length() - 1) {
ext = s.substring(i+1).toLowerCase();
}
return ext;
}
/** Returns an ImageIcon, or null if the path was invalid. */
protected static ImageIcon createImageIcon(String path) {
java.net.URL imgURL = Utils.class.getResource(path);
if (imgURL != null) {
return new ImageIcon(imgURL);
} else {
System.err.println("Couldn't find file: " + path);
return null;
}
}
} |