Do you get this error while running another class? I take it sendXMLDataToRM.java compiled and it's being called from another class?
Ade (new to java too :O) -----Original Message----- From: Craig Dudley [mailto:[EMAIL PROTECTED]] Sent: 26 September 2002 13:05 To: CF-Talk Subject: RE: Java custom tag Yes, I'm a newbie with java, but not quite that bad ;-) It compiles fine, no errors. -----Original Message----- From: Dina Hess [mailto:[EMAIL PROTECTED]] Sent: 26 September 2002 13:03 To: CF-Talk Subject: Re: Java custom tag Did you compile your code?? Java source files are .java and Java compiled files are .class. ----- Original Message ----- From: "Adrian Lynch" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Thursday, September 26, 2002 6:52 AM Subject: RE: Java custom tag > Could it be it can't find the class you just wrote? > > Ade > > -----Original Message----- > From: Craig Dudley [mailto:[EMAIL PROTECTED]] > Sent: 26 September 2002 12:35 > To: CF-Talk > Subject: Java custom tag > > > Hi all, > > Does any java programmer on here have 5 minutes to look this over for me? > > It's basically for sending XML packets via HTTP POST to our SMS provider, it > follows their example but I've converted it into a CF custom tag, but to be > honest JAVA is not my strong point and I can't figure out why it will not > run. > > Here's the error message I get... > > java.lang.ClassNotFoundException: sendXMLDataToRM.class. Java exception > occurred in call to method. > > I'm sure I've come across this error before, but can't remmeber what causes > it. As I say, I'm still a java newbie. > > I'm running CF5 enterprise and JVM 1.3.1_04 > > > > code start > ------------------------------------ > > import com.allaire.cfx.* ; > import java.io.* ; > import java.net.* ; > import java.util.* ; > > public class sendXMLDataToRM implements CustomTag{ > public void processRequest( Request request, Response response ) throws > Exception > { > if ( !request.attributeExists("xmlData") || > !request.attributeExists("Url") ) > { > throw new Exception( > "Missing attribute (xmlData and Url are both required attributes for > this tag)" ) ; > } > > String Url = request.getAttribute("Url") ; > String xmlData = request.getAttribute("xmlData"); > String xmlResponse = ""; > > URL url = new URL( Url ); > > HttpURLConnection connection = ( HttpURLConnection ) url.openConnection(); > > connection.setDoOutput( true ); > connection.setDoInput( true ); > connection.setRequestMethod( "POST" ); > connection.setUseCaches( false ); > connection.setRequestProperty( "Content-type", > "application/x-www-form-urlencoded"); > > String dataString = "XMLDATA=" + URLEncoder.encode(xmlData); > > DataOutputStream dos = new DataOutputStream( connection.getOutputStream() > ); > > dos.writeBytes( dataString ); > dos.flush(); > dos.close(); > > InputStream is = connection.getInputStream(); > BufferedReader reader = new BufferedReader( new InputStreamReader( is )); > StringBuffer answer = new StringBuffer(); > String line = null; > > while ( ( line = reader.readLine() ) != null ){ > answer.append(line); > } > > is.close(); > > response.setVariable( xmlResponse, answer.toString()); > } > } > > ---------------------------------- > code stop > > TIA, Craig. > > ______________________________________________________________________ Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

