From: <php...@li...> - 2006-03-13 10:26:02
|
Hi, I am using PHP-Java-bridge like this : Report.java : is a java file containning a wrapper to JasperReports=20 notaly the following imports and method : import net.sf.jasperreports.engine.*; [...] public void setSubReport(String name, String compressed_xml) throws=20 JRException { InputStream stream =3D this.readCompressedXml(compressed_xml)= ; //compile into a JasperReport object JasperReport jasperReport =3D=20 JasperCompileManager.compileReport(stream); //add to subreports map _subreports.put(name, jasperReport); } Now in php, I use Report.php : $p =3D $GLOBALS['CONF']['SYS']['INCLUDE_PATH']['libraries'].'java/lib/'; $javapath =3D=20 $p.'commons-beanutils-1.5.jar;'.$p.'commons-collections-2.1.jar;'. $p.'commons-digester-1.7.jar;'.$p.'commons-logging-1.0.2.jar;= '. $p.'commons-logging-api-1.0.2.jar;'.$p.'itext-1.3.1.jar;'. $p.'jasperreports-1.2.0.jar;'.$p.'jcommon-1.0.0.jar;'. =20 $p.'jfreechart-1.0.1.jar;'.$p.'poi-2.0.jar;'.$p.'xalan.jar;'.$p.'../repor= t/Report.jar'; java_set_library_path($javapath); try { $r =3D new Java('Report'); $r->setSubReport($name, $row['sr_compressed_xml']); } catch (JavaException $ex) { $trace =3D new java("java.io.ByteArrayOutputStream"); $ex->printStackTrace(new java("java.io.PrintStream", $trace)); die("<pre>java stack trace: $trace</pre>"); } So now, this print the following error (snippet) : Package not found : net.sf.jaspereports.engine line XX in master12345.jav= a (Note: the line JasperCompileManager.compileReport(stream); is the=20 bottom of the stacktrace). This means that my Java class perfectly imports the package (because it=20 can call the JasperCompileManager.compile method) but the java classes=20 generated on the fly by Jasper (here named master12345) cannot use the=20 jars set in the javapath. I digg into the source code and see that a new thread is opened for the=20 compilation : maybe this is the problem (related to the class loader in=20 php-java-bridge I think ?). Plus, putting the jars into jdk/jre/lib/ext works, so this prove that it=20 should be a problem with the class loader. Note that doing this (jars in lib/ext) is not really an option for a=20 production environment... I hope you can help me to find a workaround for my situation; best regards and keep on the good work, chris --=20 =20 _________________________________________________________________________= ______________ Tennaxia, www.tennaxia.com, Pilotez vos obligations environnementales _________________________________________________________________________= ______________ Si=E8ge social : 6, rue L=E9onard de Vinci - 53001 Laval Cedex -=20 T=E9l : 02 43 49 75 50 - Fax : 02 43 49 75 77 Agence Paris : 19, rue r=E9aumur - 75003 Paris -=20 T=E9l : 01 42 77 04 19 - Fax : 08 25 19 19 61 Agence Lyon : Parc du Chater - 63 rue de la garenne - 69340 FRANCHEVILLE -=20 T=E9l : 04 72 39 98 14 - Fax : 04 72 39 93 85 Les informations contenues dans ce message envoy=E9es par TENNAXIA sont c= onfidentielles et sont =E9tablies =E0 l'attention exclusive de leurs destinataires. L'acc=E8= s =E0 ce message par toute autre personne n'est pas autoris=E9. Si vous n'=EAtes pas le de= stinataire de ce message, merci de le d=E9truire et d'en avertir l'exp=E9diteur : toute al= t=E9ration, copie, distribution ou toute action prise ou omise sont interdites et peuvent =EA= tre ill=E9gales. The information in this message sent by TENNAXIA is confidential and may = be legally privileged. It is intended solely for the addressee(s). Access to this me= ssage by anyone else is unauthorized. If you are not the intended recipient, please delet= e it and notify the sender : any disclosure, copying, distribution or any action taken or= omitted to be taken in reliance on it, is prohibited and may be unlawful. |
From: <php...@li...> - 2006-03-13 16:43:31
|
Just to say I digg into this problem all day and still find no solution. What I do not understand is why a thread does not inherit the classpath=20 from the creating thread ? or maybe the thread is not the problem (if so, please correct me because=20 I am really new to Java threads and javac called from a .java) regards, chris php...@li... wrote: > Hi, > > I am using PHP-Java-bridge like this : > Report.java : is a java file containning a wrapper to JasperReports=20 > notaly the following imports and method : > import net.sf.jasperreports.engine.*; > [...] > public void setSubReport(String name, String compressed_xml) throws=20 > JRException { > InputStream stream =3D this.readCompressedXml(compressed_xml= ); > //compile into a JasperReport object > JasperReport jasperReport =3D=20 > JasperCompileManager.compileReport(stream); > //add to subreports map > _subreports.put(name, jasperReport); > } > > Now in php, I use Report.php : > $p =3D $GLOBALS['CONF']['SYS']['INCLUDE_PATH']['libraries'].'java/lib/'= ; > $javapath =3D=20 > $p.'commons-beanutils-1.5.jar;'.$p.'commons-collections-2.1.jar;'. > =20 > $p.'commons-digester-1.7.jar;'.$p.'commons-logging-1.0.2.jar;'. > $p.'commons-logging-api-1.0.2.jar;'.$p.'itext-1.3.1.jar;'. > $p.'jasperreports-1.2.0.jar;'.$p.'jcommon-1.0.0.jar;'. > =20 > $p.'jfreechart-1.0.1.jar;'.$p.'poi-2.0.jar;'.$p.'xalan.jar;'.$p.'../rep= ort/Report.jar';=20 > > java_set_library_path($javapath); > try { > $r =3D new Java('Report'); > $r->setSubReport($name, $row['sr_compressed_xml']); > } catch (JavaException $ex) { > $trace =3D new java("java.io.ByteArrayOutputStream"); > $ex->printStackTrace(new java("java.io.PrintStream", $trace)); > die("<pre>java stack trace: $trace</pre>"); > } > > So now, this print the following error (snippet) : > Package not found : net.sf.jaspereports.engine line XX in=20 > master12345.java > (Note: the line JasperCompileManager.compileReport(stream); is the=20 > bottom of the stacktrace). > > This means that my Java class perfectly imports the package (because=20 > it can call the JasperCompileManager.compile method) but the java=20 > classes generated on the fly by Jasper (here named master12345) cannot=20 > use the jars set in the javapath. > > I digg into the source code and see that a new thread is opened for=20 > the compilation : maybe this is the problem (related to the class=20 > loader in php-java-bridge I think ?). > Plus, putting the jars into jdk/jre/lib/ext works, so this prove that=20 > it should be a problem with the class loader. > Note that doing this (jars in lib/ext) is not really an option for a=20 > production environment... > > I hope you can help me to find a workaround for my situation; > > best regards and keep on the good work, > chris > --=20 =20 _________________________________________________________________________= ______________ Tennaxia, www.tennaxia.com, Pilotez vos obligations environnementales _________________________________________________________________________= ______________ Si=E8ge social : 6, rue L=E9onard de Vinci - 53001 Laval Cedex -=20 T=E9l : 02 43 49 75 50 - Fax : 02 43 49 75 77 Agence Paris : 19, rue r=E9aumur - 75003 Paris -=20 T=E9l : 01 42 77 04 19 - Fax : 08 25 19 19 61 Agence Lyon : Parc du Chater - 63 rue de la garenne - 69340 FRANCHEVILLE -=20 T=E9l : 04 72 39 98 14 - Fax : 04 72 39 93 85 Les informations contenues dans ce message envoy=E9es par TENNAXIA sont c= onfidentielles et sont =E9tablies =E0 l'attention exclusive de leurs destinataires. L'acc=E8= s =E0 ce message par toute autre personne n'est pas autoris=E9. Si vous n'=EAtes pas le de= stinataire de ce message, merci de le d=E9truire et d'en avertir l'exp=E9diteur : toute al= t=E9ration, copie, distribution ou toute action prise ou omise sont interdites et peuvent =EA= tre ill=E9gales. The information in this message sent by TENNAXIA is confidential and may = be legally privileged. It is intended solely for the addressee(s). Access to this me= ssage by anyone else is unauthorized. If you are not the intended recipient, please delet= e it and notify the sender : any disclosure, copying, distribution or any action taken or= omitted to be taken in reliance on it, is prohibited and may be unlawful. |
From: <php...@li...> - 2006-03-14 18:03:16
|
Hi, > Just to say I digg into this problem all day and > still find no solution. Sorry for that. I assumed that this wasn't an important issue, you've said that it works if you move the jars to jre/lib/ext. > What I do not understand is why a thread does not > inherit the classpath > from the creating thread ? JSP is a good example. The container doesn't want to make the jsp classloader available to the webapp, so it sets the thread context classloader to the parent of the current classloader. I don't know if and how your reporting engine handles this, but in general applications may choose to ignore our dynamic loader and load classes or create dynamic proxies via the system classloader. If this happens, the loaded classes or defined proxies cannot access classes loaded via the dynamic loader. So I think the best workaround is to install your libraries in $JAVA_HOME/jre/lib/ext or to hard-code the java.classpath in the php.ini file, for example: java.classpath=/path/to/JavaBridge.jar:/path/to/lib1.jar:... I have created a ticket for this problem, please see PR1449780 for details (http://sourceforge.net/tracker/index.php?func=detail&aid=1449780&group_id=117793&atid=679233) Thank you very much for this bug report! Regards, Jost Boekemeier ___________________________________________________________ Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de |
From: <php...@li...> - 2006-03-15 09:17:55
|
Hi, thanks for the detailed answer, I better understand my problem now. Moving my jars into jre/lib/ext is not an option because you must be=20 root to do that (and I am not). Hardcoding the java.classpath in the php.ini is maybe possible thanks to=20 a .htaccess so this is ok, I will watch for this today. Concerning the isssue, here is a snippet from my report engine code in=20 order to provide more details: this is the call to the compiler : JRClassLoader.loadClassForName("org.eclipse.jdt.internal.compiler.Compile= r"); Here is the JRClassLoader called method : ** *public* static *Class* loadClassForName(*String* className) *throws* *C= lassNotFoundException* { *Class* clazz =3D *null*; *ClassLoader* classLoader =3D *Thread*.currentThread().getContextClassL= oader(); *if* (classLoader !=3D *null*) { *try* { clazz =3D *Class*.forName(className, *true*, classLoader); } *catch* (*ClassNotFoundException* e) { ///if (log.isWarnEnabled())/ /// log.warn("Failure using Thread.currentThread().getContextClassLoa= der() in JRClassLoader class. Using JRClassLoader.class.getClassLoader() = instead.");/ } } *if* (clazz =3D=3D *null*) { classLoader =3D JRClassLoader.class.getClassLoader(); *if* (classLoader =3D=3D *null*) { clazz =3D *Class*.forName(className); } *else* { clazz =3D *Class*.forName(className, *true*, classLoader); } } *return* clazz; } Is the "*Thread*.currentThread().getContextClassLoader()" not the good me= thod to obtain PHP-Java-bridge class loader ? Again, thanks for the answer, best regards, chris php...@li... wrote: > Hi, > > =20 >> Just to say I digg into this problem all day and >> still find no solution. >> =20 > > Sorry for that. I assumed that this wasn't an > important issue, you've said that it works if you move > the jars to jre/lib/ext. > > > =20 >> What I do not understand is why a thread does not >> inherit the classpath=20 >> from the creating thread ? >> =20 > > JSP is a good example. The container doesn't want to > make the jsp classloader available to the webapp, so > it sets the thread context classloader to the parent > of the current classloader. > > I don't know if and how your reporting engine handles > this, but in general applications may choose to ignore > our dynamic loader and load classes or create dynamic > proxies via the system classloader. If this happens, > the loaded classes or defined proxies cannot access > classes loaded via the dynamic loader. > > So I think the best workaround is to install your > libraries in $JAVA_HOME/jre/lib/ext or to hard-code > the java.classpath in the php.ini file, for example: > > java.classpath=3D/path/to/JavaBridge.jar:/path/to/lib1.jar:... > > I have created a ticket for this problem, please see > PR1449780 for details > (http://sourceforge.net/tracker/index.php?func=3Ddetail&aid=3D1449780&g= roup_id=3D117793&atid=3D679233) > > > Thank you very much for this bug report! > > > Regards, > Jost Boekemeier > > > > > > > > > =09 > > =09 > =09 > ___________________________________________________________=20 > Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting lang= uage > that extends applications into web and mobile media. Attend the live we= bcast > and join the prime developer group breaking into this new coding territ= ory! > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&dat= =3D121642 > _______________________________________________ > php-java-bridge-users mailing list > php...@li... > https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users > > > > =20 --=20 =20 _________________________________________________________________________= ______________ Tennaxia, www.tennaxia.com, Pilotez vos obligations environnementales _________________________________________________________________________= ______________ Si=E8ge social : 6, rue L=E9onard de Vinci - 53001 Laval Cedex -=20 T=E9l : 02 43 49 75 50 - Fax : 02 43 49 75 77 Agence Paris : 19, rue r=E9aumur - 75003 Paris -=20 T=E9l : 01 42 77 04 19 - Fax : 08 25 19 19 61 Agence Lyon : Parc du Chater - 63 rue de la garenne - 69340 FRANCHEVILLE -=20 T=E9l : 04 72 39 98 14 - Fax : 04 72 39 93 85 Les informations contenues dans ce message envoy=E9es par TENNAXIA sont c= onfidentielles et sont =E9tablies =E0 l'attention exclusive de leurs destinataires. L'acc=E8= s =E0 ce message par toute autre personne n'est pas autoris=E9. Si vous n'=EAtes pas le de= stinataire de ce message, merci de le d=E9truire et d'en avertir l'exp=E9diteur : toute al= t=E9ration, copie, distribution ou toute action prise ou omise sont interdites et peuvent =EA= tre ill=E9gales. The information in this message sent by TENNAXIA is confidential and may = be legally privileged. It is intended solely for the addressee(s). Access to this me= ssage by anyone else is unauthorized. If you are not the intended recipient, please delet= e it and notify the sender : any disclosure, copying, distribution or any action taken or= omitted to be taken in reliance on it, is prohibited and may be unlawful. |
From: <php...@li...> - 2006-03-15 09:56:20
|
Hi, just a maybe-silly question concerning setting the java.classpath in the=20 php.ini : Why can not I specify a directory instead of the jars ? I ask because I have 12 jars to set in the cp, so this is bad to=20 maintains their hard-coded names in the php.ini ex : $> ls /home/christophe/workspace/www2/libraries/java/lib/ commons-beanutils-1.5.jar commons-logging-api-1.0.2.jar =20 jcommon-1.0.0.jar xalan.jar commons-collections-2.1.jar CVS =20 jfreechart-1.0.1.jar commons-digester-1.7.jar itext-1.3.1.jar jxl.jar commons-logging-1.0.2.jar jasperreports-1.2.0.jar poi-2.0.jar $> cat /etc/php5/conf.d/java.ini [java] extension=3Djava.so java.java=3D/usr/java/jdk/bin/java java.java_home=3D/usr/java/jdk java.log_level=3D4 java.log_file=3D/var/log/php-java-bridge.log java.classpath=3D/usr/lib/php5/extensions/JavaBridge.jar:/home/christophe= /workspace/www2/libraries/java/lib report.php *Fatal error*: Uncaught [class java.lang.Exception: java.lang.Exception:=20 CreateInstance failed: new Report. Cause:=20 java.lang.NoClassDefFoundError:=20 net/sf/jasperreports/engine/export/JRPdfExporter] thrown in=20 */home/christophe/workspace/www2/report.php* on line *XXX *with the class being defined in*=20 */home/christophe/workspace/www2/libraries/java/lib/jasperreports-1.2.0.j= ar regards, chris* * php...@li... wrote: > Hi, > > =20 >> Just to say I digg into this problem all day and >> still find no solution. >> =20 > > Sorry for that. I assumed that this wasn't an > important issue, you've said that it works if you move > the jars to jre/lib/ext. > > > =20 >> What I do not understand is why a thread does not >> inherit the classpath=20 >> from the creating thread ? >> =20 > > JSP is a good example. The container doesn't want to > make the jsp classloader available to the webapp, so > it sets the thread context classloader to the parent > of the current classloader. > > I don't know if and how your reporting engine handles > this, but in general applications may choose to ignore > our dynamic loader and load classes or create dynamic > proxies via the system classloader. If this happens, > the loaded classes or defined proxies cannot access > classes loaded via the dynamic loader. > > So I think the best workaround is to install your > libraries in $JAVA_HOME/jre/lib/ext or to hard-code > the java.classpath in the php.ini file, for example: > > java.classpath=3D/path/to/JavaBridge.jar:/path/to/lib1.jar:... > > I have created a ticket for this problem, please see > PR1449780 for details > (http://sourceforge.net/tracker/index.php?func=3Ddetail&aid=3D1449780&g= roup_id=3D117793&atid=3D679233) > > > Thank you very much for this bug report! > > > Regards, > Jost Boekemeier > > > > > > > > > =09 > > =09 > =09 > ___________________________________________________________=20 > Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting lang= uage > that extends applications into web and mobile media. Attend the live we= bcast > and join the prime developer group breaking into this new coding territ= ory! > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&dat= =3D121642 > _______________________________________________ > php-java-bridge-users mailing list > php...@li... > https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users > > > > =20 --=20 =20 _________________________________________________________________________= ______________ Tennaxia, www.tennaxia.com, Pilotez vos obligations environnementales _________________________________________________________________________= ______________ Si=E8ge social : 6, rue L=E9onard de Vinci - 53001 Laval Cedex -=20 T=E9l : 02 43 49 75 50 - Fax : 02 43 49 75 77 Agence Paris : 19, rue r=E9aumur - 75003 Paris -=20 T=E9l : 01 42 77 04 19 - Fax : 08 25 19 19 61 Agence Lyon : Parc du Chater - 63 rue de la garenne - 69340 FRANCHEVILLE -=20 T=E9l : 04 72 39 98 14 - Fax : 04 72 39 93 85 Les informations contenues dans ce message envoy=E9es par TENNAXIA sont c= onfidentielles et sont =E9tablies =E0 l'attention exclusive de leurs destinataires. L'acc=E8= s =E0 ce message par toute autre personne n'est pas autoris=E9. Si vous n'=EAtes pas le de= stinataire de ce message, merci de le d=E9truire et d'en avertir l'exp=E9diteur : toute al= t=E9ration, copie, distribution ou toute action prise ou omise sont interdites et peuvent =EA= tre ill=E9gales. The information in this message sent by TENNAXIA is confidential and may = be legally privileged. It is intended solely for the addressee(s). Access to this me= ssage by anyone else is unauthorized. If you are not the intended recipient, please delet= e it and notify the sender : any disclosure, copying, distribution or any action taken or= omitted to be taken in reliance on it, is prohibited and may be unlawful. |
From: <php...@li...> - 2006-03-19 15:02:44
|
Hi, > Why can not I specify a directory instead of the > jars ? In some JVM (most java VM but not Mono) you can use e.g.: java -Djava.ext.dirs=/dir1:/dir2 -jar JavaBridge.jar But you cannot set this option in the php.ini file. However, on windows the following could be used: [java] java.java="javaw -Djava.ext.dirs=..." On Unix you could use a .sh wrapper, for example: [java] java.wrapper=/home/jostb/bin/startBackend.sh And the startBackend.sh script could look like: #!/bin/sh java=$1; shift addOptions="-Djava.ext.dirs=..." exec $java $addOptions $* Regards, Jost Boekemeier ___________________________________________________________ Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de |
From: <php...@li...> - 2006-03-21 16:51:27
|
php...@li... wrote: > Just to say I digg into this problem all day and still find no solution. > What I do not understand is why a thread does not inherit the > classpath from the creating thread I guess that's not the problem. The problem is, that javac does not inherit the classpath. i.e. just because the classes are available to the compiler in it's runtime environment does not mean that he has access to the class definitions. (i.e. class files) - nor that he knows how to find them. I have done something similar once, and you definitely need to tell javac explicitly where to find the classes it needs. If they are in /jre/lib/ext he will look there anyway, but it's not really a classloader problem - it's just that javac does not utilize it's own classloader to look for classes - it uses the system classpath, plus classpaths he has been explicitly told to use. Try System.setProperty to change the system classpath and try again, I guess that will help. best regards, Kai Londenberg |
From: <php...@li...> - 2006-03-23 10:12:30
|
Thanks for the tip : I did not know that javac (i.e the one in=20 tools.jar) did not inherit the runtime classpath (but it seems logical=20 because, for example, I do not want my compilation be influenced by my=20 eclipse classpath). I used the solution previously provided (i.e set java.classpath in the=20 php.ini) which seems to do the same thing (put the jars in the system=20 class loader). I prefer to stay with this solution because it is clearly more simple=20 than to hook the JasperReports sources or than to set a system property=20 in an obscure part of the code (what I mean is that if other=20 applications use PHP-Java-bridge, it is simpler for them to know that=20 there already are some classes in the system classpath via php.ini). Anyway, I will fill a bug on JasperReports to say that it will be good=20 to provide the necessarly used runtime jars to the javac compiler. Thanks to take time to think on my problem. Regards, chris php...@li... wrote: > php...@li... wrote: >> Just to say I digg into this problem all day and still find no solutio= n. >> What I do not understand is why a thread does not inherit the=20 >> classpath from the creating thread > > I guess that's not the problem. The problem is, that javac does not=20 > inherit the classpath. i.e. just because the classes are available > to the compiler in it's runtime environment does not mean that he has=20 > access to the class definitions. (i.e. class files) - nor that he knows > how to find them. > > I have done something similar once, and you definitely need to tell=20 > javac explicitly where to find the classes it needs. > If they are in /jre/lib/ext he will look there anyway, but it's not=20 > really a classloader problem - it's just that javac does not utilize > it's own classloader to look for classes - it uses the system=20 > classpath, plus classpaths he has been explicitly told to use. > > Try System.setProperty to change the system classpath and try again, I=20 > guess that will help. > > best regards, > > Kai Londenberg > > > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting=20 > language > that extends applications into web and mobile media. Attend the live=20 > webcast > and join the prime developer group breaking into this new coding=20 > territory! > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&dat= =3D121642 > _______________________________________________ > php-java-bridge-users mailing list > php...@li... > https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users > > > --=20 =20 _________________________________________________________________________= ______________ Tennaxia, www.tennaxia.com, Pilotez vos obligations environnementales _________________________________________________________________________= ______________ Si=E8ge social : 6, rue L=E9onard de Vinci - 53001 Laval Cedex -=20 T=E9l : 02 43 49 75 50 - Fax : 02 43 49 75 77 Agence Paris : 19, rue r=E9aumur - 75003 Paris -=20 T=E9l : 01 42 77 04 19 - Fax : 08 25 19 19 61 Agence Lyon : Parc du Chater - 63 rue de la garenne - 69340 FRANCHEVILLE -=20 T=E9l : 04 72 39 98 14 - Fax : 04 72 39 93 85 Les informations contenues dans ce message envoy=E9es par TENNAXIA sont c= onfidentielles et sont =E9tablies =E0 l'attention exclusive de leurs destinataires. L'acc=E8= s =E0 ce message par toute autre personne n'est pas autoris=E9. Si vous n'=EAtes pas le de= stinataire de ce message, merci de le d=E9truire et d'en avertir l'exp=E9diteur : toute al= t=E9ration, copie, distribution ou toute action prise ou omise sont interdites et peuvent =EA= tre ill=E9gales. The information in this message sent by TENNAXIA is confidential and may = be legally privileged. It is intended solely for the addressee(s). Access to this me= ssage by anyone else is unauthorized. If you are not the intended recipient, please delet= e it and notify the sender : any disclosure, copying, distribution or any action taken or= omitted to be taken in reliance on it, is prohibited and may be unlawful. |
From: <php...@li...> - 2006-03-23 10:25:22
|
Just a quick reply : I watch the Jasper sources and they are already=20 using the context classloader. As said by Jost Boekemeier, this is an issue of PHP-Java bridge not=20 setting correctly the context classloader before 3.0.8 (see bug PR1449780= ) regards, chris php...@li... wrote: > Thanks for the tip : I did not know that javac (i.e the one in=20 > tools.jar) did not inherit the runtime classpath (but it seems logical=20 > because, for example, I do not want my compilation be influenced by my=20 > eclipse classpath). > > I used the solution previously provided (i.e set java.classpath in the=20 > php.ini) which seems to do the same thing (put the jars in the system=20 > class loader). > I prefer to stay with this solution because it is clearly more simple=20 > than to hook the JasperReports sources or than to set a system=20 > property in an obscure part of the code (what I mean is that if other=20 > applications use PHP-Java-bridge, it is simpler for them to know that=20 > there already are some classes in the system classpath via php.ini). > > Anyway, I will fill a bug on JasperReports to say that it will be good=20 > to provide the necessarly used runtime jars to the javac compiler. > > Thanks to take time to think on my problem. > > Regards, > chris > > php...@li... wrote: >> php...@li... wrote: >>> Just to say I digg into this problem all day and still find no=20 >>> solution. >>> What I do not understand is why a thread does not inherit the=20 >>> classpath from the creating thread >> >> I guess that's not the problem. The problem is, that javac does not=20 >> inherit the classpath. i.e. just because the classes are available >> to the compiler in it's runtime environment does not mean that he has=20 >> access to the class definitions. (i.e. class files) - nor that he know= s >> how to find them. >> >> I have done something similar once, and you definitely need to tell=20 >> javac explicitly where to find the classes it needs. >> If they are in /jre/lib/ext he will look there anyway, but it's not=20 >> really a classloader problem - it's just that javac does not utilize >> it's own classloader to look for classes - it uses the system=20 >> classpath, plus classpaths he has been explicitly told to use. >> >> Try System.setProperty to change the system classpath and try again,=20 >> I guess that will help. >> >> best regards, >> >> Kai Londenberg >> >> >> >> >> >> >> ------------------------------------------------------- >> This SF.Net email is sponsored by xPML, a groundbreaking scripting=20 >> language >> that extends applications into web and mobile media. Attend the live=20 >> webcast >> and join the prime developer group breaking into this new coding=20 >> territory! >> http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&da= t=3D121642 >> _______________________________________________ >> php-java-bridge-users mailing list >> php...@li... >> https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users >> >> >> > --=20 =20 _________________________________________________________________________= ______________ Tennaxia, www.tennaxia.com, Pilotez vos obligations environnementales _________________________________________________________________________= ______________ Si=E8ge social : 6, rue L=E9onard de Vinci - 53001 Laval Cedex -=20 T=E9l : 02 43 49 75 50 - Fax : 02 43 49 75 77 Agence Paris : 19, rue r=E9aumur - 75003 Paris -=20 T=E9l : 01 42 77 04 19 - Fax : 08 25 19 19 61 Agence Lyon : Parc du Chater - 63 rue de la garenne - 69340 FRANCHEVILLE -=20 T=E9l : 04 72 39 98 14 - Fax : 04 72 39 93 85 Les informations contenues dans ce message envoy=E9es par TENNAXIA sont c= onfidentielles et sont =E9tablies =E0 l'attention exclusive de leurs destinataires. L'acc=E8= s =E0 ce message par toute autre personne n'est pas autoris=E9. Si vous n'=EAtes pas le de= stinataire de ce message, merci de le d=E9truire et d'en avertir l'exp=E9diteur : toute al= t=E9ration, copie, distribution ou toute action prise ou omise sont interdites et peuvent =EA= tre ill=E9gales. The information in this message sent by TENNAXIA is confidential and may = be legally privileged. It is intended solely for the addressee(s). Access to this me= ssage by anyone else is unauthorized. If you are not the intended recipient, please delet= e it and notify the sender : any disclosure, copying, distribution or any action taken or= omitted to be taken in reliance on it, is prohibited and may be unlawful. |