Error adding package to class that is using a jar
Hi,
I have a class that is using a jar but I need it to be in a package so I can use it with JSP, but each time I put the package in the class I get some compile errors that the classes in the jar can't be found.
Example:
Compiling 1 source file to C:\Documents and Settings\ehasbunv\Mis documentos\proyecto\mex\cc\build\web\WEB-INF\classes
C:\Documents and Settings\ehasbunv\Mis documentos\proyecto\mex\cc\src\java\tecno\Tecnomen.java:22: cannot find symbol
symbol : class PP_OpenInterface
location: class tecno.Tecnomen
private PP_OpenInterface pp = null;
C:\Documents and Settings\ehasbunv\Mis documentos\proyecto\mex\cc\src\java\tecno\Tecnomen.java:23: cannot find symbol
symbol : class PP_OpenInterface_Factory
location: class tecno.Tecnomen
private PP_OpenInterface_Factory ppf = null;
C:\Documents and Settings\ehasbunv\Mis documentos\proyecto\mex\cc\src\java\tecno\Tecnomen.java:127: cannot find symbol
symbol : class PP_exception
location: class tecno.Tecnomen
public int GenericRecharge (String Subid,int monto) throws PP_exception
C:\Documents and Settings\ehasbunv\Mis documentos\proyecto\mex\cc\src\java\tecno\Tecnomen.java:79: cannot find symbol
symbol : variable PP_OpenInterface_FactoryHelper
location: class tecno.Tecnomen
ppf = PP_OpenInterface_FactoryHelper.narrow(nsRef);
C:\Documents and Settings\ehasbunv\Mis documentos\proyecto\mex\cc\src\java\tecno\Tecnomen.java:91: cannot find symbol
symbol : class PP_exception
location: class tecno.Tecnomen
catch(PP_exception ex)
C:\Documents and Settings\ehasbunv\Mis documentos\proyecto\mex\cc\src\java\tecno\Tecnomen.java:139: cannot find symbol
symbol : class paramRecord
location: class tecno.Tecnomen
paramRecord pSeq [] = new paramRecord[] {
C:\Documents and Settings\ehasbunv\Mis documentos\proyecto\mex\cc\src\java\tecno\Tecnomen.java:139: cannot find symbol
symbol : class paramRecord
location: class tecno.Tecnomen
paramRecord pSeq [] = new paramRecord[] {
C:\Documents and Settings\ehasbunv\Mis documentos\proyecto\mex\cc\src\java\tecno\Tecnomen.java:140: cannot find symbol
symbol : class paramRecord
location: class tecno.Tecnomen
new paramRecord(0,subId),
C:\Documents and Settings\ehasbunv\Mis documentos\proyecto\mex\cc\src\java\tecno\Tecnomen.java:141: cannot find symbol
symbol : class paramRecord
location: class tecno.Tecnomen
new paramRecord(1,amount),
Checking another file, the problem is that if I'm
trying to use a class in the default package in
another class and put a package name in the class
then I can't use the default package. Is there any
workaround?Nope. Get in the habit now of making ALL of your classes belong to packages. The "no-package" is only for creating 'toy' applications with no dependencies from other packaged classes.
Similar Messages
-
[svn] 719: Added package and class level javadoc.
Revision: 719
Author: [email protected]
Date: 2008-03-03 11:34:54 -0800 (Mon, 03 Mar 2008)
Log Message:
Added package and class level javadoc.
Modified Paths:
flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/Configuration.java
flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/Element.java
flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/ImplementationCompiler.java
flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/InterfaceCompiler.java
flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/LogAdapter.java
flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/SourceCodeBuffer.java
flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/Visitor.java
Added Paths:
flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/package.htmlJust create a package.html file in the package folder and put your package documentation there. I just put my cursor on the Application Sources package folder name and right click and create a simple file. It will default to the package folder.
-
Generated servlet error - unable to compile class for JSP - using NB5.5/SS9
I am using NB5.5 beta2 and Sun server 9.0 with JSF 1.1 - all is OK when I am creating firts JSF application - welcomeJSF.jsp page is rendered normally - but when I am adding one more jsp with JSP view and so on - then - I am getting errors in both JSF pages - both - in original welcomeJSF and the new invoice.jsp page
here is code for typical error
org.apache.jasper.JasperException: Unable to compile class for JSP
org.apache.jasper.JasperException: Unable to compile class for JSP
Generated servlet error:
[javac] E:\Sun\AppServer\domains\domain1\generated\jsp\j2ee-modules\ERPSolution\org\apache\jsp\welcomeJSF_jsp.java:99: cannot find symbol
[javac] symbol : method setJspId(java.lang.String)
[javac] location: class com.sun.faces.taglib.jsf_core.ViewTag
[javac] jspxth_f_view_0.setJspId("id7");
[javac] ^
Generated servlet error:
[javac] E:\Sun\AppServer\domains\domain1\generated\jsp\j2ee-modules\ERPSolution\org\apache\jsp\welcomeJSF_jsp.java:144: cannot find symbol
[javac] symbol : method setJspId(java.lang.String)
[javac] location: class com.sun.faces.taglib.html_basic.OutputTextTag
[javac] jspxth_h_outputText_0.setJspId("id17");
[javac] ^
Generated servlet error:
[javac] E:\Sun\AppServer\domains\domain1\generated\jsp\j2ee-modules\ERPSolution\org\apache\jsp\welcomeJSF_jsp.java:145: setValue(java.lang.String) in com.sun.faces.taglib.html_basic.OutputTextTag cannot be applied to (javax.el.ValueExpression)
[javac] jspxth_h_outputText_0.setValue(org.apache.jasper.runtime.PageContextImpl.getValueExpression("Java Server Faces", (PageContext)_jspx_page_context, java.lang.Object.class, null));
[javac] ^
[javac] 3 errors
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:94)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:384)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:461)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:528)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:507)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:495)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:530)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:409)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:317)
javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:414)
com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:455)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:139)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:108)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:266)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:159)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)
com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
note The full stack trace of the root cause is available in the Sun Java System Application Server Platform Edition 9.0 logs.
and there is output for another error:
Generated servlet error:
[javac] E:\Sun\AppServer\domains\domain1\generated\jsp\j2ee-modules\ERPSolution\org\apache\jsp\welcomeJSF_jsp.java:144: cannot find symbol
[javac] symbol : method setJspId(java.lang.String)
[javac] location: class com.sun.faces.taglib.html_basic.OutputTextTag
[javac] jspxth_h_outputText_0.setJspId("id17");
[javac] ^
Generated servlet error:
[javac] E:\Sun\AppServer\domains\domain1\generated\jsp\j2ee-modules\ERPSolution\org\apache\jsp\welcomeJSF_jsp.java:145: setValue(java.lang.String) in com.sun.faces.taglib.html_basic.OutputTextTag cannot be applied to (javax.el.ValueExpression)
[javac] jspxth_h_outputText_0.setValue(org.apache.jasper.runtime.PageContextImpl.getValueExpression("Java Server Faces", (PageContext)_jspx_page_context, java.lang.Object.class, null));
[javac] ^
[javac] 3 errors
and here is code of my new invoice.jsp page:
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%--
The taglib directive below imports the JSTL library. If you uncomment it,
you must also add the JSTL library to the project. The Add Library... action
on Libraries node in Projects view can be used to add the JSTL 1.1 library.
--%>
<%--
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
--%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<f:view>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1><h:outputText value="Java Server Faces" /></h1>
<h:inputText value="#{managerBean.currentInvoice.id}"/>
<h:inputText value="#{managerBean.currentInvoice.description}"/>
<h:inputText value="#{managerBean.currentInvoice.total}"/>
<h:commandButton value="new_invoice"
type="submit"
actionListener="#{managerBean.createNewInvoice}"/>
</body>
</f:view>and faces-config.xml file:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<!-- =========== FULL CONFIGURATION FILE ================================== -->
<faces-config>
<managed-bean>
<managed-bean-name>managerBean</managed-bean-name>
<managed-bean-class>com.brl.ERPSolution.ui.ManagerBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-config>managerBean was intended to be backing beans which will call the facaed beans of EJB 3.0 entity beans - but at presnet - almost empty methods are declared there:
package com.brl.ERPSolution.ui;
import javax.faces.event.ActionEvent;
import com.brl.solutions.EJB3.*;
* @author Administrator
public class ManagerBean {
protected int currentInvoiceId;
protected Invoices currentInvoice;
protected InvoicesFacade invoicesFacade;
/** Creates a new instance of ManagerBean */
public ManagerBean() {
/* business methods */
public void createNewInvoice(ActionEvent actionEvent)
invoicesFacade.create(this.currentInvoice);
public Invoices getCurrentInvoice()
return this.currentInvoice;
public void setCurrentInvoice(Invoices currentInvoice)
this.currentInvoice=currentInvoice;
}I read in one blog (actually - the only page which was returned by yahoo - so - this should be very rare error!!!) to try to use Sun server's verifier.bat - and - it reported 0 errors and 0 warning. Build was succesfull as well and also - deployment was without errors - but - above mentioned error appeared during the automatic compilation of jsp pages/servlet when newly deployed jsps are first accessed from remote browser.
So - is it possible, please, to receive some advice - what to do further? I feel that my invoice.jsp page can be with errors, - however - the original welcomeJSF.jsp should be working without errors even the erronwous JFS jsp page is added to web application.
Thans for any adice or hint in advance!!!OK - I have made 'clean and build main project' from NB menu and the deployed the resulting *.war and the error messages have disappeared... So - it seems to be bug...
-
please help, 5 duke dollars up for the best answer, or first answer that solves my problem!
Hello, I have created a package called molecule that contains classes named Water, Sugar, Carbon Dioxide, and SulfuricAcid, and a sub-package named molecule.atom. The atom sub-package contains classes named Carbon, Hydrogen, Oxygen, and Sulfur. Each class in the molecule package should re-define the toString() method to print the numbers and types of atoms that constitute the molecule. For example, molecule.Sugar.toString() should return the string:
"Sugar: 6 Carbon, 12 Hydrogen, 6 Oxygen".
So basically, I have created a folder in C:\molecule\ and a subfolder C:\molecule\atom\ . I have also created a class called ChemTest belonging to the default package. ChemTest.main() creates and prints instances of each molecule and atom, but does not contain any import statements. The problem is that the ChemTest.java file won't compile coming up with 16 errors!
Can someone explain to me what I am doing wrong?
here is one of the molecule classes, for example CarbonDioxide.java:
package molecule;
public class CarbonDioxide
private String co2;
public CarbonDioxide()
co2 = "Carbon Dioxide: 1 Carbon, 2 Oxygen";
public String toString()
return co2;
and here is one of the atom classes, for example Carbon.java:
package molecule.atom;
public class Carbon
private String c;
public Carbon()
c = "Carbon: symbol = C, num = 6, weight = 12.011";
public String toString()
return c;
now here is the ChemTest.java file that won't compile:
public class ChemTest
public static void main(String[]args)
molecule.Water water = new molecule.Water();
molecule.Sugar sugar = new molecule.Sugar();
molecule.CarbonDioxide carbonDioxide = new molecule.CarbonDioxide();
molecule.SulfuricAcid sulfuricAcid = new molecule.SulfuricAcid();
molecule.atom.Carbon carbon = new molecule.atom.Carbon();
molecule.atom.Oxygen oxygen = new molecule.atom.Oxygen();
molecule.atom.Hydrogen hydrogen = new molecule.atom.Hydrogen();
molecule.atom.Sulfur sulfur = new molecule.atom.Sulfur();
System.out.println(water.toString());
System.out.println(sugar.toString());
System.out.println(carbonDioxide.toString());
System.out.println(sulfuricAcid.toString());
System.out.println();
System.out.println(carbon.toString());
System.out.println(oxygen.toString());
System.out.println(hydrogen.toString());
System.out.println(sulfur.toString());
and finally, here are the errors:
C:\molecule\ChemTest.java:5: cannot resolve symbol
symbol : class Water
location: package molecule
molecule.Water water = new molecule.Water();
^
C:\molecule\ChemTest.java:5: cannot resolve symbol
symbol : class Water
location: package molecule
molecule.Water water = new molecule.Water();
^
C:\molecule\ChemTest.java:6: cannot resolve symbol
symbol : class Sugar
location: package molecule
molecule.Sugar sugar = new molecule.Sugar();
^
C:\molecule\ChemTest.java:6: cannot resolve symbol
symbol : class Sugar
location: package molecule
molecule.Sugar sugar = new molecule.Sugar();
^
C:\molecule\ChemTest.java:7: cannot resolve symbol
symbol : class CarbonDioxide
location: package molecule
molecule.CarbonDioxide carbonDioxide = new molecule.CarbonDioxide();
^
C:\molecule\ChemTest.java:7: cannot resolve symbol
symbol : class CarbonDioxide
location: package molecule
molecule.CarbonDioxide carbonDioxide = new molecule.CarbonDioxide();
^
C:\molecule\ChemTest.java:8: cannot resolve symbol
symbol : class SulfuricAcid
location: package molecule
molecule.SulfuricAcid sulfuricAcid = new molecule.SulfuricAcid();
^
C:\molecule\ChemTest.java:8: cannot resolve symbol
symbol : class SulfuricAcid
location: package molecule
molecule.SulfuricAcid sulfuricAcid = new molecule.SulfuricAcid();
^
C:\molecule\ChemTest.java:10: cannot resolve symbol
symbol : class Carbon
location: package atom
molecule.atom.Carbon carbon = new molecule.atom.Carbon();
^
C:\molecule\ChemTest.java:10: cannot resolve symbol
symbol : class Carbon
location: package atom
molecule.atom.Carbon carbon = new molecule.atom.Carbon();
^
C:\molecule\ChemTest.java:11: cannot resolve symbol
symbol : class Oxygen
location: package atom
molecule.atom.Oxygen oxygen = new molecule.atom.Oxygen();
^
C:\molecule\ChemTest.java:11: cannot resolve symbol
symbol : class Oxygen
location: package atom
molecule.atom.Oxygen oxygen = new molecule.atom.Oxygen();
^
C:\molecule\ChemTest.java:12: cannot resolve symbol
symbol : class Hydrogen
location: package atom
molecule.atom.Hydrogen hydrogen = new molecule.atom.Hydrogen();
^
C:\molecule\ChemTest.java:12: cannot resolve symbol
symbol : class Hydrogen
location: package atom
molecule.atom.Hydrogen hydrogen = new molecule.atom.Hydrogen();
^
C:\molecule\ChemTest.java:13: cannot resolve symbol
symbol : class Sulfur
location: package atom
molecule.atom.Sulfur sulfur = new molecule.atom.Sulfur();
^
C:\molecule\ChemTest.java:13: cannot resolve symbol
symbol : class Sulfur
location: package atom
molecule.atom.Sulfur sulfur = new molecule.atom.Sulfur();
^
16 errors
Please help!!!, thanks!HI,
I tried your problem with the following directory structure:c:\java\ChemTest.java
c:\java\molecule\CarbonDioxide.java
c:\java\molecule\atom\Carbon.javaI set the dos-prompt to c:\java and ran the following commands:javac molecule\CarbonDioxide.java
javac molecule\atom\Carbon.java
javac -classpath . ChemTest.java- and it worked!
Sure, in ChemTest.java I deleted all the lines refering to classes that you didn't post...
I hope this helps you!
Anja -
Need info on the class that is used for BUILHEADER Genil query
Hi All,
Can some one pls let me know the class that is called by executing the query BUILHEADER.
I m facing a strange error, everytime when i search and open any account other than sold to party in WEBUI, I am noticing soldto party in the Roles Assignment block. But the business partner in the backend is not having hte role sold to party. i am not finding how this defaulting is happening automatically.
Any pointers/clues on this will be very very helpful.
Thanks,
UdayaHello Udaya,
The class is CL_BUIL_HEADER Copy it and redifine method GET_RESULT_TABLE.
then goto SPRO I'm not remember exactly where you should change the SAP class into yours.
Sorry it was on ICWC5.0 and not CRM2007
Eli Steklov
Edited by: Eli Steklov on Jul 16, 2008 3:52 PM -
JAXBContext and unmarshaling xml document to a class that came from a jar.
I'm trying to unmarshal, code:
try {
JAXBContext jc = JAXBContext.newInstance(clazz);
Unmarshaller m = jc.createUnmarshaller();
Document doc = XmlUtils.createDom(body);
javax.xml.bind.JAXBElement<T> res = (javax.xml.bind.JAXBElement<T>)m.unmarshal(doc);
return res.getValue();
} catch (JAXBException e) {
Log.exception(e);
now i have an ObjectFactory inside the jar that resolve (xmlRegistry) the correct type.
but the @XmlAccessorType(XmlAccessType.FIELD) binding is not working while the class is comming from a jar.
when i 'Link source' to my project is working fine.
I guess it has something to do with reflection.
the class which i want to unmarshal to looks like this:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "GetSessionIDResponseType", propOrder = {
"sessionID"
public class GetSessionIDResponseType
extends AbstractResponseType
implements Serializable
private final static long serialVersionUID = 12343L;
@XmlElement(name = "SessionID")
protected String sessionID;
* Gets the value of the sessionID property.
* @return
* possible object is
* {@link String }
public String getSessionID() {
return sessionID;
* Sets the value of the sessionID property.
* @param value
* allowed object is
* {@link String }
public void setSessionID(String value) {
this.sessionID = value;
not the field as u can see is protected though it has getter and setter.
anyway i must get the link source project to a jar and i cant do that cause the unmarshal is basically failing.
any idea?
Edited by: 813927 on Nov 20, 2010 6:10 AMI've overcome the problem by adding the unmarsheling code inside the jar.
though i dont the problem i tried to set the fields to be public and it didnt work.
very strange so far. -
Cannot resolve symbol error when compiling a class that calls another class
I've read all the other messages that include "cannot resolve symbol", but no luck. I've got a small app - 3 classes all in the same package. BlackjackDAO and Player compile OK, but BlackjackServlet throws the "cannot resolve symbol" (please see pertinent code below)...
I've tried lots: ant and javac compiling, upgrading my version of tomcat, upgrading my version of jdk/jre, making sure my servlet.jar is being seen by the compiler (at least as far as I can see from the -verbose feedback)...any help would be GREAT! Thanks in advance...
classes: BlackjackServlet, BlackjackDAO, Player
package: myblackjackpackage
tomcat version: 4.1.1.8
jdk version: j2sdk 1.4.0
ant version: 1.4.1
I get the same error message from Ant and Javac...
C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage>javac *.java -verbose
C:\Tomcat4118\src\webapps\helloblackjack>ant all -verbose
compile error:
BlackjackServlet.java:55: cannot resolve symbol
symbol: method addPlayer (javax.servlet.http.HttpServletRequest,javax.servlet.http.Http
ServletResponse)
location: class myblackjackpackage.BlackjackServlet
addPlayer(request, response);
^
My code is:
package myblackjackpackage;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.lang.*;
/** controller servlet in a web based blackjack game application @author Ethan Harlow */
public class BlackjackServlet extends HttpServlet {
private BlackjackDAO theBlackjackDAO;
public void init() throws ServletException {
String driver = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
String dbUrl = "jdbc:microsoft:sqlserver://localhost:1433";
String userid = "testlogin";
String passwrd = "testpass";
try {
theBlackjackDAO = new BlackjackDAO(driver, dbUrl, userid, passwrd);
catch (IOException exc) {
System.err.println(exc.toString());
catch (ClassNotFoundException cnf) {
System.err.println(cnf.toString());
catch (SQLException seq) {
System.err.println(seq.toString());
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String command = request.getParameter("command");
if (command == null || (command.equals("stats"))) {
else if (command.equals("add")) {
try {
//the following line is caught by compiler
addPlayer(request, response);
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<body>");
out.println("<p>Hi, your command was " + request.getParameter("command") + "!!!</p>");
out.println("</body>");
out.println("</html>");
catch (Exception exc) {
System.err.println(exc.toString());
else if (command.equals("play")) {
else if (command.equals("bet")) {
else if (command.equals("hit")) {
else if (command.equals("stand")) {
else if (command.equals("split")) {
else if (command.equals("double")) {
else if (command.equals("dealerdecision")) {
else if (command.equals("reinvest")) {
else if (command.equals("changebet")) {
else if (command.equals("deal")) {
package myblackjackpackage;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.lang.*;
public class BlackjackDAO {
private Connection myConn;
public BlackjackDAO(String driver, String dbUrl, String userid, String passwrd)
throws IOException, ClassNotFoundException, SQLException {
System.out.println("Loading driver: " + driver);
Class.forName(driver);
System.out.println("Connection to: " + dbUrl);
myConn = DriverManager.getConnection(dbUrl, userid, passwrd);
System.out.println("Connection successful!");
public void addPlayer(HttpServletRequest request, HttpServletResponse response)
throws IOException, SQLException {
//I've commented out all my code while debugging, so I didn't include
//any here
compiler feedback
C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage>javac *.java -verbose
[parsing started BlackjackDAO.java]
[parsing completed 90ms]
[parsing started BlackjackServlet.java]
[parsing completed 10ms]
[parsing started Player.java]
[parsing completed 10ms]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/Object.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/sql/Connection.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/String.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/io/IOException.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/ClassNotFoundException.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/sql/SQLException.class)]
[loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/http/HttpServletRequ
est.class)]
[loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/http/HttpServletResp
onse.class)]
[loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/http/HttpServlet.cla
ss)]
[loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/GenericServlet.class
[loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/Servlet.class)]
[loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/ServletConfig.class)
[loading c:\j2sdk14003\jre\lib\rt.jar(java/io/Serializable.class)]
[loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/ServletException.cla
ss)]
[checking myblackjackpackage.BlackjackDAO]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/Throwable.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/Exception.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/System.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/io/PrintStream.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/io/FilterOutputStream.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/io/OutputStream.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/Class.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/sql/DriverManager.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/util/Properties.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/Error.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/RuntimeException.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/StringBuffer.class)]
[wrote BlackjackDAO.class]
[checking myblackjackpackage.BlackjackServlet]
[loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/ServletRequest.class
BlackjackServlet.java:55: cannot resolve symbol
symbol : method addPlayer (javax.servlet.http.HttpServletRequest,javax.servlet
.http.HttpServletResponse)
location: class myblackjackpackage.BlackjackServlet
addPlayer(request, response);
^
[loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/ServletResponse.clas
s)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/io/PrintWriter.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/io/Writer.class)]
[checking myblackjackpackage.Player]
[total 580ms]
1 error
C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage>
and here's the ant feedback...
C:\Tomcat4118\src\webapps\helloblackjack>ant all -verbose
Ant version 1.4.1 compiled on October 11 2001
Buildfile: build.xml
Detected Java version: 1.4 in: c:\j2sdk14003\jre
Detected OS: Windows 2000
parsing buildfile C:\Tomcat4118\src\webapps\helloblackjack\build.xml with URI =
file:C:/Tomcat4118/src/webapps/helloblackjack/build.xml
Project base dir set to: C:\Tomcat4118\src\webapps\helloblackjack
Build sequence for target `all' is [clean, prepare, compile, all]
Complete build sequence is [clean, prepare, compile, all, javadoc, deploy, dist]
clean:
[delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build
[delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\images\a_s.g
if
[delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\images\q_s.g
if
[delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build\im
ages
[delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\index.html
[delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\newplayer.ht
ml
[delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-INF\clas
ses\myblackjackpackage\BlackjackDAO.class
[delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build\WE
B-INF\classes\myblackjackpackage
[delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build\WE
B-INF\classes
[delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-INF\web.
xml
[delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build\WE
B-INF
[delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build
prepare:
[mkdir] Created dir: C:\Tomcat4118\src\webapps\helloblackjack\build
[copy] images\a_s.gif added as C:\Tomcat4118\src\webapps\helloblackjack\bui
ld\images\a_s.gif doesn't exist.
[copy] images\q_s.gif added as C:\Tomcat4118\src\webapps\helloblackjack\bui
ld\images\q_s.gif doesn't exist.
[copy] index.html added as C:\Tomcat4118\src\webapps\helloblackjack\build\i
ndex.html doesn't exist.
[copy] newplayer.html added as C:\Tomcat4118\src\webapps\helloblackjack\bui
ld\newplayer.html doesn't exist.
[copy] WEB-INF\web.xml added as C:\Tomcat4118\src\webapps\helloblackjack\bu
ild\WEB-INF\web.xml doesn't exist.
[copy] omitted as C:\Tomcat4118\src\webapps\helloblackjack\build is up to
date.
[copy] images added as C:\Tomcat4118\src\webapps\helloblackjack\build\image
s doesn't exist.
[copy] WEB-INF added as C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-
INF doesn't exist.
[copy] Copying 5 files to C:\Tomcat4118\src\webapps\helloblackjack\build
[copy] Copying C:\Tomcat4118\src\webapps\helloblackjack\web\images\q_s.gif
to C:\Tomcat4118\src\webapps\helloblackjack\build\images\q_s.gif
[copy] Copying C:\Tomcat4118\src\webapps\helloblackjack\web\images\a_s.gif
to C:\Tomcat4118\src\webapps\helloblackjack\build\images\a_s.gif
[copy] Copying C:\Tomcat4118\src\webapps\helloblackjack\web\index.html to C
:\Tomcat4118\src\webapps\helloblackjack\build\index.html
[copy] Copying C:\Tomcat4118\src\webapps\helloblackjack\web\newplayer.html
to C:\Tomcat4118\src\webapps\helloblackjack\build\newplayer.html
[copy] Copying C:\Tomcat4118\src\webapps\helloblackjack\web\WEB-INF\web.xml
to C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-INF\web.xml
compile:
[mkdir] Created dir: C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-INF\
classes
[javac] myblackjackpackage\BlackjackDAO.class skipped - don't know how to ha
ndle it
[javac] myblackjackpackage\BlackjackDAO.java added as C:\Tomcat4118\src\weba
pps\helloblackjack\build\WEB-INF\classes\myblackjackpackage\BlackjackDAO.class d
oesn't exist.
[javac] myblackjackpackage\BlackjackServlet.java added as C:\Tomcat4118\src\
webapps\helloblackjack\build\WEB-INF\classes\myblackjackpackage\BlackjackServlet
.class doesn't exist.
[javac] myblackjackpackage\Player.java added as C:\Tomcat4118\src\webapps\he
lloblackjack\build\WEB-INF\classes\myblackjackpackage\Player.class doesn't exist
[javac] Compiling 3 source files to C:\Tomcat4118\src\webapps\helloblackjack
\build\WEB-INF\classes
[javac] Using modern compiler
[javac] Compilation args: -d C:\Tomcat4118\src\webapps\helloblackjack\build\
WEB-INF\classes -classpath
"C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-I
NF\classes;
C:\tomcat4118\common\classes;
C:\tomcat4118\common\lib\activation.jar;
C:\tomcat4118\common\lib\ant.jar;
C:\tomcat4118\common\lib\commons-collections.jar;
C:\tomcat4118\common\lib\commons-dbcp.jar;
C:\tomcat4118\common\lib\commons-logging-api.jar;
C:\tomcat4118\common\lib\commons-pool.jar;
C:\tomcat4118\common\lib\jasper-compiler.jar;
C:\tomcat4118\common\lib\jasper-runtime.jar;
C:\tomcat4118\common\lib\jdbc2_0-stdext.jar;
C:\tomcat4118\common\lib\jndi.jar;
C:\tomcat4118\common\lib\jta.jar;
C:\tomcat4118\common\lib\mail.jar;
C:\tomcat4118\common\lib\mysql_uncomp.jar;
C:\tomcat4118\common\lib\naming-common.jar;
C:\tomcat4118\common\lib\naming-factory.jar;
C:\tomcat4118\common\lib\naming-resources.jar;
C:\tomcat4118\common\lib\servlet.jar;
C:\tomcat4118\common\lib\tools.jar;
C:\j2sdk14003\lib\tools.jar;
C:\tomcat4118\ant141\lib\servlet.jar;
C:\tomcat4118\ant141\lib\jaxp.jar;
C:\tomcat4118\ant141\lib\crimson.jar;
C:\tomcat4118\ant141\lib\ant.jar;
C:\Tomcat4118\src\webapps\helloblackjack;
C:\mysql\jdbc_dvr\mm.mysql.jdbc-1.2c;
C:\Program Files\SQLserverjdbcdriver\lib\msbase.jar;
C:\Program Files\SQLserverjdbcdriver\lib\msutil.jar;
C:\Program Files\SQLserverjdbcdriver\lib\mssqlserver.jar"
-sourcepath C:\Tomcat4118\src\webapps\helloblackjack\src -g -O
[javac] Files to be compiled:
C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage\BlackjackDAO
.java
C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage\BlackjackSer
vlet.java
C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage\Player.java
[javac] C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage\Blac
kjackServlet.java:55: cannot resolve symbol
[javac] symbol : method addPlayer (javax.servlet.http.HttpServletRequest,j
avax.servlet.http.HttpServletResponse)
[javac] location: class myblackjackpackage.BlackjackServlet
[javac] addPlayer(request, response);
[javac] ^
[javac] 1 error
BUILD FAILED
C:\Tomcat4118\src\webapps\helloblackjack\build.xml:212: Compile failed, messages
should have been provided.
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:559)
at org.apache.tools.ant.Task.perform(Task.java:217)
at org.apache.tools.ant.Target.execute(Target.java:184)
at org.apache.tools.ant.Target.performTasks(Target.java:202)
at org.apache.tools.ant.Project.executeTarget(Project.java:601)
at org.apache.tools.ant.Project.executeTargets(Project.java:560)
at org.apache.tools.ant.Main.runBuild(Main.java:454)
at org.apache.tools.ant.Main.start(Main.java:153)
at org.apache.tools.ant.Main.main(Main.java:176)
Total time: 1 second
C:\Tomcat4118\src\webapps\helloblackjack>yes!
early on i tried: BlackjackDAO.addPlayer(request, response);
instead of: theBlackjackDAO.addPlayer(request, response);
you rock - thanks a ton -
Error- DBMS_STANDARD package must be created before using PL/SQL
HI
I am trying to run a very small and simple program on my Oracle81 personal edition on Win98.
I get this error when i want to execute the program
" package DBMS_STANDARD must be created before using PL/SQL "
What should i do to create the package??
Thank you
LinThe Member Feedback forum is for suggestions and feedback for OTN Developer Services. This forum is not monitored by Oracle support or product teams and so Oracle product and technology related questions will not be answered. We recommend that you post this question to the Database - General forum or the Installation forum.
The URLs are:
General Database Discussions
and
Database Installation -
NoSuchfieldName error while compiling a class that was produced by sqlj
hello all,
could you please tell me where the following error code came from when i
tried to execute java TestInstallSQLJ?
I could use sqlj TestInstallSQLJ.sqlj to translate it into java code, but
then....
thank you for your help.
Exception in thread "main" java.lang.NoSuchFieldError
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Error.<init>(Error.java:50)
at java.lang.LinkageError.<init>(LinkageError.java:43)
at
java.lang.IncompatibleClassChangeError.<init>(IncompatibleClassChangeError.java:43)
at java.lang.NoSuchFieldError.<init>(NoSuchFieldError.java:45)
at
oracle.sqlj.runtime.OraDynamicClosure.getSQLType(OraDynamicClosure.java:68)
at
oracle.sqlj.runtime.OraBasicClosure.<init>(OraBasicClosure.java:47)
at
oracle.sqlj.runtime.OraClosureFactory.addStandardTypes(OraClosureFactory.java:138)
at
oracle.sqlj.runtime.OraClosureFactory.get81Closures(OraClosureFactory.java:50)
at
oracle.sqlj.runtime.OraClosureFactory.getTypeClosures(OraClosureFactory.java:33)
at
oracle.sqlj.runtime.OraCustomization.getProfile(OraCustomization.java:95)
at
oracle.sqlj.runtime.OraCustomization.getProfile(OraCustomization.java:87)
at sqlj.runtime.profile.ref.ProfileImpl.getConnectedProfile(Compiled
Code)
at
sqlj.runtime.ref.ProfileGroup$ConnectedGroup.getProfile(ProfileGroup.java:154)
at
sqlj.runtime.ref.ConnectionContextImpl.getConnectedProfile(ConnectionContextImpl.java:183)
at
sqlj.runtime.ExecutionContext.registerStatement(ExecutionContext.java:279)
at TestInstallSQLJ.runExample(Compiled Code)
at TestInstallSQLJ.main(TestInstallSQLJ.java:56)following is my environment:
sqlj -version-long
Oracle SQLJ Release 8.1.6.0.0 - SDK
Build version: 1.0.4.4 - Built on Apr 14, 1999
IDE interface version: 8.1.6.0.0/1.0.4.4
JDBC version: non Oracle driver version 0.0 (0.0.0.0)
java -version
java version "1.2.1"
Solaris VM (build Solaris_JDK_1.2.1_03, native threads, sunwjit)
echo $PATH
a long path +
/examples/sqlj/bin
echo $CLASSPATH
a long CLASSPATH +
/examples/sqlj/lib/translator.zip:
oracle JDBC driver8.1.7
it translated my sqlj files but then it can't interprete my java classes.
thank you a lot for your help -
Certificate error on the second exchange that is used as a proxy for internet facing
Hello friends ,
I have one just like it ( http://faragesolutions.files.wordpress.com/2013/04/proxy.jpg?w=650 ) scenario . Using two Exchange , only one of them is accessed as a proxy .
In Exchange that is facing internet , I use a digital certificate with the public domain ( webmail.name.com ) and my OWA is configured to ( External: webmail.name.com ) and Internal : webmail.name.com ) .
You Exchange that are not face to internet , OWA is configured to ( External: empty) and ( Internal : servername.local ) . This Exchange user when connecting with Outlook client is generating validation error name ( servername.local ) , because as I'm using
the same Exchange certificate that is facing internet . So the audience is trying to validate the certificate name that is not registered as an alternative name.
question : the exchange that is not facing the internet, I need to use the same public certificate that is in exchange that is facing the internet? or can I just use an internal certificate?
Thank you.The names that go on the certificate must match the names you planned when you did the CAS namespace design.
Some details here:http://blogs.technet.com/b/exchange/archive/2014/02/28/namespace-planning-in-exchange-2013.aspx
So in your case if the cert does not match the name, then this will prompt users with errors. They need to match. As long as all your internal devices trust the issuer of the internal CA then you can use that. Installing an
enterprise CA will automatically publish it's root CA public cert into AD so it works easily.
Cheers,
Rhoderick
Microsoft Senior Exchange PFE
Blog:
http://blogs.technet.com/rmilne
Twitter: LinkedIn:
Facebook:
XING:
Note: Posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. -
Dynamic class loading problem using unknown JAR archive and directory names
I read the following article, which enlightened me a lot:
Ted Neward: Understanding Class.forName().
However, it took me some while to understand that my problem is the other way around:
I know the name of the class, I know the name of the method,
but my program/JVM does not know where to load the classes from.
Shortly, my problem is that the server engine that I am writing
uses two different versions of the same library.
So I am trying out the following solution:
My program is named TestClassPathMain.java
Assume the two libraries are named JAR1.jar and JAR2.jar
and the class/instance method that should
be exposed to TestClassPathMain.java by them is named
TestClass1.testMethod().
As long as I was depending on just one library,
I put JAR1.jar in the classpath before starting java,
and I was happy for a while.
At the moment I got the need to use another version of
TestClass1.testMethod() packaged in JAR2.jar,
a call would always access JAR1.jar's
TestClass1.testMethod().
I then decided to remove JAR1.jar from the classpath,
and programmatically define two separate ClassLoaders, one for use
with JAR1.jar and the other for use with JAR2.jar.
However, the problem is only partly solved.
Please refer to the enclosed code for details.
(The code in the JAR1.jar/JAR2.jar is extremely simple,
it just tells (by hardcoding) the name of the jar it is packaged in
and instantiates another class packaged in the same jar using
the "new" operator and calls a method on it. I don't enclose it.)
The TestClassPathMain.java/UC1.java/UC2.java code suite was
successfully compiled with an arbitrary of JAR1 or JAR2 in the classpath,
however removed from the classpath at runtime.
(I know that this could have been done (more elegantly...?) by producing an Interface,
but I think the main problem principle is still untouched by this potential lack of elegancy(?))
1) This problem should not be unknown to you experts out there,
how is it generally and/or most elegantly solved?
The "*** UC2: Variant 2" is the solution I would like best, had it only worked.
2) And why arent "*** UC2: Variant 2" and
"*** static UC2: Variant 2" working,
while "*** Main: Variant 2" is?
3) And a mal-apropos:
Why can't I catch the NoClassDefFoundError?
The output:
*** Main: Variant 1 JAR 1 ***:
Entering TestClass1.testMethod() packaged in JAR1.jar
About to instantiate TestClass2 with the new operator
About to call TestClass2.testMethod()
Entering TestClass2.testMethod() packaged in JAR1.jar
*** Main: Variant 1 JAR 2 ***:
Entering TestClass1.testMethod() packaged in JAR2.jar
About to instantiate TestClass2 with the new operator
About to call TestClass2.testMethod()
Entering TestClass2.testMethod() packaged in JAR2.jar
*** Main: Variant 2 JAR 1 ***:
Entering TestClass1.testMethod() packaged in JAR1.jar
About to instantiate TestClass2 with the new operator
About to call TestClass2.testMethod()
Entering TestClass2.testMethod() packaged in JAR1.jar
*** Main: Variant 2 JAR 2 ***:
Entering TestClass1.testMethod() packaged in JAR2.jar
About to instantiate TestClass2 with the new operator
About to call TestClass2.testMethod()
Entering TestClass2.testMethod() packaged in JAR2.jar
*** UC1: Variant 1 JAR 1 ***:
Entering TestClass1.testMethod() packaged in JAR1.jar
About to instantiate TestClass2 with the new operator
About to call TestClass2.testMethod()
Entering TestClass2.testMethod() packaged in JAR1.jar
*** UC1: Variant 1 JAR 2 ***:
Entering TestClass1.testMethod() packaged in JAR2.jar
About to instantiate TestClass2 with the new operator
About to call TestClass2.testMethod()
Entering TestClass2.testMethod() packaged in JAR2.jar
*** static UC2: Variant 2 JAR 1 ***:
Exception in thread "main" java.lang.NoClassDefFoundError: TestClass1
at UC2.runFromJarVariant2_static(UC2.java:56)
at TestClassPathMain.main(TestClassPathMain.java:52)
TestClassPathMain.java
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
public class TestClassPathMain {
public static void main(final String args[]) throws MalformedURLException, ClassNotFoundException, InstantiationException, SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
// Commented out because I cannot catch the NoClassDefFoundError.
// Why?
try {
final TestClass1 testClass1 = new TestClass1();
System.out.println(
"\nThe class TestClass1 is of some unexplicable reason available." +
"\nFor the purpose of the test, it shouldn't have been!" +
"\nExiting");
System.exit(1);
} catch (NoClassDefFoundError e) {
System.out.println("\nPositively confirmed that the class TestClass1 is not available:\n" + e);
System.out.println("\n\nREADY FOR THE TEST: ...");
// Works fine
System.out.println("\n*** Main: Variant 1 JAR 1 ***:");
runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP1/JAR1.jar");
System.out.println("\n*** Main: Variant 1 JAR 2 ***:");
runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP2/JAR2.jar");
// Works fine
System.out.println("\n*** Main: Variant 2 JAR 1 ***:");
runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP1/JAR1.jar");
System.out.println("\n*** Main: Variant 2 JAR 2 ***:");
runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP2/JAR2.jar");
// Works fine
final UC1 uc1 = new UC1();
System.out.println("\n*** UC1: Variant 1 JAR 1 ***:");
uc1.runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP1/JAR1.jar");
System.out.println("\n*** UC1: Variant 1 JAR 2 ***:");
uc1.runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP2/JAR2.jar");
// Crashes
System.out.println("\n*** static UC2: Variant 2 JAR 1 ***:");
UC2.runFromJarVariant2_static("file:/W:/java/eclipse/workspaces/simped_test/CP1/JAR1.jar");
System.out.println("\n*** static UC2: Variant 2 JAR 2 ***:");
UC2.runFromJarVariant2_static("file:/W:/java/eclipse/workspaces/simped_test/CP2/JAR2.jar");
// Crashes
final UC2 uc2 = new UC2();
System.out.println("\n*** UC2: Variant 2 JAR 1 ***:");
uc2.runFromJarVariant2("file:/W:/java/eclipse/workspaces/simped_test/CP1/JAR1.jar");
System.out.println("\n*** UC2: Variant 2 JAR 2 ***:");
uc2.runFromJarVariant2("file:/W:/java/eclipse/workspaces/simped_test/CP2/JAR2.jar");
private static void runFromJarVariant1(final String jarFileURL)
throws MalformedURLException,
ClassNotFoundException,
InstantiationException,
IllegalArgumentException,
IllegalAccessException,
InvocationTargetException,
SecurityException,
NoSuchMethodException {
final URL url = new URL(jarFileURL);
final URLClassLoader cl =
new URLClassLoader(new URL[]{url},
Thread.currentThread().getContextClassLoader());
final Class clazz = cl.loadClass("TestClass1");
final Object testClass1 = clazz.newInstance();
final Method testMethod1 = clazz.getMethod("testMethod", null);
testMethod1.invoke(testClass1, null);
private static void runFromJarVariant2(final String jarFileURL)
throws MalformedURLException,
ClassNotFoundException,
InstantiationException,
IllegalArgumentException,
IllegalAccessException,
InvocationTargetException,
SecurityException,
NoSuchMethodException {
final URL url = new URL(jarFileURL);
final URLClassLoader cl =
new URLClassLoader(new URL[]{url},
Thread.currentThread().getContextClassLoader());
final Class clazz = cl.loadClass("TestClass1");
final TestClass1 testClass1 = new TestClass1();
testClass1.testMethod();
UC1.java
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
public class UC1 {
public void runFromJarVariant1(final String jarFileURL)
throws MalformedURLException,
ClassNotFoundException,
InstantiationException,
IllegalArgumentException,
IllegalAccessException,
InvocationTargetException,
SecurityException,
NoSuchMethodException {
final URL url = new URL(jarFileURL);
final URLClassLoader cl =
new URLClassLoader(new URL[]{url},
Thread.currentThread().getContextClassLoader());
final Class clazz = cl.loadClass("TestClass1");
final Object testClass1 = clazz.newInstance();
final Method testMethod1 = clazz.getMethod("testMethod", null);
testMethod1.invoke(testClass1, null);
UC2.java
import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
public class UC2 {
public void runFromJarVariant2(final String jarFileURL)
throws MalformedURLException,
ClassNotFoundException,
InstantiationException,
IllegalArgumentException,
IllegalAccessException,
InvocationTargetException,
SecurityException,
NoSuchMethodException {
final URL url = new URL(jarFileURL);
final URLClassLoader cl =
new URLClassLoader(new URL[]{url},
Thread.currentThread().getContextClassLoader());
final Class clazz = cl.loadClass("TestClass1");
final TestClass1 testClass1 = new TestClass1();
testClass1.testMethod();
* Identic to the "runFromJarVariant2" method,
* except that it is static
public static void runFromJarVariant2_static(final String jarFileURL)
throws MalformedURLException,
ClassNotFoundException,
InstantiationException,
IllegalArgumentException,
IllegalAccessException,
InvocationTargetException,
SecurityException,
NoSuchMethodException {
final URL url = new URL(jarFileURL);
final URLClassLoader cl =
new URLClassLoader(new URL[]{url},
Thread.currentThread().getContextClassLoader());
final Class clazz = cl.loadClass("TestClass1");
final TestClass1 testClass1 = new TestClass1();
testClass1.testMethod();
}2. i need to load the class to the same JVM (i.e. to
the same environment) of the current running
aplication, so that when the loaded class is run, it
would be able to invoke methods on it!!!
ClassLoader(s) do this. Try the URLClassLoader.
(I was talking about relatively esoteric "security"
issues when I mentioned the stuff about Class objects
"scope".) You might use the URLClassLoader kind of
like this.
Pseudo-code follows:
// setup the class loader
URL[] urls = new URL[1];
urls[0] = new URL("/path/to/dynamic/classes");
URLClassLoader ucl = new URLClassLoader(urls);
// load a class & use make an object with the default constructor
Object tmp = ucl.loadClass("dynamic.class.name").newInstance();
// Cast the object to a know interface so that you can use it.
// This may be used to further determine which interface to cast
// the class to. Or it may simply be the interface to which all
// dynamic classes have to conform in your program.
InterfaceImplementedByDynamicClass loadedObj =
(InterfaceImplementedByDynamicClass)tmp;It's really not as hard as it sounds, just write a little test of
this and you will see how it works. -
JSC can't seem to find classes that are in my jar files.
Yet when I manually insert the imports and do a build, it all works.
So JSC isn't seeing something that ant is seeing.
This has happened before, and it's frustrating. What can I do?
I've removed and re-added the jar file that the referenced classes are in.
I am getting this in the JSC log file:
[org.netbeans.javacore] Rebooting storage for jar:file:/home/tc/sun/misc/Creator2/rave2.0/modules/ext/webui.jar!/ because of a fatal error during storage mount.
[org.netbeans.javacore] INFORMATIONAL *********** Exception occurred ************ at 9:56 AM on Feb 21, 2006
java.lang.IllegalStateException
at org.netbeans.modules.javacore.jmiimpl.javamodel.JavaPackageImpl.addRealPackage(JavaPackageImpl.java:124)
at org.netbeans.modules.javacore.jmiimpl.javamodel.JavaPackageClassImpl.addRealPackage(JavaPackageClassImpl.java:161)
at org.netbeans.modules.javacore.jmiimpl.javamodel.JavaPackageClassImpl.addRealPackage(JavaPackageClassImpl.java:156)
at org.netbeans.modules.javacore.jmiimpl.javamodel.JavaPackageClassImpl.addAllRealPackages(JavaPackageClassImpl.java:166)
[catch] at org.netbeans.modules.javacore.JMManager.resolveCPRoot(JMManager.java:941)
at org.netbeans.modules.javacore.JMManager.resolveCodebases(JMManager.java:794)
at org.netbeans.modules.javacore.JMManager$2.run(JMManager.java:748)
at org.openide.util.Task.run(Task.java:189)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:330)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:721)Ok, now it seems like it can't find anything in any of the jar files that I've added to the
project. -
Classloader that can use embedded .jar files?
Hey all,
Has anyone had a need like myself to be able to jar up everything including embedded .jar files, and have the code in the "outter" .jar file use code from any of the inner embedded .jar files without the need to unjar the outter jar to disk? It seems this is not possible. Even if I put the embeded .jar files in the manifest.mf file in the Class-Path section, it does NOT find classes in the embedded .jar files. Instead, it only finds them if I unjar the outter .jar file to disk!
I would love to know if there is a custom classloader written that will find and use classes from embedded .jar files without the need to unjar them.
Thanks.Is there any web appliction server or j2ee server that has their own classloader to dynamically extract and hunt down things within a .ear or .war file without unarchiving it to disk? It appears that everyone I have ever seen creates a temporary file on disk.
A fellow colleague of mine indicated that with today's computer speeds, it is actually faster in most cases to read/decompress on the fly in memory than it is to decompress to disk, then read from disk. The reason being that one of the biggest bottlenecks is IO. Reading an uncompressed file from disk may be slower than reading a compressed file from disk. The IO is slow, but the speed of a largely compressed file to uncompress is faster than reading the entire thing from the HD. This may not always be the case. Considering OS caching of recent file use from the HD, etc. -
Error in Muenchian method in XSLT mapping using sapxmltoolkit.jar
Hi,
The following example produces a different result in SAP from that of Altova, Microsoft providers. It is a resonably complex Muenchian transformation that I have reduced this to the core issue:
Have tried with SP14 but same result on every delivered version of sapxmltoolit.jar
I am trying to extract a unique set of locationCodes to assemble an IDOC for each locationCode - breaking out the relevant order lines.
<b>My question is twofold:</b>
a) is the behaviour of sapxmltoolkit errannt to the spec?
b) is there another way to produce this list or work around?
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" indent="yes"/>
<xsl:key name="partner-ids" match="PRODQNTY/LOCNQNTY" use="locationCode"/>
<xsl:template name="buildIdoc" match="ORDER">
<ORDERS05>
<xsl:for-each select="PRODQNTY/LOCNQNTY[count(.|key('partner-ids',locationCode)[1])=1]">
<xsl:sort select="locationCode" data-type="number"/>
<xsl:comment><xsl:value-of select="locationCode"/> Location Code</xsl:comment>
<xsl:comment><xsl:value-of select="../lineNo"/> Line Number</xsl:comment>
<IDOC BEGIN="1"></IDOC>
</xsl:for-each>
</ORDERS05>
</xsl:template>
</xsl:stylesheet>
<b>Sample input document:</b>
?xml version="1.0"?>
<ORDER loops-id="ORDER">
<PRODQNTY loops-id="PRODQNTY">
<lineNo>1</lineNo>
<productCode>9990007454</productCode>
<LOCNQNTY>
<locationCode>001</locationCode>
<quantityOrdered>6</quantityOrdered>
</LOCNQNTY>
<LOCNQNTY>
<locationCode>004</locationCode>
<quantityOrdered>3</quantityOrdered>
</LOCNQNTY>
<LOCNQNTY>
<locationCode>005</locationCode>
<quantityOrdered>2</quantityOrdered>
</LOCNQNTY>
<LOCNQNTY>
<locationCode>006</locationCode>
<quantityOrdered>1</quantityOrdered>
</LOCNQNTY>
<LOCNQNTY>
<locationCode>007</locationCode>
<quantityOrdered>1</quantityOrdered>
</LOCNQNTY>
<LOCNQNTY>
<locationCode>009</locationCode>
<quantityOrdered>3</quantityOrdered>
</LOCNQNTY>
<LOCNQNTY>
<locationCode>021</locationCode>
<quantityOrdered>1</quantityOrdered>
</LOCNQNTY>
<LOCNQNTY>
<locationCode>082</locationCode>
<quantityOrdered>2</quantityOrdered>
</LOCNQNTY>
<unDefData></unDefData>
<segmentCount>0</segmentCount>
</PRODQNTY>
<PRODQNTY loops-id="PRODQNTY">
<lineNo>2</lineNo>
<productCode>1864503696</productCode>
<LOCNQNTY>
<locationCode>001</locationCode>
<quantityOrdered>4</quantityOrdered>
</LOCNQNTY>
<LOCNQNTY>
<locationCode>004</locationCode>
<quantityOrdered>2</quantityOrdered>
</LOCNQNTY>
<LOCNQNTY>
<locationCode>005</locationCode>
<quantityOrdered>2</quantityOrdered>
</LOCNQNTY>
<LOCNQNTY>
<locationCode>006</locationCode>
<quantityOrdered>1</quantityOrdered>
</LOCNQNTY>
<LOCNQNTY>
<locationCode>007</locationCode>
<quantityOrdered>1</quantityOrdered>
</LOCNQNTY>
<LOCNQNTY>
<locationCode>009</locationCode>
<quantityOrdered>1</quantityOrdered>
</LOCNQNTY>
<LOCNQNTY>
<locationCode>021</locationCode>
<quantityOrdered>1</quantityOrdered>
</LOCNQNTY>
<LOCNQNTY>
<locationCode>082</locationCode>
<quantityOrdered>1</quantityOrdered>
</LOCNQNTY>
</PRODQNTY>
</ORDER>
<b>Expected Output:</b> - from Altova - 1 record per locationCode
<?xml version="1.0" encoding="UTF-8"?>
<ORDERS05>
<!--001 Location Code-->
<!--1 Line Number-->
<IDOC BEGIN="1" />
<!--004 Location Code-->
<!--1 Line Number-->
<IDOC BEGIN="1" />
<!--005 Location Code-->
<!--1 Line Number-->
<IDOC BEGIN="1" />
<!--006 Location Code-->
<!--1 Line Number-->
<IDOC BEGIN="1" />
<!--007 Location Code-->
<!--1 Line Number-->
<IDOC BEGIN="1" />
<!--009 Location Code-->
<!--1 Line Number-->
<IDOC BEGIN="1" />
<!--021 Location Code-->
<!--1 Line Number-->
<IDOC BEGIN="1" />
<!--082 Location Code-->
<!--1 Line Number-->
<IDOC BEGIN="1" />
</ORDERS05>
<b>Output from sapxmltoolkit.jar</b> - 1 record per locationCode per PRODQNTY line so I get a non unique set of locationCodes: (every location twice in this example - and with 16 order lines, every location 16 times and 128 IDOCs (instead of 8 IDOCs).
<?xml version="1.0" encoding="utf-8"?>
<ORDERS05>
<!--001 Location Code-->
<!--1 Line Number-->
<IDOC BEGIN="1"/>
<!--001 Location Code-->
<!--2 Line Number-->
<IDOC BEGIN="1"/>
<!--004 Location Code-->
<!--1 Line Number-->
<IDOC BEGIN="1"/>
<!--004 Location Code-->
<!--2 Line Number-->
<IDOC BEGIN="1"/>
<!--005 Location Code-->
<!--1 Line Number-->
<IDOC BEGIN="1"/>
<!--005 Location Code-->
<!--2 Line Number-->
<IDOC BEGIN="1"/>
<!--006 Location Code-->
<!--1 Line Number-->
<IDOC BEGIN="1"/>
<!--006 Location Code-->
<!--2 Line Number-->
<IDOC BEGIN="1"/>
<!--007 Location Code-->
<!--1 Line Number-->
<IDOC BEGIN="1"/>
<!--007 Location Code-->
<!--2 Line Number-->
<IDOC BEGIN="1"/>
<!--009 Location Code-->
<!--1 Line Number-->
<IDOC BEGIN="1"/>
<!--009 Location Code-->
<!--2 Line Number-->
<IDOC BEGIN="1"/>
<!--021 Location Code-->
<!--1 Line Number-->
<IDOC BEGIN="1"/>
<!--021 Location Code-->
<!--2 Line Number-->
<IDOC BEGIN="1"/>
<!--082 Location Code-->
<!--1 Line Number-->
<IDOC BEGIN="1"/>
<!--082 Location Code-->
<!--2 Line Number-->
<IDOC BEGIN="1"/>
</ORDERS05>A bit more heartache & trials and I solved it
The key defition is unstable in XSLT the way I defined it
Simple change to the XSLT: remove the PRODQNTY node reference from the match attribute:
<b>incorrect key:</b>
<xsl:key name="partner-ids" match="PRODQNTY/LOCNQNTY" use="locationCode"/>
<b>correct key:</b>
<xsl:key name="partner-ids" match="LOCNQNTY" use="locationCode"/>
And the "group-by or Muenchian method" loop statement:
<xsl:for-each select="PRODQNTY/LOCNQNTY[count(.|key('partner-ids',locationCode)[1])=1]">
Hopes this helps someone else....
Regds Doug. -
Cannot compile two classes that are on same package
When I compile two classes that are on same package one class that is independent of other class gets compiled but the other class which uses
the first one shows cannot find symbol error with the first class nametry...
javac *.java
that should compile all the java files in that folder at the same time. I dont know if that will fix your problem but it is worth a shot.
Maybe you are looking for
-
Personalize Option Problem In Windows 8.1
Hi. I'm using genuine windows 8.1 pro. I downloaded windows 8.1 pro from my dream spark account. But I'm missing some features in my windows 8.1 pro. Personalize Option is still like windows 8 personalize option. I can't change the background of metr
-
How to force a failsafe mode in runlevel 3 (kdm) [SOLVED]
This is probably quite basic but I am wondering how I can get a console after X is hanging (last xorg-server update with catalys). The usual c-m-f1 is not working. I don't seem to be able to kill X with c-m-delete either. I would like to force a run
-
can anybody tell me what is actually despatch advice?
-
Why is Adobe Ideas FREE?
Hej, Just simple question This is amazing app... not AMAZING!!!! app and I would like to see a lot of new cool features... Having small payment, or pay for plug-in will support this project and maybe make it more wider (ex: recreate Android version)
-
I have a form that I have made fillable, however somewhere on the form is a font that isn't embedded. When I click thru all the text they all say they are embedded, but the document properties has two that aren't embedded. Is there an easy way to fin