No utl_dbws.jar in classpath!...no really...
I am trying to complete the this user guide http://www.oracle.com/technology/sample_code/tech/java/jsp/callout_users_guide.htm
and all it's fine until this
C:\Documents and Settings\florinp\My Documents\wsdl>jpub -u infows/infows@oradev
-sysuser sys/sinoptix -proxywsdl=TemperatureService.wsdl -endpoint=http://servi
ces.xmethods.net:80/soap/servlet/rpcrouter -proxyopts=soap,tabfun -dir=weather -
plsqlpackage=soap_ws_extern
oracle.jpub.JPubException: Error: Cannot run the WebServices assembler for the g
iven wsdl file. Please make sure that sqlj/lib/utl_dbws.jar appear in the classp
ath.
at oracle.jpub.genproxy.GenProxy.compileWSDL(GenProxy.java:1236)
at oracle.jpub.genproxy.GenProxy.generateProxy(GenProxy.java:141)
at oracle.jpub.Doit.main(Doit.java:331)
at oracle.jpub.Doit.main(Doit.java:52)
at oracle.jpub.publish.Main.main(Main.java:9)
at oracle.jpub.Main.main(Main.java:6)
J2T-106, ERROR: Sorry, unable to continue due to oracle.jpub.JPubException: Erro
r: Cannot run the WebServices assembler for the given wsdl file. Please make sur
e that sqlj/lib/utl_dbws.jar appear in the classpath.
C:\Documents and Settings\florinp\My Documents\wsdl>echo %CLASSPATH%
C:\bin\sqlj\lib\translator.jar;C:\bin\sqlj\lib\runtime12.jar;C:\bin\ORA9i\jdbc\l
ib\classes12.jar;C:\bin\sqlj\lib\utl_dbws.jar;
I am using a 9i database...
what kind of error is this?
Asuka Yuki wrote:
Hi Joe,
Thank you for your prompt reply. my code is for server side.
The driverManager is actually for session bean to connect to Oracle database server.
Hope to hear from you soon. Thousand thanks in advance.
Rgds,
AsukaHi. This is odd. Please show me the classpath the server startup script prints out
when it starts. (both in the successful mode and in the failing mode).
Would you also please try changing the bean code to do this:
java.sql.Driver d = (java.sql.Driver) Class.forName("weblogic.jdbc.jts.Driver").newInstance();
return d.connect("jdbc:weblogic:jts:myPoolName", null);
Thanks,
Joe
>
>
Joe Weinstein <[email protected]> wrote:
yuki wrote:
Hi,
I am currently maintaining Weblogic 5.1 server connecting to oracle using weblogic jts driver without weblogicaux.jar in my classpath and it is working fine. But now after I have appended weblogicaux.jar to my classpath. The console starts to print out weblogic.jdbc.jts.driver and no suitable driver exception. I have to add weblogicaux.jar to my classpath, please advise me. Thank you in advance for any advice.
my code for getting connection is as below
Class.forName("weblogic.jdbc.jts.Driver").newInstance();
return DriverManager.getConnection("jdbc:weblogic:jts:myPoolName");Hi. Is this in serverside code, or in an external client? This will not
work in an external client.
Joe
Rgds,
Asuka
Similar Messages
-
hi, everyone. I am totally frustrated with the version problem and the oracle way of documentation. I am trying to use JPublisher to generate database webservice call out classes and packages. The database I am using is 10g 10.1.0.4 and the JPublisher I am using is downloaded from oracle website JPublisher release2. I also downloaded the webservice utility jar files for both pre 10g and 10g version, but when I try to load dbwsclient.jar file into database, it failed with a lot errors, just for illustration, the following are some example:
resolving: class oracle/j2ee/ws/common/mapping/JavaWsdlMappingWriter
errors : class oracle/j2ee/ws/common/mapping/JavaWsdlMappingWriter
ORA-29534: referenced object SYS.oracle/j2ee/ws/common/mapping/TypeVisitor c
ould not be resolved
synonym : oracle/j2ee/ws/common/mapping/JavaWsdlMappingWriter
granting : execute on class oracle/j2ee/ws/common/processor/generator/GeneratorB
ase to public
errors : class oracle/j2ee/ws/common/processor/generator/GeneratorBase
ORA-29521: referenced name oracle/j2ee/util/TraceLogger could not be found
synonym : oracle/j2ee/ws/common/processor/generator/GeneratorBase
granting : execute on class oracle/j2ee/ws/common/processor/modeler/wsdl/Complex
TypeBindingModeler to public
errors : class oracle/j2ee/ws/common/processor/modeler/wsdl/ComplexTypeBinding
Modeler
ORA-29534: referenced object SYS.oracle/j2ee/ws/common/processor/modeler/wsd
l/SchemaAnalyzer could not be resolved
ORA-29534: referenced object SYS.oracle/j2ee/ws/common/processor/config/WSDL
ModelInfo could not be resolved
ORA-29534: referenced object SYS.oracle/j2ee/ws/common/processor/modeler/wsd
l/LiteralSchemaTypeModeler could not be resolved
ORA-29521: referenced name oracle/j2ee/util/TraceLogger could not be found
synonym : oracle/j2ee/ws/common/processor/modeler/wsdl/ComplexTypeBindingModele
r
granting : execute on class javax/xml/soap/SOAPConnection to public
resolving: class javax/xml/soap/SOAPConnection
synonym : javax/xml/soap/SOAPConnection
granting : execute on class org/apache/soap/rpc/SOAPContext$MultiRefInfo to publ
ic
resolving: class oracle/j2ee/ws/common/util/ModelMBeanInfoBuilder$Parameter
errors : class oracle/j2ee/ws/common/util/ModelMBeanInfoBuilder$Parameter
ORA-29521: referenced name javax/management/MBeanParameterInfo could not be
found
synonym : oracle/j2ee/ws/common/util/ModelMBeanInfoBuilder$Parameter
granting : execute on class oracle/j2ee/ws/common/encoding/SOAPInstanceBuilder t
o public
skipping : class oracle/j2ee/ws/common/encoding/SOAPInstanceBuilder
synonym : oracle/j2ee/ws/common/encoding/SOAPInstanceBuilder
granting : execute on class oracle/j2ee/ws/common/tools/util/HandlerInfo$ParamVa
lueType to public
skipping : class oracle/j2ee/ws/common/tools/util/HandlerInfo$ParamValueType
synonym : oracle/j2ee/ws/common/tools/util/HandlerInfo$ParamValueType
granting : execute on class oracle/j2ee/ws/client/mgmt/runtime/ClientInterceptor
PortRuntime to public
errors : class oracle/j2ee/ws/client/mgmt/runtime/ClientInterceptorPortRuntime
ORA-29521: referenced name javax/management/MBeanServer could not be found
ORA-29521: referenced name javax/management/ObjectName could not be found
granting : execute on class oracle/j2ee/ws/common/processor/model/Port to public
skipping : class oracle/j2ee/ws/common/processor/model/Port
synonym : oracle/j2ee/ws/common/processor/model/Port
granting : execute on class oracle/j2ee/ws/wsdl/extensions/mime/Constants to pub
lic
skipping : class oracle/j2ee/ws/wsdl/extensions/mime/Constants
synonym : oracle/j2ee/ws/wsdl/extensions/mime/Constants
granting : execute on class oracle/j2ee/ws/common/streaming/XMLWriterFactoryImpl
to public
resolving: class oracle/j2ee/ws/common/streaming/XMLWriterFactoryImpl
synonym : oracle/j2ee/ws/common/streaming/XMLWriterFactoryImpl
granting : execute on class com/sun/mail/iap/LiteralException to public
resolving: class com/sun/mail/iap/LiteralException
synonym : com/sun/mail/iap/LiteralException
granting : execute on class oracle/j2ee/ws/common/mapping/xml/wsdlMessageMapping
Type to public
skipping : class oracle/j2ee/ws/common/mapping/xml/wsdlMessageMappingType
synonym : oracle/j2ee/ws/common/mapping/xml/wsdlMessageMappingType
granting : execute on class oracle/webservices/transport/JmsClientTransportFacto
ry to public
resolving: class oracle/webservices/transport/JmsClientTransportFactory
synonym : oracle/webservices/transport/JmsClientTransportFactory
granting : execute on class oracle/j2ee/ws/saaj/soap/ch/BinaryDataContentHandler
to public
resolving: class oracle/j2ee/ws/saaj/soap/ch/BinaryDataContentHandler
synonym : oracle/j2ee/ws/saaj/soap/ch/BinaryDataContentHandler
granting : execute on class oracle/j2ee/ws/common/soap/SOAPWSDLConstants to publ
ic
skipping : class oracle/j2ee/ws/common/soap/SOAPWSDLConstants
synonym : oracle/j2ee/ws/common/soap/SOAPWSDLConstants
granting : execute on class oracle/j2ee/ws/common/encoding/PolymorphicArraySeria
lizer$ObjectArrayInstanceBuilder to public
skipping : class oracle/j2ee/ws/common/encoding/PolymorphicArraySerializer$Objec
tArrayInstanceBuilder
synonym : oracle/j2ee/ws/common/encoding/PolymorphicArraySerializer$ObjectArray
InstanceBuilder
granting : execute on class oracle/j2ee/ws/wsdl/extensions/oracle/schema/FieldSc
hemaElement to public
skipping : class oracle/j2ee/ws/wsdl/extensions/oracle/schema/FieldSchemaElement
The following operations failed
class oracle/j2ee/ws/common/mapping/JavaWsdlMappingWriter: resolution
class oracle/j2ee/ws/common/processor/generator/GeneratorBase: resolution
class oracle/j2ee/ws/common/processor/modeler/wsdl/ComplexTypeBindingModeler
: resolution
class oracle/j2ee/ws/common/processor/config/RmiModelInfo: resolution
class oracle/j2ee/ws/common/mgmt/runtime/InterceptorContainer: resolution
class oracle/j2ee/ws/client/mgmt/runtime/ClientPortRuntime: resolution
class oracle/j2ee/ws/saaj/client/p2p/HttpSOAPConnection$1: resolution
class oracle/net/www/protocol/https/HttpsURLConnection: resolution
class org/apache/soap/rpc/Response: resolution
class oracle/j2ee/ws/common/attachments/AttachmentsImpl: resolution
class oracle/j2ee/ws/common/util/ModelMBeanInfoBuilder$Parameter: resolution
class oracle/j2ee/ws/client/mgmt/runtime/ClientInterceptorPortRuntime: resol
ution
class oracle/j2ee/ws/common/util/xml/UUID: resolution
class oracle/j2ee/ws/common/management/mbeans/WebServiceStatsImpl: resolutio
n
class oracle/j2ee/ws/common/mgmt/interceptors/testing/TestingGlobalStatus: r
esolution
class oracle/j2ee/ws/common/processor/modeler/wsdl/JavaMethodCreator: resolu
tion
class oracle/j2ee/ws/common/mgmt/runtime/InterceptorChainImpl: resolution
class oracle/j2ee/ws/saaj/client/p2p/HttpSOAPConnectionFactory: resolution
class oracle/j2ee/ws/common/processor/modeler/wsdl/RpcEncodedOperationModele
r: resolution
class oracle/j2ee/ws/client/mgmt/runtime/ClientInterceptorRegistry: resoluti
on
class oracle/j2ee/ws/client/StreamingSender: resolution
class oracle/j2ee/ws/common/util/ModelMBeanInfoBuilder$Feature: resolution
class oracle/j2ee/ws/common/mgmt/interceptors/AbstractInterceptorGlobalDescr
iptor: resolution
class oracle/j2ee/ws/common/mgmt/interceptors/auditing/AuditingDescriptor: r
esolution
class oracle/j2ee/ws/common/processor/modeler/rmi/RmiTypeModeler$MemberInfoC
omparator: resolution
class oracle/j2ee/ws/common/processor/modeler/rmi/DocLiteralMethodModeler: r
esolution
class oracle/j2ee/ws/common/encoding/literal/ValueTypeLiteralSerializer$4: r
esolution
class oracle/j2ee/ws/common/encoding/literal/ValueTypeLiteralSerializer$3: r
esolution
class oracle/j2ee/ws/common/encoding/literal/ValueTypeLiteralSerializer$2: r
esolution
class oracle/j2ee/ws/common/encoding/literal/ValueTypeLiteralSerializer$1: r
esolution
class oracle/j2ee/ws/common/encoding/literal/GenericLiteralObjectSerializer$
GetterMethod: resolution
class oracle/j2ee/ws/common/util/ModelMBeanInfoBuilder$Operation: resolution
class oracle/j2ee/ws/common/util/ModelMBeanInfoBuilder: resolution
class oracle/j2ee/ws/saaj/soap/MessageFactoryImpl: resolution
class oracle/j2ee/ws/client/dii/DynamicProxyBuilder: resolution
class oracle/xml/jaxb/JaxbMarshaller: resolution
class oracle/j2ee/ws/client/mgmt/runtime/ClientInterceptorConfig: resolution
class oracle/xml/jaxb/JaxbDatatypeConverter$DataTypeItem: resolution
class oracle/j2ee/ws/common/processor/modeler/rmi/SoapEncodedTypeModeler: re
solution
class oracle/j2ee/ws/common/mgmt/InterceptorPortInfo: resolution
class oracle/net/www/protocol/https/Handler: resolution
class oracle/j2ee/ws/common/encoding/literal/SOAPLiteralResponseSerializer$S
OAPResponseStructureBuilder: resolution
class oracle/j2ee/ws/client/BasicService: resolution
class oracle/j2ee/ws/saaj/client/p2p/HttpSOAPConnection$UsernamePasswordProm
pter: resolution
class oracle/j2ee/ws/common/attachments/IncomingAttachmentsImpl: resolution
class oracle/j2ee/ws/saaj/client/p2p/HttpSOAPConnection: resolution
class oracle/j2ee/ws/common/processor/modeler/rmi/ExceptionModelerBase: reso
lution
class oracle/j2ee/ws/common/util/ModelMBeanInfoBuilder$Attribute: resolution
class oracle/xml/jaxb/JaxbListImpl: resolution
class org/apache/soap/rpc/RPCMessage: resolution
class oracle/j2ee/ws/common/processor/modeler/rmi/RmiModeler: resolution
class oracle/j2ee/ws/common/mapping/TypeVisitor: resolution
class oracle/xml/jaxb/JaxbNode: resolution
class oracle/j2ee/ws/common/processor/modeler/rmi/ExceptionModeler: resoluti
on
class oracle/j2ee/ws/common/processor/modeler/wsdl/RpcLiteralOperationModele
r: resolution
class oracle/j2ee/ws/common/mgmt/runtime/InterceptorRuntime: resolution
class oracle/j2ee/ws/common/encoding/literal/SOAPLiteralResponseSerializer:
resolution
class oracle/j2ee/ws/client/mgmt/runtime/ClientOperationRuntime: resolution
class oracle/j2ee/ws/common/mgmt/interceptors/testing/TestingGlobalDescripto
r: resolution
class oracle/j2ee/ws/common/management/mbeans/WebServiceOperationStatsImpl:
resolution
class oracle/j2ee/ws/common/mgmt/interceptors/auditing/AuditingInterceptor:
resolution
class oracle/j2ee/ws/common/processor/modeler/wsdl/SoapEncBindingModeler: re
solution
class oracle/j2ee/ws/common/encoding/DynamicInternalTypeMappingRegistry: res
olution
class oracle/j2ee/ws/saaj/util/mime/MimeReader$PartInputStream: resolution
class oracle/j2ee/ws/common/processor/modeler/rmi/LiteralExceptionModeler$Li
teralElementMemberComparator: resolution
class oracle/j2ee/ws/common/mgmt/InterceptorPortDescriptor: resolution
class oracle/j2ee/ws/common/mgmt/InterceptorGlobalDescriptor: resolution
class oracle/j2ee/ws/common/processor/modeler/rmi/LiteralTypeModeler: resolu
tion
class oracle/j2ee/ws/saaj/client/p2p/HttpSOAPConnection$PriviledgedPost: res
olution
class oracle/xml/jaxb/JaxbDatatypeConverter: resolution
class oracle/j2ee/ws/saaj/util/mime/MimeReader$DumpInputStream: resolution
class HTTPClient/OracleSSL$3: resolution
class HTTPClient/OracleSSL$2: resolution
class oracle/j2ee/ws/common/processor/modeler/rmi/JavaBean: resolution
class oracle/j2ee/ws/common/mgmt/runtime/InterceptorPortRuntime: resolution
class oracle/j2ee/ws/common/encoding/SimpleAttachmentTypeSerializer: resolut
ion
class oracle/j2ee/ws/common/processor/generator/StubTieGeneratorBase: resolu
tion
class oracle/j2ee/ws/client/dii/BasicCall: resolution
class oracle/j2ee/ws/common/processor/modeler/rmi/RpcLiteralMethodModeler: r
esolution
class oracle/j2ee/ws/saaj/util/mime/MimeReader: resolution
class oracle/j2ee/ws/common/processor/modeler/rmi/MethodModeler: resolution
class oracle/j2ee/ws/client/dii/ConfiguredService: resolution
class oracle/j2ee/ws/common/util/ModelMBeanInfoBuilder$NameValuePair: resolu
tion
class oracle/j2ee/ws/client/dii/CallRequest: resolution
class oracle/jpub/runtime/dbws/DbwsProxy$1: resolution
class oracle/j2ee/ws/common/processor/modeler/rmi/ExceptionModeler$SOAPStruc
tureMemberComparator: resolution
class oracle/j2ee/ws/client/mgmt/runtime/ClientInterceptorPipeline: resoluti
on
class oracle/j2ee/ws/common/util/ModelMBeanInfoBuilder$Notification: resolut
ion
class oracle/j2ee/ws/common/encoding/literal/ValueTypeLiteralSerializer: res
olution
class oracle/j2ee/ws/common/mgmt/runtime/InterceptorRegistry: resolution
class oracle/j2ee/ws/common/processor/config/WSDLModelInfo: resolution
class oracle/j2ee/ws/client/ServiceFactoryImpl: resolution
class oracle/j2ee/ws/common/util/ModelMBeanInfoBuilder$Constructor: resoluti
on
class oracle/xml/jaxb/JaxbContextImpl: resolution
class oracle/j2ee/ws/common/mgmt/interceptors/testing/TestingPortStatus: res
olution
class oracle/j2ee/ws/common/processor/modeler/wsdl/LiteralSchemaTypeModeler:
resolution
class oracle/j2ee/ws/common/encoding/soap/StandardSOAPTypeMappings: resoluti
on
class oracle/j2ee/ws/common/encoding/literal/GenericLiteralObjectSerializer$
SOAPGenericObjectInstanceBuilder: resolution
class oracle/j2ee/ws/common/processor/modeler/wsdl/WSDLModeler: resolution
class oracle/j2ee/ws/common/encoding/literal/GenericLiteralObjectSerializer$
SetterMethod: resolution
class oracle/j2ee/ws/common/processor/modeler/rmi/RmiStructure: resolution
class oracle/j2ee/ws/common/mgmt/runtime/InterceptorContainerImpl$Background
Writer: resolution
class oracle/j2ee/ws/common/processor/modeler/wsdl/RpcOperationModeler: reso
lution
class oracle/j2ee/ws/common/processor/modeler/rmi/LiteralExceptionModeler: r
esolution
class oracle/xml/jaxb/JaxbValidator$schemaContext: resolution
class oracle/jpub/runtime/dbws/DbwsProxy$ServiceProxy: resolution
class oracle/j2ee/ws/common/encoding/literal/SOAPLiteralRequestSerializer: r
esolution
class oracle/j2ee/ws/client/dii/ConfiguredCall: resolution
class oracle/xml/jaxb/JaxbValidator: resolution
class oracle/xml/jaxb/JaxbDatatypeConverter$1: resolution
class oracle/j2ee/ws/common/processor/modeler/wsdl/OperationModeler: resolut
ion
class oracle/j2ee/ws/client/mgmt/runtime/ClientInterceptorOperationRuntime:
resolution
class oracle/j2ee/ws/common/processor/modeler/wsdl/SimpleTypeBindingModeler:
resolution
class org/apache/soap/rpc/Call: resolution
class oracle/j2ee/ws/common/processor/modeler/rmi/RmiTypeModeler: resolution
class oracle/j2ee/ws/client/BasicService$HandlerRegistryImpl: resolution
class oracle/j2ee/ws/common/processor/modeler/rmi/RmiModeler$MethodComparato
r: resolution
class oracle/j2ee/ws/client/StubBase: resolution
class oracle/j2ee/ws/common/processor/modeler/rmi/RpcEncodedMethodModeler: r
esolution
class oracle/j2ee/ws/common/encoding/literal/SOAPLiteralRequestSerializer$Pa
rameterArrayBuilder: resolution
class oracle/j2ee/ws/common/processor/modeler/wsdl/DocLiteralOperationModele
r: resolution
class oracle/j2ee/ws/common/encoding/literal/GenericLiteralObjectSerializer:
resolution
class oracle/j2ee/ws/common/encoding/StandardTypeMappings: resolution
class oracle/j2ee/ws/common/processor/modeler/rmi/SoapEncodedTypeModeler$Mem
berInfoComparator: resolution
class oracle/j2ee/ws/client/http/HttpClientTransport: resolution
class oracle/j2ee/ws/client/dii/CallInvokerImpl: resolution
class oracle/j2ee/ws/client/mgmt/runtime/ClientInterceptorGlobalRuntime: res
olution
class oracle/j2ee/ws/common/mgmt/interceptors/auditing/AuditingDescriptor$1:
resolution
class oracle/j2ee/ws/common/mgmt/interceptors/testing/TestingPortDescriptor:
resolution
class oracle/j2ee/ws/common/processor/modeler/wsdl/SchemaAnalyzer: resolutio
n
class oracle/soap/transport/http/OracleSOAPHTTPConnection$1: resolution
class oracle/j2ee/ws/common/processor/modeler/rmi/ParameterNameParser: resol
ution
class oracle/j2ee/ws/common/mgmt/InterceptorGlobalInfo: resolution
class oracle/j2ee/ws/common/mgmt/runtime/InterceptorMessages: resolution
class oracle/xml/jaxb/JaxbUnmarshaller: resolution
class oracle/j2ee/ws/client/http/HttpClientTransportFactory: resolution
class oracle/j2ee/ws/common/mgmt/runtime/AbstractInterceptorRegistry: resolu
tion
class oracle/j2ee/ws/client/dii/ServiceInfoBuilder: resolution
class oracle/j2ee/ws/common/mgmt/runtime/InterceptorContainerImpl: resolutio
n
class oracle/jpub/runtime/dbws/DbwsProxy$CallProxy: resolution
class oracle/j2ee/ws/client/mgmt/runtime/ClientInterceptorRuntime: resolutio
n
class oracle/jpub/runtime/dbws/DbwsProxy: resolution
class oracle/j2ee/ws/common/encoding/literal/GenericLiteralObjectSerializer$
MemberInfo: resolution
class oracle/j2ee/ws/common/mgmt/interceptors/testing/TestingInterceptor: re
solution
class oracle/soap/transport/http/OracleSOAPHTTPConnection: resolution
class oracle/j2ee/ws/client/dii/CallInvoker: resolution
exiting : Failures occurred during processing
looks like this jar file need some preloaded java classes which is not in the my 10g version 10.1.0.4. Is that a pre-requisite to have 10g release 2 database to use the dbwsa.jar and dbwsclient.jar? If so, is utl_dbws.jar and utl_dbws_jserver a match version for 10g release1? But on the oracle site, it says the webservice utility jar files (dbwsa.jar and dbwsclient.jar) are for 10g(release1 + release2). Anyone would have a hint on this? Thank you!
My loadjava command looks like this:
loadjava -oci8 -u sys/change_on_install -r -v -f -s -grant public dbwsclient.jarThank you, but I have already found a solution at metalink:
Subject: How To install Database Webservices Callout Utilities 10.2 on
Oracle Database Server 10.1
Doc ID: Note:338092.1 Type: HOWTO
Last Revision Date: 12-APR-2006 Status: PUBLISHED
The trick was to modify jpub script and to upload both dbwsa.jar AND dbwsclient.jar:
* dl (Callout Utility for 10g (R1 + R2) RDBMS):
http://www.oracle.com/technology/sample_code/tech/java/jsp/dbwebservi...
* dl (JPublisher 10g Release 10.2):
http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html
* unpack both to $ORACLE_HOME
* modify jpub:
In TMPCLASSPATH replace "jdk14" with "jdk"
replace "classes12_g.jar" with "classes12.zip"
* loadjava -u sys/change_on_install -r -v -f -s -grant public -genmissing dbwsa.jar
* loadjava -u sys/change_on_install -r -v -f -s -grant public -genmissing dbwsclient.jar
* run sqlplus as sysdba:
SQL> execute dbms_java.grant_permission('SCOTT','SYS:java.lang.RuntimePermission', 'shutdownHooks', '' )
SQL> execute dbms_java.grant_permission('SCOTT','SYS:java.util.logging.LoggingPermission','control','')
* ./jpub -u scott/tiger -sysuser sys/replace_on_install
-proxywsdl=http://demo.wsabi.org/axis/services/YahooUserPingService?wsdl
-endpoint=http://demo.wsabi.org/axis/services/YahooUserPingService
-dir=tmp
* run sqlplus as SCOTT:
SQL> select JPUB_PLSQL_WRAPPER.isUserOnLine('Test') from dual;
Because a lot of java packages were broken in my database i uninstalled and installed the whole java system before following the metalink instructions.
Egon -
Revision: 18377
Revision: 18377
Author: [email protected]
Date: 2010-10-29 12:17:57 -0700 (Fri, 29 Oct 2010)
Log Message:
Remove WEB-INF/flex/jars from classpath in qa-manual and qa-regress. This folder no longer exists as we don't have the webtier compiler.
checkintests: passed
Modified Paths:
blazeds/trunk/qa/apps/qa-manual/build.xml
blazeds/trunk/qa/apps/qa-regress/build.xml -
Hi, Portal guru:
I installed wls9.2&portal9.2, and put p13n_app.jar and p13n_system.jar into classpath from startWeblogic.cmd.
then looks portalApp can not be loaded due to the following exception:
java.lang.Error: Clonable is not clonable: java.lang.CloneNotSupportedException: com.bea.p13n.expression.operator.c
omparative.Equals: 4138928
com.bea.content.expression.PropertyRef: 4138900
java.lang.String
cm_nodeName
java.lang.String
CmxControlUniqueKeysFolder
: com.bea.content.expression.PropertyRef
at com.bea.content.expression.Search.clone(Search.java:568)
at com.bea.content.manager.internal.SearchOpsImpl.createSearchForRepo(SearchOpsImpl.java:376)
at com.bea.content.manager.internal.SearchOpsImpl.searchRepository(SearchOpsImpl.java:203)
at com.bea.content.manager.internal.SearchOpsImpl.search(SearchOpsImpl.java:159)
any know what is the problem?
Thanks in advance.I don't think it's supported to have app-scoped class in the system
classpath. I'm surprised your 814 app worked that way.
It might be that changes in 9.2 have caused some of the classes the
system classloader is hitting to now try to load other classes that are
only available in an application classloader, which the system
classloader cannot access.
http://e-docs.bea.com/wls/docs90/programming/classloading.html has
information about the classloader hierarchy in WLS/WLP.
One way to have a system-classloader class access an
appliation-classloader is via the
Thread.currentThread().getContextClassLoader(), and then either use
reflection or have the class implement an interface available in the
system classloader. This allows code at the system classpath level to
access implementation classes loaded up as part of an application,
rather than relying upon the built-in classloading which can't see
classes in children classloaders. However, this would entail having a
system classpath jar and an application jar, which is why WLP has
p13n_system.jar and p13n_app.jar.
Greg -
Hi All,
I have a command line program which access database and somehow connects to a servlet running in Tomcat.
Originally, the root directory has 2 sub-directories: the classes and the lib. The classes directory contains config files, like database name, port no... The lib dir contains all the jar files needed by my program to run.
Honestly, it run using: java -cp /path/to/dir/jar1.jar;/path/to/dir/jar2.jar,....
But the program uses many jar files, more or less 20 jar files, and many config files. And Its not convenient to run the program using the command above.
So, I made a manifest file, manifest.mnf, and saved it under the classes dir:
Manifest-Version: 1.0
Main-Class: ManualSend
Class-Path: ..\lib\bsiclient.jar
..\lib\msh.jar
..\classes\dbojects.properties
..\classes\config.xml
..\classes\jndi.properties
..\classes\log4j.properties
..\classes\msh_client.properties.xml
..\classes\sql.properties
..\lib\activation.jar
..\lib\avalon-framework-4.1.4.jar
..\lib\batik.jar
..\lib\bsi.jar
..\lib\bcmail-jdk13-115.jar
..\lib\commons-beanutils.jar
..\lib\commons-codec-1.2.jar
..\lib\commons-collections-3.1.jar
..\lib\commons-logging.jar
..\lib\commons-configuration-1.0.jar
..\lib\commons-digester.jar
..\lib\commons-lang-2.0.jar
..\lib\cos.jar lib\dom.jar
....etc.
The ManualSend class is in bsiclient.jar. It used the default package.
I run it in classes dir: jar -cvfm test.jar
java -jar test.jar
I got an error, saying:
Error in building: \classes\test.jar!\msh_client.properties.xml (The filename, directory name, or volume label sntax is incorrect).
I can't figure it out, so for the meantime, i just changed the '..\classes\' part of my manifest to '.\'
I'm not happy with that. I want it to run from my root directory, using /lib and /classes subdirectories.
Is there a way to do that? Really i'm confused with these classpath thing.
Please, any comments, opinions, suggestions.... even violent reactions are greatly appreciated. I haven't received any feedbacks with any of my previous post in all of forums.
Thanks,thanks Peter,
I've attempted that approach before. But as i've said my program needs a lot of jar files, plus a number of config files. If i write them on one single Class-Path line, i got an error saying 'commands too long lines', or something like that.
The manifest works fine. I am able to run the program using that manifest. But I'm not happy with that. Actually the program was based on a Tomcat webapp. I am actually doing a command-line version of it.
So it Tomcat WEB-INF, classes and lib directories were separated. I am looking for a way to use these 2 separate directories. What I would like to find out is how to run my program, outside of the WEB-INF classes and lib directories, and at the same time could access all the jars and config files in them.
As of the moment I had no luck of doing that. I had to run the program inside classes folder, and make a copy of lib folder inside the classes folder.
Do you have any more suggestions, opinions? Please. -
Jar Files in a Jar File - Classpath Error
Hi,
I created a jar file that will have all the class files of the application. In the manifest file class path, I have the jar files the application is dependent on. The dependent jar files were kept outside of the application jar file. I was able to execute the main file in the application jar file. Then I created another jar file that holds all the dependent jar files the application is dependent on along with the application jar file into one super jar file. configured the main class attribute of the super jar file to that in the application jar file. When I try to execute it, I'm getting an error saying Class Not Found. Can someone guide me in setting the classpath for this super jar file in its manifest file.
Presently my manifest file classpath variable in the super jar file is set as App.jar Depend1.jar Depend2.jar
Thanks,
E HJava's standard class loaders do not support jar files inside of other jar files, and will give the error you see.
You can write your own customized class loader, use a 3rd-party solution (onejar at sourceforge is one), or remove the interior jars. -
Why getResource of jar in classpath returns null?
When i iterate through the jars in the classpath and try to turn them into URL's via the getResources(), they all return null. What am I doing wrong?
(NOTE: It does print out the classpath properly when i print that out)
String classPath = System.getProperty( "java.class.path" );
String delim = System.getProperty( "path.separator" );
String[] locations = classPath.split( delim );
for ( int i = 0; i < locations.length; i++ )
/* ** It doesn't work with either of these statments: ** */
//This one tries the full path (e.g. /home/me/test/some.jar)
//Enumeration en = getClass().getClassLoader().getResources( locations[ i ].substring( locations[ i ] );
//This one tries to use just the local name of the jar (e.g. test.jar)
Enumeration en = getClass().getClassLoader().getResources( locations[ i ].substring( locations[ i ].lastIndexOf( '/' ) + 1 ) );
//This just prints null
while ( en.hasMoreElements(); ) System.out.println( en.nextElement() );
}Edited by: 6tr6tr on Dec 4, 2008 5:46 PM
Edited by: 6tr6tr on Dec 4, 2008 5:47 PMWhat you are doing doesn't make sense. The resource locations within a JAR file are relative to the package directory structure within the JAR file, not to its own absolute location on the disk. And you seem to be expecting to retrieve a JAR file from within a JAR file. This makes no sense either.
-
Packages in separate Jars causes classpath error
For the purposes of easy-updating and allowing developers to work on one part of a system without interfering with others, I have created separate Jar files for the main packages in my application. So;
com.me.pack1 is in Pack1.jar
com.me.pack2 is in Pack2.jar
An ant build takes care of building and packaging these up. The Jar files have the correct directory structure i.e.;
jar $ $JAVA_HOME/bin/jar tf /users/jmcparla/jar/Pack1.jar
META-INF/
META-INF/MANIFEST.MF
com/
com/me/
com/me/pack1/
com/me/pack1/MainClass.class
jar $ $JAVA_HOME/bin/jar tf /users/jmcparla/jar/Pack2.jar
META-INF/
META-INF/MANIFEST.MF
com/
com/me/
com/me/pack2/
com/me/pack2/OtherClass.classHowever when I run it;
jar $ $JAVA_HOME/bin/java -cp /users/jmcparla/jar/Pack2.jar -jar /users/jmcparla/jar/Pack1.jar
Entered main
Created MainClass instance
Exception in thread "main" java.lang.NoClassDefFoundError: com/me/pack2/OtherClass
at com.me.pack1.MainClass.main(MainClass.java:13)The classes are;
MainClass.java
package com.me.pack1;
import com.me.pack2.OtherClass;
public class MainClass
public static void main(String[] args)
System.out.println("Entered main");
new MainClass();
System.out.println("Created MainClass instance");
new OtherClass();
System.out.println("Created OtherClass instance");
}OtherClass.java
package com.me.pack2;
public class OtherClass
}and the build file is;
build.xml
<project name="JarProblem" default="buildJars" basedir=".">
<property name="classdir" value="classes"/>
<target name="compile" depends="clean" description="compile the code">
<mkdir dir="${classdir}"/>
<javac debug="on" debuglevel="vars,lines,source" srcdir="."
destdir="${classdir}" encoding="ISO-8859-1">
</javac>
</target>
<target name="buildJars" depends="compile" description="build the jar files">
<antcall target="buildPack2"/>
<antcall target="buildPack1"/>
</target>
<target name="buildPack2" description="build the Pack2 jar">
<tstamp>
<format property="time" pattern="hh:mm aa dd/MM/yyyy"/>
</tstamp>
<jar destfile="Pack2.jar" update="false">
<fileset dir="${classdir}">
<!-- Only include the package we're building -->
<include name="com/me/pack2/*"/>
</fileset>
<manifest>
<attribute name="Built" value="${time}"/>
</manifest>
</jar>
</target>
<target name="buildPack1" description="build the Pack1 jar">
<tstamp>
<format property="time" pattern="hh:mm aa dd/MM/yyyy"/>
</tstamp>
<jar destfile="Pack1.jar" update="false">
<fileset dir="${classdir}">
<!-- Only include the package we're building -->
<include name="com/me/pack1/*"/>
</fileset>
<manifest>
<attribute name="Main-Class" value="com.me.pack1.MainClass"/>
<attribute name="Built" value="${time}"/>
</manifest>
</jar>
</target>
<target name="clean" description="clean up the compiled source files">
<delete verbose="false" failonerror="false">
<fileset dir="${classdir}"/>
</delete>
</target>
</project>The build completes with no problems. So why can't the java command see OtherClass?johnmcparlald wrote:
However when I run it;
jar $ $JAVA_HOME/bin/java -cp /users/jmcparla/jar/Pack2.jar -jar /users/jmcparla/jar/Pack1.jar
Entered main
Created MainClass instance
Exception in thread "main" java.lang.NoClassDefFoundError: com/me/pack2/OtherClass
at com.me.pack1.MainClass.main(MainClass.java:13)
I can't help you with ant but I can tell you that the command you entered looks wrong. If you use the -jar option with the java command, the only classpath that is used is the one specified by the Class-Path entry in the manifest - other classpaths are ignored.
So you either need to leave off the -jar, include the Pack1.jar file and specify the main class, or include the Class-Path: Pack2.jar entry in the manifest. (At least, it looks to me like there is no Class-Path in the manifest.) -
How to add jar files classpath in sun stdio creator
Hi,
i am using log4j-1.2.13.jar in my application.
how to add it to my classpath in sun stdio.
with regards
shannu sarmaHi there,
These threads will answer your question
http://forum.sun.com/jive/thread.jspa?forumID=123&threadID=61842
http://forum.sun.com/jive/thread.jspa?forumID=123&threadID=56060
Thanks
K -
Do I always need to add .JAR to ClassPath?
My platform is Windows.
I pack my .class files to a .Jar file. When I want to use this .Jar, I always have to add it to ClassPath. I think it doesn't make sense. Does anything I can do that can make me use .Jar more convenient ?
ThanksCan you elaborate more?
If you create an app and jar up all of the .class files in jar called myJar.jar for example, and then want to run that app, you just type in "java -jar myJar.jar" and its' not necessary to have myJar.jar in the classpath. (Remember to add a manifest with the Main-Class attribute defined! See java tutorial for more info on executable jars...)
If, otoh, you have a bunch of classes in a jar, and then want to refer to those classes from some other external class(es)/jar(s), then yes, you'll need to add that jar to your classpath.
-Ron -
Error compilng servlet - even after including servlet.jar in classpath
I have the tomcat installation , which shows the default page on stating the tomcat.
I have my classpath set to -
set CLASSPATH=c:\tomcat4.1\comman\lib\servlet.jar;c:\j2sdk1.4\lib\tools.jar;
set PATH=c:\j2sdk1.4\bin;
I have a greetserv.java which is a simple example servlet. When i try to compile this, it gives me the error javax.servlet.jar does not exist.I have it included in the classpath, but it still doesnt work.
Any help will be appreciated.
Thanks,
JyothiWhat is javax.servlet.jar?
-
Ears, wars, support jars, and CLASSPATH
I am trying to migrate an application from WLS 5.1 to 6.1. There are 25
EJB jars with an equal number of support jars, most of which are referenced
by multiple EJBs. There are also a large number of jsps, and html pages.
I have tried packaging an ear that contains the 25 ejb jars, a war file
containing the web pages. I have attempted to include the support jars in
the ear as well.
In all attempts, the only way I get class references sastisfied is to
include all the jars on the system CLASSPATH. But this defeats the purpose
of packaging, since none of the components referenced in the system
CLASSPATH will be re-deployable.
The online documents refer to separate class loaders and classpaths for the
war and ejbs, but no detail as to how classes are found by the loaders.
Unless I put all the jars into the CLASSPATH, jsp pages cannot reference the
EJBs, and EJBs are unable to reference other EJBs.Thanks,
Now if I could just get Webgain Visual Cafe to allow me to include the
Classpath entries in the generated manifests for the EJB jars.
"Gregory Gerard" <[email protected]> wrote in message
news:3ba24da1$[email protected]..
You need to mangle all the Manifest files within the EAR and EJB-JARs and
WAR to get the right thing to happen. Check out this PDF on Sun's site:
http://java.sun.com/j2ee/j2ee-1_3-pfd4-spec.pdf
section 8.1.1.2
I don't entirely understand all the restrictions and formatting -- Ihaven't
found an example ear file out there that implements a non-trivial case.
greg
"Carl Lawstuen" <[email protected]> wrote in message
news:3ba21d8e$[email protected]..
I am trying to migrate an application from WLS 5.1 to 6.1. There are
25
EJB jars with an equal number of support jars, most of which arereferenced
by multiple EJBs. There are also a large number of jsps, and htmlpages.
I have tried packaging an ear that contains the 25 ejb jars, a war file
containing the web pages. I have attempted to include the support jarsin
the ear as well.
In all attempts, the only way I get class references sastisfied is to
include all the jars on the system CLASSPATH. But this defeats thepurpose
of packaging, since none of the components referenced in the system
CLASSPATH will be re-deployable.
The online documents refer to separate class loaders and classpaths forthe
war and ejbs, but no detail as to how classes are found by the loaders.
Unless I put all the jars into the CLASSPATH, jsp pages cannot referencethe
EJBs, and EJBs are unable to reference other EJBs. -
Jars on classpath within webservice?
Hi. I've created a web service using apache axis. I am having a problem getting my external classes on the classpath of my web service.
import com.mycompany.MyClass
public class MyService{
static {
MyClass.initialize();
public String myServiceMethod(){
}When i deploy on weblogic 9.2 i get:
weblogic.application.ModuleException: [HTTP:101216]Servlet: "AxisServlet" failed to preload on startup in Web application: "mywar.war".
java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at org.apache.ws.java2wsdl.SchemaGenerator.<init>(SchemaGenerator.java:121)
at org.apache.axis2.deployment.util.Utils.fillAxisService(Utils.java:306)
at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:339)
at org.apache.axis2.deployment.DeploymentEngine.populateService(DeploymentEngine.java:340)
at org.apache.axis2.deployment.DeploymentEngine.loadServicesFromUrl(DeploymentEngine.java:181)
at org.apache.axis2.deployment.WarBasedAxisConfigurator.loadServices(WarBasedAxisConfigurator.java:264)
at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:74)
at org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:486)
at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:406)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:276)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:68)
at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:48)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:504)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1698)
at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1675)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1595)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2734)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:892)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:336)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:117)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:26)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:641)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:229)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:154)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:565)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:136)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:104)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:320)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:815)
at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1222)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:433)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:161)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeli
verer.java:181)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.
java:12)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:
67)
at weblogic.work.ServerWorkManagerImpl$WorkAdapterImpl.run(ServerWorkManagerImpl.java:518)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class Not found : com.mycompany.MyClass
at org.apache.axis2.deployment.DeploymentClassLoader.findClass(DeploymentClassLoader.java:88)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at com.mycompany.MyService.<clinit>(Unknown Source)
... 52 more
Caused by: java.lang.ClassNotFoundException: Class Not found : com.mycompany.MyClass
at org.apache.axis2.deployment.DeploymentClassLoader.findClass(DeploymentClassLoader.java:84)
... 56 more
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:894)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:336)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
Truncated. see log file for complete stacktrace
java.lang.ClassNotFoundException: Class Not found : com.mycompany.MyClass
at org.apache.axis2.deployment.DeploymentClassLoader.findClass(DeploymentClassLoader.java:84)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at com.mycompany.MyService.<clinit>(Unknown Source)
Truncated. see log file for complete stacktraceI believe the error is occurring when Axis loads the service class and the static block is executed. ie - <clinit>.
MyClass lives in a packaged jar - myjar.jar. How do I get myjar.jar on the runtime classpath of MyService?
I've tried placing myjar.jar in the WEB-INF/lib folder of the axis war, as well as packaging it in the .aar of MyService
Thanks!bump.
anybody have any ideas on this? -
Including large number of jars in classpath...
Hello,
I have an application that relies on over 100 jars and a set of classes - I have been using an IDE to set the classpath so far, which has been fine, but I need to distribute the application to others, and so need to bundle the classes, preferably as a jar. I have tried multiple variations of setting the classpath within the manifest for the jar file (that includes only my source), and have finally resorted to setting the classpath using a batch file and running directly using the classes. Neither method works - the classpath seems to be too long - the best results I've got are with the bat file, but this loads all but the last 8 jars - taking out a few jars adds one or two more, so this seems to confirm a maximum length for the classpath. (FYI, I have previously used the manifest to set the classpath and this has been fine, but in this case I had only two jars.)
Has anyone come across this problem, and if so, have you managed to find a solution - I've combed through the relevant postings to this forum and have found similar problems but no actual Manifest or bat file example apart from a description of what was done, all of which I've tried, and none of which worked. The option to use the wildcard * in the classpath environment variable doesn't work because I cannot use JDK1.6 - the external libraries need to run on JDK1.5 - I have actually tried this but it is not expanded.
Aba-SahAnother option is to package (or "flatten") all the dependencies into a single JAR. I use the following Groovy script in ANT builds to copy files from many JARs to a single location ...
<!-- set up a groovy task -->
<taskdef name="groovy"
classname="org.codehaus.groovy.ant.Groovy"
classpathref="compile-cp"/>
<!-- you'll need to adapt this to your environment -->
<target name="flattenLibs">
<mkdir dir="${dist-temp}"/>
<groovy>
import java.io.*;
import java.util.zip.*;
import java.util.jar.*;
def copyBinary(isDir, dfile, is) {
def file = new File( dfile )
if ( isDir ) {
file.mkdirs()
else {
def preIndex = Math.max( dfile.lastIndexOf( "/" ), dfile.lastIndexOf( "\\" ) )
if ( preIndex > 0 )
new File( dfile.substring( 0, preIndex + 1 ) ).mkdirs()
def fout = new BufferedOutputStream( new FileOutputStream( file ) )
try {
byte[] buffer = new byte[ 1024 ]
int i
while ( ( i = is.read( buffer, 0, buffer.length ) ) > 0 )
fout.write( buffer, 0, i )
fout.close()
finally {
fout.close()
def destDir = project.getProperty( "dist-temp" )
if ( destDir.endsWith( "\\" ) || destDir.endsWith( "/" ) )
destDir = destDir.subString( 0, destDir.length() - 1 )
// Look at "core-cp"
def libs = []
project.getReference( "core-cp" ).list().each { pe ->
if ( pe.endsWith( ".jar" ) )
libs.add( pe )
def noisy = "true".equalsIgnoreCase( project.getProperty( "noisy" ) )
// Copy:
libs.each { lib ->
def jfile = new JarFile( new File( lib ) )
def e = jfile.entries()
while ( e.hasMoreElements() ) {
def entry = e.nextElement()
def name = entry.getName()
if ( noisy )
println "Copying \"${name}\" ..."
def is = new BufferedInputStream( jfile.getInputStream( entry ) )
try {
copyBinary( entry.isDirectory(), "${destDir}/${name}", is )
finally {
is.close()
</groovy>
</target> -
Putting Jar in ClassPath/Loading JDBC Driver on Linux
Hi,
I have got this to work on Windows � but then I simply put the Connector-J Jar into the �lib� directory of my Java installation. On this Linux machine I do not have the privileges to the �lib� directory � so I need to add the Jar to the class path � but it is not seeming to get added.
I would appreciate any suggestions. I have copied the Connector-J Jar file to the Current working directory and I have tried
java -classpath './mysql-connector-java-5.1.6-bin.jar' -Xmx512M -jar ProcessBigDump_fat.jar
java -cp mysql-connector-java-5.1.6-bin.jar -Xmx512M -jar ProcessBigDump_fat.jar
Thank you for any ideas.
O.O.When you use "-jar" any user settings of the classpath are ignored. Everything has to be specified within the jar archive itself.
Jars have a "manifest" which lets you do this. ProcessBigDump_fat.jar will already have a manifest: it has to in order to specify the main class. There will be a line like:
Main-Class: myapp.Main(Assuming the class with the static main() method was Main and it was part of the myapp package.)
What you have to do is add another line something like:
Class-Path: mysql-connector-java-5.1.6-bin.jarwhich will use the mysql jar (located in the same place as your jar) as part of the classpath.
Details in Sun's Tutorial.
Maybe you are looking for
-
Is it possible to make some apps free for a limited duration?
I've been using apps both on the Android market and iTunes store.I've noticed that some apps such as "Whatsapp messenger" which are free across all markets are paid apps on iTunes store. It would be wonderful if such apps were free for iOS users also
-
Aironet Bridge 1310 strange message? % Unrecognized host or address, or pro
Hi, When I configure an ip address on the interface 0 and I then try to ping an ip address I get the follwing message: ap#ping 10.70.20.1 % Unrecognized host or address, or protocol not running. What is wrong? Thx, Marc
-
How I protect edition in some pages of my PDF, but accept modify one page in my PDF file? For example... I am author of a e-book. But, I want people distribute that my e-book inserting in first page your website of who is distributing. Look at how I
-
How do I install the documentation in /usr/share/docs
My question is: How do I install the BDB documentation in /usr/share/docs (rather than in PREFIX/docs)? I tried to configure with --datadir=/usr/share, but the installer still tries to put the documentation in PREFIX/docs. Regards, Angel Tsankov
-
IPhone4 failure after 12months and 3 days
I have had my iPhone for a little over 12months and suddenly the lock button has decided to stop working. I am appalled at the level of customer Service I received with regards to this matter as it turns out that the product failure occured 3 days a