Register | Login | |||||
Main
| Memberlist
| Active users
| ACS
| Commons
| Calendar
| Online users Ranks | FAQ | Color Chart | Photo album | IRC Chat |
| |
0 user currently in Programming. | 3 guests |
Acmlm's Board - I2 Archive - Programming - Using jars in tomcat | | | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
User | Post | ||
aioria1981 Ninji Level: 20 Posts: 86/234 EXP: 36701 For next: 5738 Since: 07-20-05 From: Viña del Mar, Chile Since last post: 5 days Last activity: 5 days |
| ||
I'm trying to import classes from a package in tomcat 5.0.28. I put the jar with the classes in $tomcat_dir$\webapps\myapp\WEB-INF\lib, $tomcat_dir$\webapps\myapp\WEB-INF\classes and $tomcat_dir$\common\lib, but it just says that it cannot resolve symbol XmlRpcClient. I've classpath pointing to the jar containing the classes also: echo %classpath% .;C:\Archivos de programa\j2sdk1.4.2\lib\xmlrpc-2.0\xmlrpc-2.0.jar;C:\Archivos de programa\j2sdk1.4.2\lib\commons-codec-1.3\commons-codec-1.3.jar;C:\archivos de programa\LINGO9\Lingo9_0.jar as you can see, I'm trying to export classes from an xmlrpc package, and I'm using tomcat to call the xmlrpc server. Both tomcat and xmlrpc servers are the same pc: localhost, because i don't have another pc to build a network. My code in the jsp file: <html> <%@ page import="org.apache.xmlrpc.XmlRpcServer" %> <%@ page import="java.util.*" %> <% XmlRpcClient client; client = new XmlRpcClient ("http://localhost:"+request.getParameter("puerto")); Vector Sumandos = new Vector(); Sumandos.addElement (new Integer(3)); Sumandos.addElement (new Integer(8)); Hashtable respuesta =(Hashtable) client.execute("SumaDiferencia", Sumandos); int sum = ((Integer) respuesta.get("Suma")).intValue(); int difference = ((Integer) respuesta.get("Diferencia")).intValue(); %> <body> Suma <%=sum%><br> Diferencia <%=difference%><br> </body> </html> |
|||
neotransotaku Baby Mario 戻れたら、 誰も気が付く Level: 87 Posts: 3873/4016 EXP: 6220548 For next: 172226 Since: 03-15-04 From: Outside of Time/Space Since last post: 11 hours Last activity: 1 hour |
| ||
where did you get this jar? i remember I had the same issues with Tomcat before but WEB-INF/lib or Tomcat/common/lib is where .jar files should be placed. Did you restart tomcat? and is your .jsp file in Tomcat/webapps/myapp? |
|||
aioria1981 Ninji Level: 20 Posts: 87/234 EXP: 36701 For next: 5738 Since: 07-20-05 From: Viña del Mar, Chile Since last post: 5 days Last activity: 5 days |
| ||
1) i got the jar in an apache file server. Here's one with the file: http://apache.oc1.mirrors.redwire.net/ws/xmlrpc/xmlrpc-current.tar.gz Inside this file, there's the xmlrpc-2.0.jar 2) Yep, i restarted it many times. I've just started tomcat right before i posted this. 3) And yes, the jsp file is in Tomcat/webapps/myapp Result: Still gives the "cannot resolve symbol" problem The only solution that i've though was to uncompress the jar in the classes directory (WEB-INF/classes) and then try to import the clases within it. But I think that's not the idea, because why do they distribute a jar if i've to uncompress it? |
|||
neotransotaku Baby Mario 戻れたら、 誰も気が付く Level: 87 Posts: 3876/4016 EXP: 6220548 For next: 172226 Since: 03-15-04 From: Outside of Time/Space Since last post: 11 hours Last activity: 1 hour |
| ||
open the jar file in something like winrar, and see if you can follow org/apache/xmlrpc/XmlRpcServer.class my guess at this point is that class isn't where you think it is... |
|||
aioria1981 Ninji Level: 20 Posts: 101/234 EXP: 36701 For next: 5738 Since: 07-20-05 From: Viña del Mar, Chile Since last post: 5 days Last activity: 5 days |
| ||
I've already done that, and it appears in the right place. This is getting me nuts, in collegue it did work, but i don't remember how, nevertheless, I was not the administator of tomcat, so I don't know how they did so as to be able to import classes from jars and from the WEB-INF/classes directory. I think there must be a place (some xml file) that tells tomcat where the clases are gonna be, since i tried to manually compile the java file generated by catalina in the work directory, but it gave me too many errors related to finding the classes, even it said that it didn't find the XmlRpcClient class, being that in the classpath. Well, that my sad story, but thanks for the replies |
|||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 6996/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
If you're using XP, you can go to the Search tool (hit F3 in Explorer) and search for files matching *.* that contain some piece of text that you know would be in such a file. It'll take a while but it'll find it. (And you can reduce search time considerably if you reduce the amount of places you search; eg if you're looking for something in My Documents, you need only search that specific directory.) | |||
neotransotaku Baby Mario 戻れたら、 誰も気が付く Level: 87 Posts: 3879/4016 EXP: 6220548 For next: 172226 Since: 03-15-04 From: Outside of Time/Space Since last post: 11 hours Last activity: 1 hour |
| ||
hmm...i guess what you can try is to see if you can get one of your own classes to be called from that JSP. For example, make a class whose purpose is just to return a string when you call it's static method. If you can get that class to load up without problems, then you are doing stuff right. | |||
aioria1981 Ninji Level: 20 Posts: 102/234 EXP: 36701 For next: 5738 Since: 07-20-05 From: Viña del Mar, Chile Since last post: 5 days Last activity: 5 days |
| ||
Thanks again, but I also chose a fast and easy solution. I've changed the implementation of the code to do it with php, and i got a php "library" (inc. extension, it's a library, isn't it?) that does all neat things with xmlrpc. I now it'll be repetitive, but...Thank you guys Ahp, for the ones interested, here's the "library" i used PS: and again the layout is messed, the bg is not showing, i know i must put the bg URL in the textbox in the edit layout page, but it adds an extra <br> |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
Acmlm's Board - I2 Archive - Programming - Using jars in tomcat | | | |