---
title: "Class org.apache.struts2.json.JSONWriter can not access a member of class oracle.jdbc.driver.Physica"
author: "麦田1990"
date: "2013-12-06T17:55:00Z"
tags: []
slug: "class-org-apache-struts2-json-jsonwriter-can-not-access-a-member-of-class-oracle-jdbc-driver-physica"
draft: false
lastmod: "2013-12-14T11:51:29Z"
id: 1989423
url: "https://alert-null.iteye.com/blog/1989423"
---

产生这个错误的原因是因为我的oracle数据库中有一个CLOB字段，查询出来的时候要转换为JSON而报错。

Class org.apache.struts2.json.JSONWriter can not access a member of class oracle.jdbc.driver.PhysicalConnection with modifiers "public"

取出来的JSON数据是这样的

```
[{STATE=0, REUSER=a, ANONYMIS=否, TEXT=oracle.sql.CLOB@40a04430, CHANNELTYPE=用户交互, ID=1111, OPENIS=是}]
```

**TEXT=oracle.sql.CLOB@40a04430**因为它无法转成json

处理方法网上查了一大堆，大部分都是说Json Plugin会序列化整个Action

在&lt;result type="json"&gt;&lt;/result&gt;中添加**includeProperties**和**excludeProperties**过滤掉不需要被序列号的属性。觉得有些复杂，可能还要用一些正则之类的。而我不需要过滤，而是正需要那个CLOB值。

解决办法是在oracle取数据的时候就直接将CLOB转换成varchar2类型

**TO\_CHAR(text)**