I got no value and no exception when retrieving data from oracle

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

I got no value and no exception when retrieving data from oracle

liny
Hi, everyone:

My codes are as below:
<code>
            log.debug("xxxxxxxxxxfacility = {}, lot = {}", facility,
lot);
            session = sessionFactory.openSession();
            String s = ((Device)session.selectOne("smsws.getDevice",
map)).getDevice();
            log.debug("ssss = {}", s);
</code>

My logs are as below:
<code>
2010-10-22 17:35:58,512 DEBUG DataAccess - xxxxxxxxxxfacility = TAI,
lot = 3389989
2010-10-22 17:36:03,319 DEBUG PooledDataSource - Created connection
20394599.
2010-10-22 17:36:03,556 DEBUG Connection - ooo Connection Opened
2010-10-22 17:36:03,918 DEBUG PreparedStatement - ==>  Executing:
select device from lot_str where facility = ? and lot = ? and latest =
'Y'
2010-10-22 17:36:03,919 DEBUG PreparedStatement - ==> Parameters:
TAI(String), 3389989(String)
2010-10-22 17:36:04,627 DEBUG ResultSet - <==    Columns: DEVICE
2010-10-22 17:36:04,627 DEBUG ResultSet - <==        Row: 4ADS-7825UB
2010-10-22 17:36:05,327 DEBUG Connection - xxx Connection Closed
2010-10-22 17:36:05,328 DEBUG PooledDataSource - Returned connection
20394599 to pool.
</code>

You can see MyBatis actually get a value "4ADS-7825UB" from oracle
database, but something must be happened at "String s = ..." line,
because I can't see "ssss = " logs in my log file.
I don't get any exception even I use try catch clause.
I don't know why and ask for any help, any suggestion.
Thank you very much.
Reply | Threaded
Open this post in threaded view
|

Re: I got no value and no exception when retrieving data from oracle

Larry Meadors
Where's the mapped statement?

On Fri, Oct 22, 2010 at 3:49 AM, liny <[hidden email]> wrote:

> Hi, everyone:
>
> My codes are as below:
> <code>
>            log.debug("xxxxxxxxxxfacility = {}, lot = {}", facility,
> lot);
>            session = sessionFactory.openSession();
>            String s = ((Device)session.selectOne("smsws.getDevice",
> map)).getDevice();
>            log.debug("ssss = {}", s);
> </code>
>
> My logs are as below:
> <code>
> 2010-10-22 17:35:58,512 DEBUG DataAccess - xxxxxxxxxxfacility = TAI,
> lot = 3389989
> 2010-10-22 17:36:03,319 DEBUG PooledDataSource - Created connection
> 20394599.
> 2010-10-22 17:36:03,556 DEBUG Connection - ooo Connection Opened
> 2010-10-22 17:36:03,918 DEBUG PreparedStatement - ==>  Executing:
> select device from lot_str where facility = ? and lot = ? and latest =
> 'Y'
> 2010-10-22 17:36:03,919 DEBUG PreparedStatement - ==> Parameters:
> TAI(String), 3389989(String)
> 2010-10-22 17:36:04,627 DEBUG ResultSet - <==    Columns: DEVICE
> 2010-10-22 17:36:04,627 DEBUG ResultSet - <==        Row: 4ADS-7825UB
> 2010-10-22 17:36:05,327 DEBUG Connection - xxx Connection Closed
> 2010-10-22 17:36:05,328 DEBUG PooledDataSource - Returned connection
> 20394599 to pool.
> </code>
>
> You can see MyBatis actually get a value "4ADS-7825UB" from oracle
> database, but something must be happened at "String s = ..." line,
> because I can't see "ssss = " logs in my log file.
> I don't get any exception even I use try catch clause.
> I don't know why and ask for any help, any suggestion.
> Thank you very much.
>
Reply | Threaded
Open this post in threaded view
|

Re: I got no value and no exception when retrieving data from oracle

Brian Hurley
In reply to this post by liny

Your returning a String but tying to cast to Device.



Regards,
Brian Hurley

On Oct 22, 2010, at 4:49, liny <[hidden email]> wrote:

> Hi, everyone:
>
> My codes are as below:
> <code>
>            log.debug("xxxxxxxxxxfacility = {}, lot = {}", facility,
> lot);
>            session = sessionFactory.openSession();
>            String s = ((Device)session.selectOne("smsws.getDevice",
> map)).getDevice();
>            log.debug("ssss = {}", s);
> </code>
>
> My logs are as below:
> <code>
> 2010-10-22 17:35:58,512 DEBUG DataAccess - xxxxxxxxxxfacility = TAI,
> lot = 3389989
> 2010-10-22 17:36:03,319 DEBUG PooledDataSource - Created connection
> 20394599.
> 2010-10-22 17:36:03,556 DEBUG Connection - ooo Connection Opened
> 2010-10-22 17:36:03,918 DEBUG PreparedStatement - ==>  Executing:
> select device from lot_str where facility = ? and lot = ? and latest =
> 'Y'
> 2010-10-22 17:36:03,919 DEBUG PreparedStatement - ==> Parameters:
> TAI(String), 3389989(String)
> 2010-10-22 17:36:04,627 DEBUG ResultSet - <==    Columns: DEVICE
> 2010-10-22 17:36:04,627 DEBUG ResultSet - <==        Row: 4ADS-7825UB
> 2010-10-22 17:36:05,327 DEBUG Connection - xxx Connection Closed
> 2010-10-22 17:36:05,328 DEBUG PooledDataSource - Returned connection
> 20394599 to pool.
> </code>
>
> You can see MyBatis actually get a value "4ADS-7825UB" from oracle
> database, but something must be happened at "String s = ..." line,
> because I can't see "ssss = " logs in my log file.
> I don't get any exception even I use try catch clause.
> I don't know why and ask for any help, any suggestion.
> Thank you very much.
Reply | Threaded
Open this post in threaded view
|

Re: I got no value and no exception when retrieving data from oracle

Guy Rouillier
In reply to this post by liny
On 10/22/2010 5:49 AM, liny wrote:
>              String s = ((Device)session.selectOne("smsws.getDevice", map)).getDevice();

> I don't know why and ask for any help, any suggestion.

You don't mention what version of MyBatis you are using.  To help
resolve this problem, I'd suggest unraveling this one statement into two
so you can see where the actual problem lies.  And I'd also suggest, if
using MyBatis 3, to use type-safe selects via a mapper rather than
selectOne.

If you are still having an issue, then post your XML for smsws.getDevice.

--
Guy Rouillier
Reply | Threaded
Open this post in threaded view
|

Re: I got no value and no exception when retrieving data from oracle

liny
In reply to this post by Larry Meadors
Hi, Larry,

Below is my mapper statement:
<mapper id="smsws"
<select id="getDevice" parameterType="hashmap" resultType="string">
  select device from ......
</select>

I am using MyBatis 3.0.2 (MyBatis Persistence Framework 3.0.2 GA)

Thank you for any advice.

On 10月22日, 下午8時58分, Larry Meadors <[hidden email]> wrote:

> Where's the mapped statement?
>
>
>
> On Fri, Oct 22, 2010 at 3:49 AM, liny <[hidden email]> wrote:
> > Hi, everyone:
>
> > My codes are as below:
> > <code>
> >            log.debug("xxxxxxxxxxfacility = {}, lot = {}", facility,
> > lot);
> >            session = sessionFactory.openSession();
> >            String s = ((Device)session.selectOne("smsws.getDevice",
> > map)).getDevice();
> >            log.debug("ssss = {}", s);
> > </code>
>
> > My logs are as below:
> > <code>
> > 2010-10-22 17:35:58,512 DEBUG DataAccess - xxxxxxxxxxfacility = TAI,
> > lot = 3389989
> > 2010-10-22 17:36:03,319 DEBUG PooledDataSource - Created connection
> > 20394599.
> > 2010-10-22 17:36:03,556 DEBUG Connection - ooo Connection Opened
> > 2010-10-22 17:36:03,918 DEBUG PreparedStatement - ==>  Executing:
> > select device from lot_str where facility = ? and lot = ? and latest =
> > 'Y'
> > 2010-10-22 17:36:03,919 DEBUG PreparedStatement - ==> Parameters:
> > TAI(String), 3389989(String)
> > 2010-10-22 17:36:04,627 DEBUG ResultSet - <==    Columns: DEVICE
> > 2010-10-22 17:36:04,627 DEBUG ResultSet - <==        Row: 4ADS-7825UB
> > 2010-10-22 17:36:05,327 DEBUG Connection - xxx Connection Closed
> > 2010-10-22 17:36:05,328 DEBUG PooledDataSource - Returned connection
> > 20394599 to pool.
> > </code>
>
> > You can see MyBatis actually get a value "4ADS-7825UB" from oracle
> > database, but something must be happened at "String s = ..." line,
> > because I can't see "ssss = " logs in my log file.
> > I don't get any exception even I use try catch clause.
> > I don't know why and ask for any help, any suggestion.
> > Thank you very much.
Reply | Threaded
Open this post in threaded view
|

Re: I got no value and no exception when retrieving data from oracle

liny
In reply to this post by Brian Hurley
Hi, Brian:

Nice to meet you.
I think I post wrong codes at first message, below is correct:
<code>
            log.debug("xxxxxxxxxxfacility = {}, lot = {}", facility,
lot);
            HashMap map = new HashMap();
            ...
            session = sessionFactory.openSession();
            String s = (String)session.selectOne("smsws.getDevice",
map);
            log.debug("ssss = {}", s);
</code>

On 10月22日, 下午10時52分, Brian <[hidden email]> wrote:

> Your returning a String but tying to cast to Device.
>
> Regards,
> Brian Hurley
>
> On Oct 22, 2010, at 4:49, liny <[hidden email]> wrote:
>
>
>
> > Hi, everyone:
>
> > My codes are as below:
> > <code>
> >            log.debug("xxxxxxxxxxfacility = {}, lot = {}", facility,
> > lot);
> >            session = sessionFactory.openSession();
> >            String s = ((Device)session.selectOne("smsws.getDevice",
> > map)).getDevice();
> >            log.debug("ssss = {}", s);
> > </code>
>
> > My logs are as below:
> > <code>
> > 2010-10-22 17:35:58,512 DEBUG DataAccess - xxxxxxxxxxfacility = TAI,
> > lot = 3389989
> > 2010-10-22 17:36:03,319 DEBUG PooledDataSource - Created connection
> > 20394599.
> > 2010-10-22 17:36:03,556 DEBUG Connection - ooo Connection Opened
> > 2010-10-22 17:36:03,918 DEBUG PreparedStatement - ==>  Executing:
> > select device from lot_str where facility = ? and lot = ? and latest =
> > 'Y'
> > 2010-10-22 17:36:03,919 DEBUG PreparedStatement - ==> Parameters:
> > TAI(String), 3389989(String)
> > 2010-10-22 17:36:04,627 DEBUG ResultSet - <==    Columns: DEVICE
> > 2010-10-22 17:36:04,627 DEBUG ResultSet - <==        Row: 4ADS-7825UB
> > 2010-10-22 17:36:05,327 DEBUG Connection - xxx Connection Closed
> > 2010-10-22 17:36:05,328 DEBUG PooledDataSource - Returned connection
> > 20394599 to pool.
> > </code>
>
> > You can see MyBatis actually get a value "4ADS-7825UB" from oracle
> > database, but something must be happened at "String s = ..." line,
> > because I can't see "ssss = " logs in my log file.
> > I don't get any exception even I use try catch clause.
> > I don't know why and ask for any help, any suggestion.
> > Thank you very much.
Reply | Threaded
Open this post in threaded view
|

Re: I got no value and no exception when retrieving data from oracle

liny
In reply to this post by Larry Meadors
Hi, Larry,
Below is my mapper statement:
<mapper id="smsws">
<select id="getDevice" parameterType="hashmap" resultType="string">
  select device from ......
</select>
</mapper>

I am using MyBatis 3.0.2 (MyBatis Persistence Framework 3.0.2 GA)
Thank you for any advice.

On 10月22日, 下午8時58分, Larry Meadors <[hidden email]> wrote:

> Where's the mapped statement?
>
>
>
> On Fri, Oct 22, 2010 at 3:49 AM, liny <[hidden email]> wrote:
> > Hi, everyone:
>
> > My codes are as below:
> > <code>
> >            log.debug("xxxxxxxxxxfacility = {}, lot = {}", facility,
> > lot);
> >            session = sessionFactory.openSession();
> >            String s = ((Device)session.selectOne("smsws.getDevice",
> > map)).getDevice();
> >            log.debug("ssss = {}", s);
> > </code>
>
> > My logs are as below:
> > <code>
> > 2010-10-22 17:35:58,512 DEBUG DataAccess - xxxxxxxxxxfacility = TAI,
> > lot = 3389989
> > 2010-10-22 17:36:03,319 DEBUG PooledDataSource - Created connection
> > 20394599.
> > 2010-10-22 17:36:03,556 DEBUG Connection - ooo Connection Opened
> > 2010-10-22 17:36:03,918 DEBUG PreparedStatement - ==>  Executing:
> > select device from lot_str where facility = ? and lot = ? and latest =
> > 'Y'
> > 2010-10-22 17:36:03,919 DEBUG PreparedStatement - ==> Parameters:
> > TAI(String), 3389989(String)
> > 2010-10-22 17:36:04,627 DEBUG ResultSet - <==    Columns: DEVICE
> > 2010-10-22 17:36:04,627 DEBUG ResultSet - <==        Row: 4ADS-7825UB
> > 2010-10-22 17:36:05,327 DEBUG Connection - xxx Connection Closed
> > 2010-10-22 17:36:05,328 DEBUG PooledDataSource - Returned connection
> > 20394599 to pool.
> > </code>
>
> > You can see MyBatis actually get a value "4ADS-7825UB" from oracle
> > database, but something must be happened at "String s = ..." line,
> > because I can't see "ssss = " logs in my log file.
> > I don't get any exception even I use try catch clause.
> > I don't know why and ask for any help, any suggestion.
> > Thank you very much.
Reply | Threaded
Open this post in threaded view
|

Re: I got no value and no exception when retrieving data from oracle

Richard Yee
Do you have a try/catch statement around your code? Are you using a debugger? Both would help as well as sending the entire code block and mapped statement instead of just snippets. Based on the code you sent, it should work, but since it doesn't,
the error must be in the parts you gave left out.

Richard

Sent from my iPhone

On Oct 23, 2010, at 8:18 AM, liny <[hidden email]> wrote:

> Hi, Larry,
> Below is my mapper statement:
> <mapper id="smsws">
> <select id="getDevice" parameterType="hashmap" resultType="string">
>  select device from ......
> </select>
> </mapper>
>
> I am using MyBatis 3.0.2 (MyBatis Persistence Framework 3.0.2 GA)
> Thank you for any advice.
>
> On 10月22日, 下午8時58分, Larry Meadors <[hidden email]> wrote:
>> Where's the mapped statement?
>>
>>
>>
>> On Fri, Oct 22, 2010 at 3:49 AM, liny <[hidden email]> wrote:
>>> Hi, everyone:
>>
>>> My codes are as below:
>>> <code>
>>>            log.debug("xxxxxxxxxxfacility = {}, lot = {}", facility,
>>> lot);
>>>            session = sessionFactory.openSession();
>>>            String s = ((Device)session.selectOne("smsws.getDevice",
>>> map)).getDevice();
>>>            log.debug("ssss = {}", s);
>>> </code>
>>
>>> My logs are as below:
>>> <code>
>>> 2010-10-22 17:35:58,512 DEBUG DataAccess - xxxxxxxxxxfacility = TAI,
>>> lot = 3389989
>>> 2010-10-22 17:36:03,319 DEBUG PooledDataSource - Created connection
>>> 20394599.
>>> 2010-10-22 17:36:03,556 DEBUG Connection - ooo Connection Opened
>>> 2010-10-22 17:36:03,918 DEBUG PreparedStatement - ==>  Executing:
>>> select device from lot_str where facility = ? and lot = ? and latest =
>>> 'Y'
>>> 2010-10-22 17:36:03,919 DEBUG PreparedStatement - ==> Parameters:
>>> TAI(String), 3389989(String)
>>> 2010-10-22 17:36:04,627 DEBUG ResultSet - <==    Columns: DEVICE
>>> 2010-10-22 17:36:04,627 DEBUG ResultSet - <==        Row: 4ADS-7825UB
>>> 2010-10-22 17:36:05,327 DEBUG Connection - xxx Connection Closed
>>> 2010-10-22 17:36:05,328 DEBUG PooledDataSource - Returned connection
>>> 20394599 to pool.
>>> </code>
>>
>>> You can see MyBatis actually get a value "4ADS-7825UB" from oracle
>>> database, but something must be happened at "String s = ..." line,
>>> because I can't see "ssss = " logs in my log file.
>>> I don't get any exception even I use try catch clause.
>>> I don't know why and ask for any help, any suggestion.
>>> Thank you very much.
Reply | Threaded
Open this post in threaded view
|

Re: I got no value and no exception when retrieving data from oracle

liny
Hi, Richard and all:

I found an exception in tomcat localhost log:
<log>
Oct 25, 2010 10:53:18 AM org.apache.catalina.core.StandardWrapperValve
invoke
SEVERE: Servlet.service() for servlet AjaxServlet threw exception
java.lang.NoClassDefFoundError: org/apache/ibatis/executor/loader/
ResultObjectProxy$EnhancedResultObjectProxyImpl
</log>
But this class does exist in mybatis-3.0.2.jar.
I changed aggressiveLazyLoading to false in MyBatis configuration xml
and this exception is solved.
After added asm-1.5.3.jar and cglib-2.1_3.jar into lib directory, now
my class and web page can get the correct value.

I did add try/catch, but I don't know why "NoClassNotFoundError"
wasn't catched in my log. (I use slf4j and logback, write my own log
and exception to a file).

Anyway, thank you for all suggestions.

On 10月24日, 下午9時55分, Richard Yee <[hidden email]> wrote:

> Do you have a try/catch statement around your code? Are you using a debugger? Both would help as well as sending the entire code block and mapped statement instead of just snippets. Based on the code you sent, it should work, but since it doesn't,
> the error must be in the parts you gave left out.
>
> Richard
>
> Sent from my iPhone
>
> On Oct 23, 2010, at 8:18 AM, liny <[hidden email]> wrote:
>
> > Hi, Larry,
> > Below is my mapper statement:
> > <mapper id="smsws">
> > <select id="getDevice" parameterType="hashmap" resultType="string">
> >  select device from ......
> > </select>
> > </mapper>
>
> > I am using MyBatis 3.0.2 (MyBatis Persistence Framework 3.0.2 GA)
> > Thank you for any advice.
>
> > On 10月22日, 下午8時58分, Larry Meadors <[hidden email]> wrote:
> >> Where's the mapped statement?
>
> >> On Fri, Oct 22, 2010 at 3:49 AM, liny <[hidden email]> wrote:
> >>> Hi, everyone:
>
> >>> My codes are as below:
> >>> <code>
> >>>            log.debug("xxxxxxxxxxfacility = {}, lot = {}", facility,
> >>> lot);
> >>>            session = sessionFactory.openSession();
> >>>            String s = ((Device)session.selectOne("smsws.getDevice",
> >>> map)).getDevice();
> >>>            log.debug("ssss = {}", s);
> >>> </code>
>
> >>> My logs are as below:
> >>> <code>
> >>> 2010-10-22 17:35:58,512 DEBUG DataAccess - xxxxxxxxxxfacility = TAI,
> >>> lot = 3389989
> >>> 2010-10-22 17:36:03,319 DEBUG PooledDataSource - Created connection
> >>> 20394599.
> >>> 2010-10-22 17:36:03,556 DEBUG Connection - ooo Connection Opened
> >>> 2010-10-22 17:36:03,918 DEBUG PreparedStatement - ==>  Executing:
> >>> select device from lot_str where facility = ? and lot = ? and latest =
> >>> 'Y'
> >>> 2010-10-22 17:36:03,919 DEBUG PreparedStatement - ==> Parameters:
> >>> TAI(String), 3389989(String)
> >>> 2010-10-22 17:36:04,627 DEBUG ResultSet - <==    Columns: DEVICE
> >>> 2010-10-22 17:36:04,627 DEBUG ResultSet - <==        Row: 4ADS-7825UB
> >>> 2010-10-22 17:36:05,327 DEBUG Connection - xxx Connection Closed
> >>> 2010-10-22 17:36:05,328 DEBUG PooledDataSource - Returned connection
> >>> 20394599 to pool.
> >>> </code>
>
> >>> You can see MyBatis actually get a value "4ADS-7825UB" from oracle
> >>> database, but something must be happened at "String s = ..." line,
> >>> because I can't see "ssss = " logs in my log file.
> >>> I don't get any exception even I use try catch clause.
> >>> I don't know why and ask for any help, any suggestion.
> >>> Thank you very much.