Redimensioning arrays in java
Can anyone tell me if its possible to redimenion an array with data in it with java, and or show me how to do this (if you can't do it with data, i guess I could make a copy of the data and then redimension the array)..
Thanks for any help in advance. (I did try to google this topic but kept coming up with hits for VB, maybe I need to learn to google better)...
public static Object[] resizeArray(Object[] _array, int _newSize){
Object[] newArray=new Object[_newSize];
System.arraycopy(_array,0,newArray,0,(_array.length<_newSize ? _Array.length : _newSize));
return newArray;
}Gil
Similar Messages
-
Passing an array from Java to Pl/SQL Procdures
I am relatively new to the Java world and I am unable to pass back an array from Java back to the calling PL/SQL procedure. I have read many of the posts that deal with this issue and in specificly have viewed Ask Tom. My main issue is trying to get the data types matched up. I am able to return varchar2, numbers, and the like, but an array of filenames is not happening. I have tried a variety of "types" but unable to accomplish the task. Please help.
I have my Java class basically defined as:
public static oracle.sql.ARRAY[] getCollection(String directory)
throws SQLException
{ // provide a directory and get a listing of files
File path = new File( directory );
String[] list = path.list();
return list;
SQL Type and PL/SQL Procedure is:
CREATE OR REPLACE TYPE PTO_FILE IS TABLE OF VARCHAR2(100);
create or replace function get_dir_collection( p_directory in varchar2 ) RETURN PTO_FILE
as language java
name 'DirCollection.getCollection( java.lang.String ) return oracle.sql.ARRAY[]';
/I know that it is not an ARRAY. It is however an "array" and I am attempting to map Java's String[][ to some "object" on the oracle side. I have looked at the link you sited and was not able to find the data mapping. I have found that mapping data types between different "languages" is some of the most difficult aspects of working with multiple languages.
Any suggestions? Thanks -
How to store logical operator in an array in java
how to store logical operator in an array in java.
Array should not be String type if i pass an element of that array it should be considered as logical operatormy exact requirment is like this, i need some logic
to convert string like this "2 Equals 3 AND 4 greater
than 7" to condition like this
2 == 3 && 4 >7 which i can pass to if
condition.So you want to create an expression parser?
No need for something as ugly as what you think you need, a simple nested conditional will do it for just the few logical operations. -
How to pass Array of Java objects to Callable statement
Hi ,
I need to know how can I pass an array of objects to PL/SQL stored procedure using callable statement.
So I am having and array list of some object say xyz which has two attributes string and double type.
Now I need to pass this to a PL/SQL Procedure as IN parameter.
Now I have gone through some documentation for the same and found that we can use ArrayDescriptor tp create array (java.sql.ARRAY).
And we will use a record type from SQL to map this to our array of java objects.
So my question is how this mapping of java object's two attribute will be done to the TYPE in SQL? can we also pass this array as a package Table?
Please help
ThanksI seem to remember that that is in one of Oracle's online sample programs.
http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/index.html -
Passing Array of java objects to and from oracle database-Complete Example
Hi all ,
I am posting a working example of Passing Array of java objects to and from oracle database . I have struggled a lot to get it working and since finally its working , postinmg it here so that it coudl be helpful to the rest of the folks.
First thinsg first
i) Create a Java Value Object which you want to pass .
create or replace and compile java source named Person as
import java.sql.*;
import java.io.*;
public class Person implements SQLData
private String sql_type = "PERSON_T";
public int person_id;
public String person_name;
public Person () {}
public String getSQLTypeName() throws SQLException { return sql_type; }
public void readSQL(SQLInput stream, String typeName) throws SQLException
sql_type = typeName;
person_id = stream.readInt();
person_name = stream.readString();
public void writeSQL(SQLOutput stream) throws SQLException
stream.writeInt (person_id);
stream.writeString (person_name);
ii) Once you created a Java class compile this class in sql plus. Just Copy paste and run it in SQL .
you should see a message called "Java created."
iii) Now create your object Types
CREATE TYPE person_t AS OBJECT
EXTERNAL NAME 'Person' LANGUAGE JAVA
USING SQLData (
person_id NUMBER(9) EXTERNAL NAME 'person_id',
person_name VARCHAR2(30) EXTERNAL NAME 'person_name'
iv) Now create a table of Objects
CREATE TYPE person_tab IS TABLE OF person_t;
v) Now create your procedure . Ensure that you create dummy table called "person_test" for loggiing values.
create or replace
procedure give_me_an_array( p_array in person_tab,p_arrayout out person_tab)
as
l_person_id Number;
l_person_name Varchar2(200);
l_person person_t;
l_p_arrayout person_tab;
errm Varchar2(2000);
begin
l_p_arrayout := person_tab();
for i in 1 .. p_array.count
loop
l_p_arrayout.extend;
insert into person_test values(p_array(i).person_id, 'in Record '||p_array(i).person_name);
l_person_id := p_array(i).person_id;
l_person_name := p_array(i).person_name;
l_person := person_t(null,null);
l_person.person_id := l_person_id + 5;
l_person.person_name := 'Out Record ' ||l_person_name ;
l_p_arrayout(i) := l_person;
end loop;
p_arrayout := l_p_arrayout;
l_person_id := p_arrayout.count;
for i in 1 .. p_arrayout.count
loop
insert into person_test values(l_person_id, p_arrayout(i).person_name);
end loop;
commit;
EXCEPTION WHEN OTHERS THEN
errm := SQLERRM;
insert into person_test values(-1, errm);
commit;
end;
vi) Now finally create your java class which will invoke the pl/sql procedure and get the updated value array and then display it on your screen>Alternatively you can also check the "person_test" tbale
import java.util.Date;
import java.io.*;
import java.sql.*;
import oracle.sql.*;
import oracle.jdbc.driver.*;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
public class ArrayDemo
public static void passArray() throws SQLException
Connection conn = getConnection();
ArrayDemo a = new ArrayDemo();
Person pn1 = new Person();
pn1.person_id = 1;
pn1.person_name = "SunilKumar";
Person pn2 = new Person();
pn2.person_id = 2;
pn2.person_name = "Superb";
Person pn3 = new Person();
pn3.person_id = 31;
pn3.person_name = "Outstanding";
Person[] P_arr = {pn1, pn2, pn3};
Person[] P_arr_out = new Person[3];
ArrayDescriptor descriptor =
ArrayDescriptor.createDescriptor( "PERSON_TAB", conn );
ARRAY array_to_pass =
new ARRAY( descriptor, conn, P_arr);
OracleCallableStatement ps =
(OracleCallableStatement )conn.prepareCall
( "begin give_me_an_array(?,?); end;" );
ps.setARRAY( 1, array_to_pass );
ps.registerOutParameter( 2, OracleTypes.ARRAY,"PERSON_TAB" );
ps.execute();
oracle.sql.ARRAY returnArray = (oracle.sql.ARRAY)ps.getArray(2);
Object[] personDetails = (Object[]) returnArray.getArray();
Person person_record = new Person();
for (int i = 0; i < personDetails.length; i++) {
person_record = (Person)personDetails;
System.out.println( "row " + i + " = '" + person_record.person_name +"'" );
public static void main (String args[]){
try
ArrayDemo tfc = new ArrayDemo();
tfc.passArray();
catch(Exception e) {
e.printStackTrace();
public static Connection getConnection() {
try
Class.forName ("oracle.jdbc.OracleDriver");
return DriverManager.getConnection("jdbc:oracle:thin:@<<HostNanem>>:1523:VIS",
"username", "password");
catch(Exception SQLe) {
System.out.println("IN EXCEPTION BLOCK ");
return null;
and thats it. you are done.
Hope it atleast helps people to get started. Comments are appreciated. I can be reached at ([email protected]) or [email protected]
Thanks
Sunil.sHi Sunil,
I've a similar situation where I'm trying to insert Java objects in db using bulk insert. My issue is with performance for which I've created a new thread.
http://forum.java.sun.com/thread.jspa?threadID=5270260&tstart=30
I ran into your code and looked into it. You've used the Person object array and directly passing it to the oracle.sql.ARRAY constructor. Just curios if this works, cos my understanding is that you need to create a oracle.sql.STRUCT out of ur java object collection and pass it to the ARRAY constructor. I tried ur way but got this runtime exception.
java.sql.SQLException: Fail to convert to internal representation: JavaBulkInsertNew$Option@10bbf9e
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.oracore.OracleTypeADT.toDatum(OracleTypeADT.java:239)
at oracle.jdbc.oracore.OracleTypeADT.toDatumArray(OracleTypeADT.java:274)
at oracle.jdbc.oracore.OracleTypeUPT.toDatumArray(OracleTypeUPT.java:115)
at oracle.sql.ArrayDescriptor.toOracleArray(ArrayDescriptor.java:1314)
at oracle.sql.ARRAY.<init>(ARRAY.java:152)
at JavaBulkInsertNew.main(JavaBulkInsertNew.java:76)
Here's a code snippet I used :
Object optionVal[] = {optionArr[0]}; // optionArr[0] is an Option object which has three properties
oracle.sql.ArrayDescriptor empArrayDescriptor = oracle.sql.ArrayDescriptor.createDescriptor("TT_EMP_TEST",conn);
ARRAY empArray = new ARRAY(empArrayDescriptor,conn,optionVal);If you visit my thread, u'll see that I'm using STRUCT and then pass it to the ARRAY constructor, which works well, except for the performance issue.
I'll appreciate if you can provide some information.
Regards,
Shamik -
Multidimensional array in Java
Hi,
I have wrritten a two dimensional array in Java.
Let's check the program.
It is not giving any compilation error but there is runtime error NumberFormatException.
Regards
Taton
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
class multidimensionalarray {
int arr[][];
//arr[3][3] =new int[][];
void inarr(int b)
for(int i=0;i<4;i++)
for(int j=0;j<4;j++)
arr[i][j] =b;
/*catch(Exception e)
e.printStackTrace();
// end of inarr()
public static void main(String args[]) throws IOException {
multidimensionalarray mdar = new multidimensionalarray();
BufferedReader br1 = new BufferedReader(new InputStreamReader(System.in));
String br2=br1.readLine();
int br=Integer.parseInt(br2);
mdar.inarr(br);
//System.out.println(arr[i][j]);
// end of main()
}I have changed the code.
Regards
Kaushik Banerjee
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
class multidimensionalarray {
int[][] arr= new int[4][4];
void inarr(int b)
for(int i=0;i<4;i++)
for(int j=0;j<4;j++)
arr[i][j] =b;
/*catch(Exception e)
e.printStackTrace();
// end of inarr()
public static void main(String args[]) throws IOException {
multidimensionalarray mdar = new multidimensionalarray();
BufferedReader br1 = new BufferedReader(new InputStreamReader(System.in));
String br2=br1.readLine();
int br=Integer.parseInt(br2);
mdar.inarr(br);
br1.close();
//System.out.println(arr[i][j]);
// end of main()
}Edited by: Taton on Dec 23, 2008 4:37 PM -
Struts 2: Doesn't populate an array of java beans in action classes
Hello,
Currently i am working on Struts 2 based application, in which i need to populate an array of Java beans from the form.
The problem, I am facing is:
Struts 2 is not instantiating an array of beans
I have gone through the Data transfer and Type Conversion of struts of 1.2, but every where I can see only following:
1 An array of primitive data types
2 List of primitive / Java bean
3 Map of primitive / Java bean
but i can't see the docs on An array of Java Beans.
What I can't do in my application is:
1 Can not convert an array of beans into java.util.List<beans>
2 Can not instantiate the bean array (As the number of elements will be decided by the front end - form)
Please have a look at my configuration file:
struts.xml:+
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.devMode" value="true" />
<include file="test/test.xml"/>
</struts>
test.xml:+
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="test" namespace="/test" extends="struts-default">
<action name="TestInput">
<result>/test/input.jsp</result>
</action>
<action name="TestOutput" class="test.Controller">
<result name="SUCCESS">/test/output.jsp</result>
</action>
</package>
</struts> Controller.java+
package test;
public class Controller {
private String id = null;
private Contact[] contacts = null;
public String execute() {
System.out.println("***********************************");
System.out.println("id::: " + getId());
System.out.println("contacts::: " + getContacts());
System.out.println("***********************************");
return "SUCCESS";
public Contact[] getContacts() {
return contacts;
public void setContacts(Contact[] contacts) {
this.contacts = contacts;
public String getId() {
return id;
public void setId(String id) {
this.id = id;
} Contact.java:+
package test;
public class Contact {
private String name = null;
public String getName() {
return name;
public void setName(String name) {
this.name = name;
}+ input.jsp:+
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>Test Form</title>
</head>
<SCRIPT type="text/javascript">
// Total number of contacts in the mail request form
var totalContacts = 0;
function addContact() {
var tbody = document.getElementById('testTable').getElementsByTagName('tbody')[0];
var row = document.createElement('TR');
var td1 = document.createElement('TD');
var td2 = document.createElement('TD');
var inputBox = document.createElement('INPUT');
td1.innerHTML = new String('Contact ' + (totalContacts + 1) + ' :');
inputBox.type = 'text';
inputBox.name = 'contacts['+totalContacts+'].name';
//inputBox.name = 'contacts.name';
td2.appendChild(inputBox);
row.appendChild(td1);
row.appendChild(td2);
tbody.appendChild(row);
// Add to the total number of contacts
totalContacts += 1;
</SCRIPT>
<body>
<h4>Mail Request Form</h4>
<s:form action="TestOutput">
<table border="1" id="testTable">
<tr>
<td colspan="2">
<s:textfield name="id" label="Request Id"/>
</td>
</tr>
<tr>
<td align="left">
<input type="button" value="Add Contact" onklick="javascript:addContact();"/>
</td>
<td align="right">
<s:submit/>
</td>
</tr>
</table>
</s:form>
</body>
</html>
+ output.jsp:+ Not concerned right now
Exception got in the logs after submitting the form:+
java.lang.InstantiationException: [Ltest.Contact;
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:123)
at com.opensymphony.xwork2.util.InstantiatingNullHandler.createObject(InstantiatingNullHandler.java:123)
at com.opensymphony.xwork2.util.InstantiatingNullHandler.nullPropertyValue(InstantiatingNullHandler.java:104)
at ognl.ASTProperty.getValueBody(ASTProperty.java:94)
at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
at ognl.SimpleNode.getValue(SimpleNode.java:210)
at ognl.ASTChain.setValueBody(ASTChain.java:168)
at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
at ognl.SimpleNode.setValue(SimpleNode.java:246)
at ognl.Ognl.setValue(Ognl.java:476)
at com.opensymphony.xwork2.util.OgnlUtil.setValue(OgnlUtil.java:186)
at com.opensymphony.xwork2.util.OgnlValueStack.setValue(OgnlValueStack.java:158)
at com.opensymphony.xwork2.util.OgnlValueStack.setValue(OgnlValueStack.java:146)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(ParametersInterceptor.java:193)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:159)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:105)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:83)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:207)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:74)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:127)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:107)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:206)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:115)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:143)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:121)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:170)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:123)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:504)
at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)
Please give me suggestions to move forward
Thanks in advance
Vikas ParikhI am having the same issue. It appears that the RequestProcessor.processValidate adds the errors (ActionMessages) to the request the does a forward. As such the errors are not available to the jsp page. Does any one know a way to get round this?
-
Import PHP-Array into Java-Application
Hi!
I want to call a PHP-Script from inside my Java-Application. The PHP-Script can return an array.
How do I use a PHP-Array in Java and how do I import it????
Thanks! =)thanks! =D
one last question:
-how would i have to change my example to make a
https-connection?
Did you try
URL theURL = new URL("https://www.mysite.com/myscript.php");It works that simply. The only complication is if your server is set up for https or not. This is an Apache (or whatever webserver you are using)problem not a PHP problem.
I think it gets upset if you try and use certificates with problems (self-signed etc) but not having tried this (I have only used it with certificates that are otherwise trustable) I don't know that for sure.
Once upon a time I asked a question about using https as a client in Java and I got a variety of answers including doing mystic stuff with my keystore but I tried the simple and obvious and it works like a charm. At least from an Applet but I see no reason an application won't work the same way.
Anyway try the simple and easy and see if that works for you. You might find that it does. -
Convert javascript array to java array
Is there any way possible to convert javascript array to java array?
if you will try to experiment a javascript array
putting it to a hidden element, it will be converted
to a string (comma delimited). You can get the value
of that element as a string and use StringTokenizer
class to put the values into a java arrayThanks, got it. -
Example of passing String Array from java to C using JNI
hi all
i searched net for passing string array from java to C but i dont get anything relevent
i have
class stu
int rollno
string name
String [] sub
i want to pass all as String array from java to C and access it C side1. Code it as though it were being passed to another method written in java.
2. Redefine the method implementation to say "native".
3. Run jnih to generate a C ".h" file. You will see that the string array
is passed into C as a jobject, which can be cast to a JNI array.
4. Write the C code to implement the method and meet the interface
in the generated .h file. -
Linklist and dynamic array in java?
how to define linklist object and to build dynamic array in java?
with so little information, all one can do is pointing you to :
http://java.sun.com/j2se/1.5.0/docs/api/java/util/LinkedList.html
http://java.sun.com/j2se/1.5.0/docs/api/java/util/ArrayList.html -
Is Array in java are Object?
is Array in java are Object?
int a[]=new int[10];
new will allocate memory. but int is a type not an Class ?
please help me.......An array in Java is an object. Array elements may be primitives or references, depending on the way the array is declared.
-
Hello,I'm a beginner in java and I need to create a bidimensional array in java, each element of this array must be an instance of the class solution, please,can somebody help me?Thank you.
solution[][] instSolutions = new solution[10][10]
In this was you can create a bidimentional array of class solution.
Regards,
Anjali. -
Passing String Array from Java to PL/SQL
Hi,
We are having couple of packages which have been written in PL/SQL . I would like to know how i can send arrays as input parameters from Java to any stored proc in Oracle. I am having Oracle 8i as the DB and am using Websphere RSA for deployment purposes.
please find below Java , PL/SQL code and exception
PL/SQL Code :
PACKAGE PKG_SURCHARGE
IS
TYPE commodity_key IS TABLE OF VARCHAR2(500) INDEX BY BINARY_INTEGER;
PROCEDURE RETRIEVE_CHARGES
in_Commodity_tab IN commodity_key,
IS
BEGIN
dbms_output.put_line('in_Commodity_tab(' || '0' || ') : ' || in_Commodity_tab(0) );
Java Code :
CallableStatement cstmt=null;
Connection conn=null;
try{
conn=getConnection();
System.out.println("++++++connected");
String sqlStr = "{call Pkg_Surcharge.RETRIEVE_CHARGES(?) }";
cstmt = conn.prepareCall(sqlStr );
//1.
String[] javaArray={"20081117","20081117"};
ArrayDescriptor dateDescripter = ArrayDescriptor.createDescriptor( "commodity_key", conn );
oracle.sql.ARRAY dateArray = new oracle.sql.ARRAY(dateDescripter, conn, javaArray);
System.out.println("++++++registered-1");
Catch (Exception e){
e.printStackTrace();
Exception Occured:
java.sql.SQLException: Invalid Pattern Name <Schema Name>.commodity_key
Appreciate your help in this regard
Thanks
Srini
Edited by: [email protected] on Nov 25, 2008 4:55 AMAvi is correct. You must create a varray or nested table instead of using a PL/SQL index-by table.
SQL> create type commodity_key as varray(#) of varchar2(500);
or
SQL> create type commodity_key as table of varchar2(500);
Use the varray if you know the number of items in the array. Otherwise, use the nested table. -
Need help on passing an array to java routine from PL/SQL
I got a math routine in java and the idea is have an array of integer and the java routine does some computatoin and then pass the array back to pl/sql
and I google the web most code is calling pl/sql from java but not the other way round. any help will be really appreciated.
{code}
package tst;
import java.util.*;
public class plsql3 {
private final static int factor1 = 2;
public static void getFib2(int[] in, int[] out, int k){
for (int i=0;i<=k-1;i++){
out[i]= in[i] * factor1;
public static void main(String[] arg){
int[] in2 = {1,2,3,4,5};
int[] out2= {0,0,0,0,0};
getFib2(in2,out2,2);
for ( int j = 0 ; j <= out2.length-1;j++) {
System.out.println(out2[j]);
{code}
{code}
CREATE or replace PROCEDURE getfib5 (x IN OUT numlist, y IN OUT numlist, k in number)
AS LANGUAGE JAVA
NAME 'tst.plsql3.getFib2(int[], int[],int)';
set serveroutput on format wraped;
declare
in2 numlist := numlist(1,2,3,4,5,6);
out2 numlist := numlist(0,0,0,0,0,0);
begin
--in2(0) := 1;
--in2(1) := 2;
--in2(2) := 3 ;
for i in 1..in2.count
loop
dbms_output.put_line(in2(i));
end loop;
for i in 1..in2.count
loop
dbms_output.put_line(out2(i));
end loop;
getFib5(in2,out2,2);
for i in 1..in2.count
loop
dbms_output.put_line(in2(i));
end loop;
for i in 1..in2.count
loop
dbms_output.put_line(out2(i));
end loop;
--dbms_output.put_line(in2.count);
end;
{code}
{code}
javac -source 1.5 -target 1.5 tst/plsql3.java
{code}
Error report:
ORA-00932: inconsistent datatypes: expected a value at argument position 1 that is convertible to a Java int got an Oracle named TYPE (ADT, REF etc)
ORA-06512: at "TK1.GETFIB5", line 1
ORA-06512: at line 18
00932. 00000 - "inconsistent datatypes: expected %s got %s"
*Cause:
*Action:http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:3696816290928
Maybe you are looking for
-
BO 4.0 - Database error: Unable to connect to SAP BW Incomplete logon data
Hello Experts, I have enabled a 'SSO to database' between SAP BW and Business objects by referencing to the documents related to below link. [http://wiki.sdn.sap.com/wiki/display/BOBJ/HowtosetupSSOagainstSAPBWinSBOBI4.0forLDAPusers] I have created a
-
Create Interactive 3D PDF file from Illustrator CS4 DXF or DWG
Hello, I'm looking for some direction. I want to create an interactive 3D PDF, the kind with the 3D controls which allow you to rotate the product to view it at different angles and sides. What I have are DWG or DXF files from SolidWorks that I would
-
How do I get back into my ipod witout reseting it? It says I have to connect to itunes becuase its disabled.
-
Can we use an overloaded constructor of a Java Bean with Session Tracking
Hi Friends, If any one can solve my query.... It would be helpful. Query: I have a Java Bean with an overloaded constructor in it. I want to use the overloaded constructor in my JSP. 1. One way of doing that is to use it directly in the "Scriptlets"
-
Where I can find Logic pro 7.1 upgrade
I acquired Logic pro 7 software, which I use on PPC G4 computer with Pro Tools Mix++ system. I would like to find 7.1 upgrade. This was actualy free upgrade, Apple sold it for 20$ on DVD (shipping costs).