Tom Boyce

Greenhorn
+ Follow
since Jul 03, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Tom Boyce

I've seen two ways of doing this. You can import schema's and not have any element tags defined directly in the wsdl or you can define all your element tages between the schema tags. My questions is, do these cause different behaviors when the wsdl is used to build a cosuming client? In other words, if I have an operation called createForm defined in my wsdl, so I want an operation in the generated code to produce an operation method with a footprint like: createForm(String, String, String) Name, Address, Phone

To clairfy the two choices of wsdl construction, this is
<element name="resolveIncident">
<complexType>
<sequence>
<element name="name" type="xsd:String"/>
<element name="address" type="xsd:String"/>
<element name="phone" nillable="true" type="xsd:string"/>
</complexType>
</element>

or

<xsd:schema>
<!xsd:import namespace="http://www.forms.com" schemaLocation="http://10.1.1.1:80/formsweb/schema/service/NEWFORMService.xsd"/>
</xsd:schema>

where the schema would contain the elements above.

14 years ago
I am in process of testing out several encryption methods and running into an issue I'm hoping someone can help me with. I am getting this error:

JCE cannot authenticate the provider BC

I installed the bcprov-jdk15-138.jar file in the ext folder in the JRE and made the following entry in the java.security file:

security.provider.7=org.bouncycastle.jce.provider.BouncyCastleProvider

This is the last provider in the provider list. I have another little program that tests if BC is installed and it returns "BC is installed.". Here is the provider test program:

package com.trial.encrypt;

import java.security.Security;

public class SimpleProviderTest {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String providerName = "BC";

if (Security.getProvider(providerName)== null)
{
System.out.println(providerName + " provider not installed");
}
else
{
System.out.println(providerName + " is installed.");
}

}

}

And here is the code that is throwing the error:

package com.trial.encrypt;

import java.security.InvalidKeyException;

import javax.crypto.*;
import javax.crypto.spec.SecretKeySpec;
import java.security.NoSuchAlgorithmException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.BadPaddingException;
import javax.crypto.NoSuchPaddingException;
import java.security.NoSuchProviderException;

public class SimpleAESSymmetric
{

/**
* @param args
*/
public static void main(String[] args)
{
// TODO Auto-generated method stub
aesEncrypt();

}

public static void aesEncrypt()
{
byte[] input = new byte[] {
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, (byte)0x88, (byte)0x99, (byte)0xaa,
(byte)0xbb, (byte)0xcc, (byte)0xdd, (byte)0xee, (byte)0xff };
byte[] keyBytes = new byte[] {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d,
0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 };
try
{
SecretKeySpec key = new SecretKeySpec(keyBytes, "AES");

Cipher cipher = Cipher.getInstance("AES/ECB/NoPadding", "BC");

System.out.println("input text: " + Utils.toHex(input));

//encryption pass

byte[] cipherText = new byte[input.length];
cipher.init(Cipher.ENCRYPT_MODE, key);
int ctLength = cipher.update(input, 0, input.length, cipherText, 0);
ctLength += cipher.doFinal(cipherText, ctLength);
System.out.println("Cipher text: " + Utils.toHex(cipherText) + " bytes: " + ctLength);
}
catch(InvalidKeyException ike)
{
ike.printStackTrace();
}
catch(IllegalBlockSizeException ibse)
{
ibse.printStackTrace();
}
catch(BadPaddingException bpe)
{
bpe.printStackTrace();
}
catch(ShortBufferException sbe)
{
sbe.printStackTrace();
}
catch(NoSuchProviderException nspe)
{
nspe.printStackTrace();
}
catch(NoSuchAlgorithmException nsae)
{
nsae.printStackTrace();
}
catch(NoSuchPaddingException nspe)
{
nspe.printStackTrace();
}
}



}
17 years ago
No, I am not attempting to run two at a time. I ended up completely uninstalling NetBeans and wiping every instance of it from my drive then re-installing the 4.0 Beta. That seemed to fix my problem and I am in the process of rebuilding my application. Having some basic trouble with the servlet, but have posted to the sevlet forum for that!

Thanks for the help anyway!!
I constantly have problems pointing to a servlet from a jsp, so I know I'm missing something fundamental. Can someone help me understand? Here is my directory structure:
webapps
FamilyViolence
WebApplication1
build
generated
web
images
jsp
Shelter_CheckIn.jsp
META-INF
WEB-INF
classes
FamilyViolence
bus
ValidateChildren.class
src
FamilyViolence
ValidateChildren.java

I want to go from my Shelter_CheckIn.jsp to the ValidateChildren.Class

Here is my web.xml

<servlet-name>ValidateChildren</servlet-name>
<servlet-class>FamilyViolence.bus.ValidateChildren</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ValidateChildren</servlet-name>
<url-pattern>/servlet/ValidateChildren</url-pattern>
</servlet-mapping>

And finally, how I'm attempting to get there in my jsp

<form name="intake" action="/ValidateChildren">

If anyone can help me not only fix the problem, but understand I would be greatly appreciative!

Thanks!
20 years ago
I am using NetBeans to develop a project. I already have an instance of Tomcat 5 in its own directory and is used for other development/maintenance projects. NetBeans 3.6 is bundled with the same version which I would like to use as I need to configure connection pooling with it. My problems started in trying to establish the connection pooling. Now, when I attempt to run my application under NetBeans, I get all types of JVM bind errors. I have removed all code reference the connection pooling, but cannot get my app to run anymore. Here is the error from the output window:

StandardServer.await: create[8005]: java.net.BindException: Address already in use: JVM_Bind
java.net.BindException: Address already in use: JVM_Bind

After I get these errors, I cannot start my other instance of Tomcat either - the same errors appear. I'm thinking it's some type of port conflict, but I don't know how to resolve it. Here is a portion of my server.xml file:

<Server port="8005" shutdown="SHUTDOWN" debug="0">


< !-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 -->
<Connector port="8081"<br /> maxThreads="150" minSpareThreads="25" maxSpareThreads="75"<br /> enableLookups="false" redirectPort="8443" acceptCount="100"<br /> debug="0" connectionTimeout="20000" <br /> disableUploadTimeout="true" />
< !-- Note : To disable connection timeouts, set connectionTimeout value<br /> to 0 -->



I have used port 9000, 8080, 8081, 1010 and nothing works. Can anyone offer me some help. I can provide additional code if you'd like
Cool, thanks for the links - I'll study on them and see if I can get it running! Changing the classpaths blew out every instance of tomcat I had so that's not going to work.

About instances. I have installed 3 seperate tomcats - one version 4.1 and two version 5.0XX. One of those came pre-packaged with netbeans, the other I needed for a project and has been serving as my main instance. But since I am doing connection pooling, I decided to try and use the instance under Netbeans. I only run one instance at a time!

Netbeans creates yet another version of Tomcat (albeit - truncated) under docsandsettings/.netbeans From what I've read so far, netbeans ignores the classpath in the environment variable and creates it own per project (I like this, just haven't figured out how to use it effectively yet). I am hoping these links you provided will help.

I do appreciate everyones assistance. Please standby while I study up to make another run at it!!!
20 years ago
No, I haven't tried the other jar file, but I have been fooling around with file structure. NetBeans creates an instance of tomcat under docs&settings/.netbeans directory, but it did not have any of the project within, so I copied the project into that directory. I am now getting this error:

StandardServer.await: create[8005]: java.net.BindException: Address already in use: JVM_Bind
java.net.BindException: Address already in use: JVM_Bind

I think I've seen this before, but not sure what I did to fix it. Any ideas?
20 years ago
Although I'm still relatively new to the JAVA world and programming in general, I see a very valid need to understand Tomcat inside and out. I would love to become an "expert" in Tomcat. As you can tell from my post regarding connection pooling - I have a long way to go!

I appreciate you taking the time to respond to our questions (and I hope you can help me solve my problem) as well as offering your book for giveaway.

Thanks again!
20 years ago
I already attempted putting my jar file in the common/lib directory:

C:\Program Files\NetBeans3.6\jakarta-tomcat-5.0.19\common\lib\mysql-connector-java-3.1.3-beta-bin.jar

My environment classpath is as follows:
.;C:\j2sdk1.4.2_05\lib\tools.jar;%CATALINA_HOME%\common\lib\servlet.jar;c:\javamail-1.3.1\mail.jar;c:\jaf-1.0.1\activation.jar;c:\javamail-1.3.1\lib\imap.jar;c:\javamail-1.3.1\lib\mailapi.jar:c:\javamail-1.3.1\lib\pop3.jar;c:\javamail-1.3.1\lib\smtp.jar;C:\TIBCO\TIBRV\LIB\tibrvj.jar;C:\Program Files\NetBeans3.6\jakarta-tomcat-5.0.19\webapps\FamilyViolence\WEB-INF\lib\mysql-connector-java-3.1.3-beta-bin.jar;C:\j2sdk1.4.2_05\jre\bin;C:\mssqlserver.jar


I have the jar file in the WEB-INF file as well:

C:\Program Files\NetBeans3.6\jakarta-tomcat-5.0.19\webapps\FamilyViolence\WEB-INF\lib\mysql-connector-java-3.1.3-beta-bin.jar


Here is my catalina home variable:

C:\Program Files\NetBeans3.6\jakarta-tomcat-5.0.19

JAVA_Home: C:\j2sdk1.4.2_05


Root Directory for project under NetBeans is:
C:\Program Files\NetBeans3.6\jakarta-tomcat-5.0.19\webapps

Properties of http://localhost:8084/ Home directory:
C:\Program Files\NetBeans3.6\jakarta-tomcat-5.0.19

Base Directory:
C:\Documents and Settings\Administrator\.netbeans\3.6\jakarta-tomcat-5.0.19_base

I am truely at a loss!!!
20 years ago
Yes, it is in my environment variable classpath. I just saw this error when netbeans runs tomcat:

LifecycleException: Container StandardContext[/FamilyViolence/jsp] has not been started
at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4400)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4298)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1126)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:832)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1126)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:521)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2345)
at org.apache.catalina.startup.Catalina.start(Catalina.java:594)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
20 years ago
Well, progress is sometimes made by getting a different error message!

Un-quoting the datasource produced the following error!

javax.servlet.ServletException: Cannot create JDBC driver of class '' for connect URL 'null', cause: No suitable driver

I am using MySql database and have installed mysql-connector-java-3.1.3-beta-bin.jar in the **".. jakarta-tomcat-5.0.19\webapps\FamilyViolence\WEB-INF\lib" directory. I am using NetBeans 3.6 as my IDE.

I appreciate the assistance on this!!

Tom Boyce
20 years ago
Tomcat is something of which I both understand and am mystified by at the same time. It has confounded me and been a breeze! "and she's always a woman to me...."!

I am working on an application in which I want to use Tomcat to manage my connection pooling. I am getting the following error:

javax.servlet.ServletException: Name jdbc is not bound in this Context

here is my server.xml:

<Context path="/FamilyViolence" docBase="roller" debug="0">
<Resource name="jdbc/ywstats" auth="Container" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/ywstats">
<parameter>
<name>driverClassName</name>
<value>org.gjt.mm.mysql.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost:3306/ywstats?autoReconnect=true</value>
</parameter>
<parameter><name>maxActive</name><value>25</value></parameter>
<parameter><name>maxWait</name><value>100</value></parameter>
<parameter><name>username</name><value>tboyce</value></parameter>
<parameter><name>password</name><value>4guneyeh</value></parameter>
<parameter><name>factory</name><value>org.apache.commons.dbcp.BasicDataSourceFactory</value></parameter>
</ResourceParams>
</Context>

MY Web.xml file:

<resource-ref>
<res-ref-name>"jdbc/ywstats"</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>


My jsp code:

<%

Vector v_cnty=new Vector();
ResultSet rs_cnty = null;
DataSource pool;

InitialContext intCtx = new InitialContext();
DataSource ds = (DataSource)intCtx.lookup("java:comp/env/jdbc/ywstats");
Connection conn = ds.getConnection();
java.sql.Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery("select county_name from county_info");

while (rset.next())
{
v_cnty.addElement(rset.getString(0));
}


Any help would be greatly appreciated and I'd, of course, love to win a copy of your book!!!
20 years ago
Thanks for the reply. I'm guessing I wasn't very clear on the requirments so if I could, let me clairfy a bit.

We have a product that we sell to various clients that can include a database, but in most cases, the client already have an existing database that our application will read and write to. Obviously, when we designed the app, we do so with the database schemea we developed. The issue is in adapting the TO's, DAO's and CDR's for each client specific database and if there is an easier way to do rather than re-writing these objects each time (taking approximately two man months).

Can Hibernate and OR mapping help us find an easier and quicker way to map to any database schemea?

Again, thanks and I look forward to hearing from you.
Is it possible to construct an interface that will write to a variety of database schema's. In other words, you have an application that needs to talk to a database. The database may already be in existance (based on industry standards), but the schema may vary.

Can hibernate be used to construct a service to map the application to any database?
I am not well versed in SOA, but one of the chief arguments I hear, especially from .net proponents, is that SOA represent high security risk. Is there a concern here and what is available to mitigate the risk?
20 years ago