[JBoss-user] JBOSS 2.1 / mySQL 3.23.33 : custom finder with java.util.Date format

2001-04-11 Thread Sylvain Tourrière

Hi,

In a custom finder method, I have a trouble with a date format.

My parameter in the findByResult method looks like 'Wed Apr 11 16:27:15 CEST
2001' in the client program.
I get the SQL finder's method parameter : '2001-04-11' (cf SQL log)
Where is my daytime (16:27:15) ??

Thanks for all.







Declare Finder in Home Interface :
public Collection findByResult(Date d1, Date d2) throws FinderException,
RemoteException;

Client's finder call :
  Calendar c = Calendar.getInstance();
  c.add(Calendar.MINUTE,this.getFrequency()*2);
  Vector myVector = new
Vector(this.myResultHome.findByResult(rightNow.getTime(),c.getTime()));

Database definition :
+--+--+--+-+-+---+
| Field| Type | Null | Key | Default | Extra |
+--+--+--+-+-+---+
| id   | int(10)  |  | PRI | 0   |   |
| url_id   | int(10)  |  | | 0   |   |
| result_date  | datetime | YES  | | NULL|   |
| elapsed_time | int(10)  | YES  | | 0   |   |
| threshold| int(10)  | YES  | | NULL|   |
| status_code  | int(4)   | YES  | | NULL|   |
+--+--+--+-+-+---+

Datas:
+-++-+--+---+---
--+
| id  | url_id | result_date | elapsed_time | threshold |
status_code |
+-++-+--+---+---
--+
| 284 |  1 | 2001-04-11 16:34:15 |  261 |  5000 |
200 |
| 285 |  1 | 2001-04-11 16:35:15 |  240 |  5000 |
200 |
| 286 |  1 | 2001-04-11 16:36:15 |  210 |  5000 |
200 |
| 287 |  1 | 2001-04-11 16:37:15 |  311 |  5000 |
200 |
| 288 |  2 | 2001-04-11 16:38:06 | 1062 |  5000 |
200 |
| 289 |  1 | 2001-04-11 16:38:15 | 1241 |  5000 |
200 |
+-++-+--+---+---
--+

Finder definition in JAWS.XML :
...
  
findByResult
result_date between {0} and {1}
result_date ASC
  
...
  
resultDate
result_date
TIMESTAMP
DATETIME
  

Query in SQL file log :

SELECT id, result_date FROM IM_RESULT WHERE result_date between '2001-04-11'
and '2001-04-11' ORDER BY result_date ASC


___
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user



[JBoss-user] Problem with PrimaryKey Class Conversion

2001-04-05 Thread Sylvain Tourrière

Hi,

I have some problems with my FindByPrimaryKey method (cf. SERVER.LOG).
Maybe the deployers files (EJB-JAR and JAWS) are false.

Thanks very much in advance,

Sylvain Tourriere


-
My config :
- JBOSS 2.0 running on my desktop (Windows2000)
- Database : mySQL (v 3.23.35a) on my desktop

My database :
mysql> desc im_url;
++-+--+-+-+---+
| Field  | Type| Null | Key | Default | Extra |
++-+--+-+-+---+
| id | int(10) |  | PRI | 0   |   |
| host   | text|  | | |   |
| host_name  | varchar(30) | YES  | | NULL|   |
| method | varchar(4)  | YES  | | NULL|   |
| frequency  | int(10) | YES  | | NULL|   |
| threshold  | int(10) | YES  | | NULL|   |
| begin_day  | varchar(10) | YES  | | NULL|   |
| end_day| varchar(10) | YES  | | NULL|   |
| begin_time | datetime| YES  | | NULL|   |
| end_time   | datetime| YES  | | NULL|   |
| user_name  | varchar(15) |  | | |   |
| parameters | text| YES  | | NULL|   |
| bench  | tinyint(1)  | YES  | | 0   |   |
| stamp  | datetime| YES  | | NULL|   |
++-+--+-+-+---+
14 rows in set (0.08 sec)

my Data :
Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-1999 Microsoft Corp.

C:\>cd mysql

C:\mysql>mysql
'mysql' n'est pas reconnu en tant que commande interne
ou externe, un programme exécutable ou un fichier de commandes.

C:\mysql>cd bin

C:\mysql\bin>mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 3.23.35a

Type 'help;' or '\h' for help. Type '\c' to clear the buffer

mysql> use IMonitor
Database changed
mysql> desc im_url
-> ;
++-+--+-+-+---+
| Field  | Type| Null | Key | Default | Extra |
++-+--+-+-+---+
| id | int(10) |  | PRI | 0   |   |
| host   | text|  | | |   |
| host_name  | varchar(30) | YES  | | NULL|   |
| method | varchar(4)  | YES  | | NULL|   |
| frequency  | int(10) | YES  | | NULL|   |
| threshold  | int(10) | YES  | | NULL|   |
| begin_day  | varchar(10) | YES  | | NULL|   |
| end_day| varchar(10) | YES  | | NULL|   |
| begin_time | datetime| YES  | | NULL|   |
| end_time   | datetime| YES  | | NULL|   |
| user_name  | varchar(15) |  | | |   |
| parameters | text| YES  | | NULL|   |
| bench  | tinyint(1)  | YES  | | 0   |   |
| stamp  | datetime| YES  | | NULL|   |
++-+--+-+-+---+
14 rows in set (0.08 sec)

mysql> select id from im_url;
Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-1999 Microsoft Corp.

C:\>cd mysql

C:\mysql>mysql
'mysql' n'est pas reconnu en tant que commande interne
ou externe, un programme exécutable ou un fichier de commandes.

C:\mysql>cd bin

C:\mysql\bin>mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 3.23.35a

Type 'help;' or '\h' for help. Type '\c' to clear the buffer

mysql> use IMonitor
Database changed
mysql> desc im_url
-> ;
++-+--+-+-+---+
| Field  | Type| Null | Key | Default | Extra |
++-+--+-+-+---+
| id | int(10) |  | PRI | 0   |   |
| host   | text|  | | |   |
| host_name  | varchar(30) | YES  | | NULL|   |
| method | varchar(4)  | YES  | | NULL|   |
| frequency  | int(10) | YES  | | NULL|   |
| threshold  | int(10) | YES  | | NULL|   |
| begin_day  | varchar(10) | YES  | | NULL|   |
| end_day| varchar(10) | YES  | | NULL|   |
| begin_time | datetime| YES  | | NULL|   |
| end_time   | datetime| YES  | | NULL|   |
| user_name  | varchar(15) |  | | |   |
| parameters | text| YES  | | NULL|   |
| bench  | tinyint(1)  | YES  | | 0   |   |
| stamp  | datetime| YES  | | NULL|   |
++-+--+-+-+---+
14 rows in set (0.08 sec)

mysql> select id from im_url;
+-+
| id  |
+-+
| 100 |
+-+
mysql>

Client coding :
...
  UrlPK myUrlPK = new UrlPK(100);
  Url mySecondUrl = myUrlHome.findByPrimaryKey(myUrlP

[JBoss-user] B2B calls (hwo to solve java.rmi.ServerException ...)

2001-04-03 Thread Sylvain Tourrière

Hi all,

I hope I'll get an answer this way.

My problem :
I want to lookup the entity bean B in the method of the entity bean A
(especially when I create the A bean in the test client).
These two beans are in the same application and physically packaged in the
same jar.
I use no session bean : maybe I did.
I search more informations about the transaction tag (tx-attribute).

Thanks in advance

Sylvain



My config :
- JBOSS 2.0 running on my desktop (Windows2000)
- Database : mySQL (v 3.23.35a) on my desktop

My application (ejb-jar.xml):

  A
  direct1.direct2.AHome
  direct1.direct2.A
  direct1.direct2.ABean
  IM_A
  false
  Container
  direct1.direct2.APK
  False
  TX_SUPPORTS
  id
  
id
id
  
  
A
entity
direct1.direct2.BHome
direct1.direct2.B
B
  


  B
  direct1.direct2.BHome
  direct1.direct2.B
  direct1.direct2.BBean
  IM_B
  false
  direct1.direct2.BPK
  Container
  True
  TX_SUPPORTS
  id
  
id
id
INTEGER
INTEGER
  


No problem with JBOSS on the deployement.

I just want to run one client who create a Bean A's instance and want to
read all the associated B bean (the primary key Bean A is an external key
of the bean B).

Client :
  InitialContext jndiContext = new InitialContext();
  Object ref  = jndiContext.lookup("A");

  // Get a reference from this to the Bean's Home interface
  AHome home = (AHome) PortableRemoteObject.narrow (ref, AHome.class);

  // Create a Url Bean
  A myA =
home.create(100,"www.yahoo.fr","toto","POST",0,1,"02/04/2001","02/04/2001",

StringToDate("2001040200"),StringToDate("2001040200"),"AA","BB",(byt
e)0,StringToDate("02/04/2001"));

  // Recherche

}

Bean A :
public void setEntityContext(EntityContext ctx) throws RemoteException {
this.urlCtx = ctx; // Initialisation du contexte
try {
  this.myBHome = (BHome) Naming.lookup("//localhost:1099/B");
}
catch (RemoteException ne) {
  System.out.println("RemoteException dans
ABean.setEntityContext()");
  throw new RemoteException();
}
}

I've catched an exception on the instruction lookup  :

java.rmi.ServerException: RemoteException occurred in server thread; nested
exception is:
javax.transaction.TransactionRolledbackException: null; nested exception
is:
java.rmi.RemoteException
javax.transaction.TransactionRolledbackException: null; nested exception is:
java.rmi.RemoteException
java.rmi.RemoteException
at
sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteC
all.java:245)
at
sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
at
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker_Stub.invokeHome(Unkno
wn Source)
at
org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invoke(HomeProxy.java:248)
at org.jboss.proxy.ProxyCompiler$Runtime.invoke(ProxyCompiler.java:74)
at IMonitor.entity.UrlHome$Proxy.create(Unknown Source)
at TestBean.main(TestBean.java:43)


___
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user



[JBoss-user] Problems with mySQL (or Null Pointer Exception

2001-03-23 Thread Sylvain Tourrière

Hi,

I am attempting to use a mySQL datasource (version 3.23.35) with CMP and
I keep jboss (version 2.1) to deploy the EJB's.

JBoss run on my desktop (Windows 2000) and the datasource is stored on a
remote server running with LINUX

My problem :
I keep on getting a null pointer exception when attempting to deploy my
application.jar and would appreciate any suggestions.

Part of my jboss.jcml file :

...


 org.gjt.mm.mysql.Driver



MyApplication
org.opentools.minerva.jdbc.xa.wrapper.XADataSourceImp
l

jdbc:mysql://MACHINE_NAME:3306/DATABASE
120
USER_NAME
10
PASSWORD
false
false
false
true
12
180
false
false
1.0
0


...

No change for these files : jboss.conf / jboss.dependencies /
jboss.properties

Part of my Server.log file :

[JDBC provider] Starting
[JDBC provider] Started
[Hypersonic] Starting
[Hypersonic] Server 1.4 is running
[Hypersonic] Database started
[Hypersonic] Started
[MyApplication] Starting
[MyApplication] Stopped
[MyApplication] java.lang.NullPointerException
[MyApplication] at
org.jboss.jdbc.XADataSourceLoader.getSource(XADataSourceLoader.java,
Compiled Code)
[MyApplication] at
org.jboss.jdbc.XADataSourceLoader.startService(XADataSourceLoader.java:267)
[MyApplication] at
org.jboss.util.ServiceMBeanSupport.start(ServiceMBeanSupport.java:93)
[MyApplication] at java.lang.reflect.Method.invoke(Native Method)
[MyApplication] at
com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
[MyApplication] at
com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
[MyApplication] at org.jboss.util.ServiceControl.start(ServiceControl.java,
Compiled Code)
[MyApplication] at java.lang.reflect.Method.invoke(Native Method)
[MyApplication] at
com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
[MyApplication] at
com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
[MyApplication] at org.jboss.Main.(Main.java, Compiled Code)
[MyApplication] at org.jboss.Main$1.run(Main.java:94)
[MyApplication] at java.security.AccessController.doPrivileged(Native
Method)
[MyApplication] at org.jboss.Main.main(Main.java, Compiled Code)
[Service Control] Could not start
DefaultDomain:service=XADataSource,name=MyApplication
[Service Control] java.lang.NullPointerException
[Service Control]   at
org.jboss.jdbc.XADataSourceLoader.getSource(XADataSourceLoader.java,
Compiled Code)
[Hypersonic] Press [Ctrl]+[C] to abort
[Service Control]   at
org.jboss.jdbc.XADataSourceLoader.startService(XADataSourceLoader.java:267)
[Service Control]   at
org.jboss.util.ServiceMBeanSupport.start(ServiceMBeanSupport.java:93)
[Service Control]   at java.lang.reflect.Method.invoke(Native Method)
[Service Control]   at
com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
[Service Control]   at
com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
[Service Control]   at
org.jboss.util.ServiceControl.start(ServiceControl.java, Compiled Code)
[Service Control]   at java.lang.reflect.Method.invoke(Native Method)
[Service Control]   at
com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
[Service Control]   at
com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
[Service Control]   at org.jboss.Main.(Main.java, Compiled Code)
[Service Control]   at org.jboss.Main$1.run(Main.java:94)
[Service Control]   at java.security.AccessController.doPrivileged(Native
Method)
[Service Control]   at org.jboss.Main.main(Main.java, Compiled Code)
[Container factory] Starting
[Container factory] Started
[JBossMQ] Starting
[JBossMQ] Server Version 0.8 Started
[JBossMQ] Started
[DefaultJMSProvider] Starting
[DefaultJMSProvider] JMS provider Adapter DefaultJMSProvider bound to
java:/DefaultJMSProvider
[DefaultJMSProvider] Started
[StdJMSPool] Starting
[StdJMSPool] JMS provider Adapter StdJMSPool bound to java:/StdJMSPool
[StdJMSPool] Started
[J2EE Deployer Default] Starting
[J2EE Deployer Default] No web container found - only EJB deployment
available...
[J2EE Deployer Default] Cleaning up deployment directory
[J2EE Deployer Default] Started
[Auto deploy] Starting
[Auto deploy] Watching C:\jboss\dist\deploy
[Auto deploy] Auto deploy of file:/C:/jboss/dist/deploy/MyApplication.jar
[J2EE Deployer Default] Deploy J2EE application:
file:/C:/jboss/dist/deploy/MyApplication.jar
[J2EE Deployer Default] Create application MyApplication.jar
[J2EE Deployer Default] install module MyApplication.jar
...

Thanks in advance

Sylvain
Smile www.smile.fr






___
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user