问:
How to update imageview from the parent recyclerview after click on nested recyclerview's imageview
Please check following screenshot, I want to update imageview from parent recyclerview when user click on imageview from nested recyclerview.
I have taken two individual adapters for for parent & nested recyclerview.I am not able to do the functionality for updating image, kindly help.

Parent Recyclerview Adapter:

```<code>public class RecyclerViewDataAdapter extends RecyclerView.Adapter<RecyclerViewDataAdapter.ItemRowHolder> {

private ArrayList<PLDModel> dataList;
private Context mContext;
public RecyclerViewDataAdapter(Context context, ArrayList<PLDModel> dataList) {
    this.dataList = dataList;
    this.mContext = context;
}

@Override
public ItemRowHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
    View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_card_view, null);
    ItemRowHolder mh = new ItemRowHolder(v);
    return mh;
}

@Override
public void onBindViewHolder(ItemRowHolder itemRowHolder, int i) {

    final String itemTitle = dataList.get(i).getTitle();
    final String itemDescription = dataList.get(i).getDescription();

    ArrayList<SmallImages> singleSectionItems = dataList.get(i).getSmallImages();

    itemRowHolder.itemTitle.setText(Html.fromHtml("<b>" + itemTitle + " </b> " + itemDescription));

    SectionListDataAdapter itemListDataAdapter = new SectionListDataAdapter(mContext, singleSectionItems);

    itemRowHolder.recyclerSmallImageList.setHasFixedSize(true);
    itemRowHolder.recyclerSmallImageList.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
    itemRowHolder.recyclerSmallImageList.setAdapter(itemListDataAdapter);

}

@Override
public int getItemCount() {
    return (null != dataList ? dataList.size() : 0);
}

public class ItemRowHolder extends RecyclerView.ViewHolder {

    protected TextView itemTitle,  expandImage;
    protected ImageView bookmarkImage,largeImage;
    protected RecyclerView recyclerSmallImageList;

    protected Button btnMore;

    public ItemRowHolder(View view) {
        super(view);
        this.itemTitle = (TextView) view.findViewById(R.id.title);
        this.bookmarkImage = (ImageView) view.findViewById(R.id.bookmark);
        this.largeImage = (ImageView) view.findViewById(R.id.large_image);
        this.expandImage = (TextView) view.findViewById(R.id.expand);
        this.recyclerSmallImageList = (RecyclerView) view.findViewById(R.id.recycler_small_image_list);

    }

}
</code>```

}

Nested Recyclerview Adapter:

```<code>public class SectionListDataAdapter extends RecyclerView.Adapter<SectionListDataAdapter.SingleItemRowHolder> {

private ArrayList<SmallImages> itemsList;
private Context mContext;

public SectionListDataAdapter(Context context, ArrayList<SmallImages> itemsList) {
    this.itemsList = itemsList;
    this.mContext = context;
}

@Override
public SingleItemRowHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
    View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.small_images_view, null);
    SingleItemRowHolder mh = new SingleItemRowHolder(v);
    return mh;
}

@Override
public void onBindViewHolder(SingleItemRowHolder holder, int i) {

    SmallImages singleItem = itemsList.get(i);
}

@Override
public int getItemCount() {
    return (null != itemsList ? itemsList.size() : 0);
}

public class SingleItemRowHolder extends RecyclerView.ViewHolder {

    protected ImageView itemImage;

    public SingleItemRowHolder(View view) {
        super(view);

        //this.tvTitle = (TextView) view.findViewById(R.id.tvTitle);
        this.itemImage = (ImageView) view.findViewById(R.id.item_small_image);

        view.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                //Toast.makeText(v.getContext(), tvTitle.getText(), Toast.LENGTH_SHORT).show();

            }
        });

    }

}
</code>```

}

答:
Generally, the solution is to pass custom interface listener into the nested adapter and than the nested adapter will report any time one of his item clicked.

1.
You can create interface like:

```<code>public interface INestedClicked {
   onNestedItemClicked(Drawable drawble)
}
</code>```

2.
Pass in the constructor of SectionListDataAdapter a INestedClicked:

```<code>SectionListDataAdapter itemListDataAdapter = newSectionListDataAdapter(mContext, singleSectionItems, new INestedClicked() {
    @Override
    void onNestedItemClicked(Drawable drawble) {
       // Do whatever you need after the click, you get the drawable here
    }
});
</code>```

In the constructor of SectionListDataAdapter save the instance of the listener as adapter parameter

private INestedClicked listener;

4.
When nested item clicked report the listener:

```<code>view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
    if(listener != null){
        listener.onNestedItemClicked(imageView.getDrawable());
    }
}
</code>```

Body:
Please check following screenshot, I want to update imageview from parent recyclerview when user click on imageview from nested recyclerview.
I have taken two individual adapters for for parent & nested recyclerview.I am not able to do the functionality for updating image, kindly help.

Parent Recyclerview Adapter:

public class RecyclerViewDataAdapter extends RecyclerView.Adapter<RecyclerViewDataAdapter.ItemRowHolder> {

private ArrayList<PLDModel> dataList;
private Context mContext;
public RecyclerViewDataAdapter(Context context, ArrayList<PLDModel> dataList) {
    this.dataList = dataList;
    this.mContext = context;
}

@Override
public ItemRowHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
    View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_card_view, null);
    ItemRowHolder mh = new ItemRowHolder(v);
    return mh;
}

@Override
public void onBindViewHolder(ItemRowHolder itemRowHolder, int i) {

    final String itemTitle = dataList.get(i).getTitle();
    final String itemDescription = dataList.get(i).getDescription();

    ArrayList<SmallImages> singleSectionItems = dataList.get(i).getSmallImages();

    itemRowHolder.itemTitle.setText(Html.fromHtml("" + itemTitle + "  " + itemDescription));

    SectionListDataAdapter itemListDataAdapter = new SectionListDataAdapter(mContext, singleSectionItems);

    itemRowHolder.recyclerSmallImageList.setHasFixedSize(true);
    itemRowHolder.recyclerSmallImageList.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
    itemRowHolder.recyclerSmallImageList.setAdapter(itemListDataAdapter);

}

@Override
public int getItemCount() {
    return (null != dataList ? dataList.size() : 0);
}

public class ItemRowHolder extends RecyclerView.ViewHolder {

    protected TextView itemTitle,  expandImage;
    protected ImageView bookmarkImage,largeImage;
    protected RecyclerView recyclerSmallImageList;

    protected Button btnMore;

    public ItemRowHolder(View view) {
        super(view);
        this.itemTitle = (TextView) view.findViewById(R.id.title);
        this.bookmarkImage = (ImageView) view.findViewById(R.id.bookmark);
        this.largeImage = (ImageView) view.findViewById(R.id.large_image);
        this.expandImage = (TextView) view.findViewById(R.id.expand);
        this.recyclerSmallImageList = (RecyclerView) view.findViewById(R.id.recycler_small_image_list);

    }

}

}

Nested Recyclerview Adapter:

public class SectionListDataAdapter extends RecyclerView.Adapter<SectionListDataAdapter.SingleItemRowHolder> {

private ArrayList<SmallImages> itemsList;
private Context mContext;

public SectionListDataAdapter(Context context, ArrayList<SmallImages> itemsList) {
    this.itemsList = itemsList;
    this.mContext = context;
}

@Override
public SingleItemRowHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
    View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.small_images_view, null);
    SingleItemRowHolder mh = new SingleItemRowHolder(v);
    return mh;
}

@Override
public void onBindViewHolder(SingleItemRowHolder holder, int i) {

    SmallImages singleItem = itemsList.get(i);
}

@Override
public int getItemCount() {
    return (null != itemsList ? itemsList.size() : 0);
}

public class SingleItemRowHolder extends RecyclerView.ViewHolder {

    protected ImageView itemImage;

    public SingleItemRowHolder(View view) {
        super(view);

        //this.tvTitle = (TextView) view.findViewById(R.id.tvTitle);
        this.itemImage = (ImageView) view.findViewById(R.id.item_small_image);

        view.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                //Toast.makeText(v.getContext(), tvTitle.getText(), Toast.LENGTH_SHORT).show();

            }
        });

    }

}

}

Body:
Generally, the solution is to pass custom interface listener into the nested adapter and than the nested adapter will report any time one of his item clicked.

1.
You can create interface like:

public interface INestedClicked {
   onNestedItemClicked(Drawable drawble)
}

2.
Pass in the constructor of SectionListDataAdapter a INestedClicked:

SectionListDataAdapter itemListDataAdapter = newSectionListDataAdapter(mContext, singleSectionItems, new INestedClicked() {
    @Override
    void onNestedItemClicked(Drawable drawble) {
       // Do whatever you need after the click, you get the drawable here
    }
});

In the constructor of SectionListDataAdapter save the instance of the listener as adapter parameter

private INestedClicked listener;

4.
When nested item clicked report the listener:

view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
    if(listener != null){
        listener.onNestedItemClicked(imageView.getDrawable());
    }
}


来源: stackexchange

问:
How do I section out an Index and have it print on a new line in JavaScript and HTML with an onclick event
I have an index that looks like this

```<code>var quotes = ["string 1",
  "string 2",
  "string 3",
  "string 4",
  "string 5",
  "string 6",
  "string 7",
  "string 8",
  "string 9",
  "string 10", //this pattern continues for a while
];
</code>```

I am trying to section out my array into smaller blocks, but I don't want to create a new array each time. I am doing that by using this code:

```<code>function openingText() {
  var opening = quotes.slice(0, 7);
  for (var x in opening) {
    opening[x] = '>' + opening[x];
    document.getElementById("text").innerHTML = opening[x];
  }
}
</code>```

I have assigned this function to an onclick event in my HTML file.

When I run the code string 7 prints, but nothing else.

How can I make it print from 0 and iterate through each string to 7 with an onclick?

答:
In your for-loop you are overriding the innerHTML seven times. You have:

document.getElementById("text").innerHTML = opening[x];

you want:
document.getElementById("text").innerHTML += opening[x];

This way, you will append to the previous value instead of overwriting it.

ContentLicense: CC BY-SA 3.0

Body:
I have an index that looks like this

var quotes = ["string 1",
  "string 2",
  "string 3",
  "string 4",
  "string 5",
  "string 6",
  "string 7",
  "string 8",
  "string 9",
  "string 10", //this pattern continues for a while
];

I am trying to section out my array into smaller blocks, but I don't want to create a new array each time. I am doing that by using this code:

function openingText() {
  var opening = quotes.slice(0, 7);
  for (var x in opening) {
    opening[x] = '>' + opening[x];
    document.getElementById("text").innerHTML = opening[x];
  }
}

I have assigned this function to an onclick event in my HTML file.

When I run the code string 7 prints, but nothing else.

How can I make it print from 0 and iterate through each string to 7 with an onclick?


问:
How to avoid [Cannot create JDBC driver of class 'net.sf.log4jdbc.sql.jdbcapi.DriverSpy'] error?
I'd checkout the web-project(Spring framework) from my company's svn.

When I run it on tomcat server, It was ok.

But I tried to log-in at webpage from project, the error log of below has occurred.

It seems error because of kinds of log4j2 jars, but I checked the maven dependency, and the jar file is already downloaded.

I checked the compiler compiliance level also, it was 1.7.

I delete the project and re-checkout from our svn over and over.

What's wrong about this??

at POM.xml

```<code>        <dependency>
            <groupId>org.bgee.log4jdbc-log4j2</groupId>
            <artifactId>log4jdbc-log4j2-jdbc4</artifactId>
            <version>1.16</version>
        </dependency>
</code>```

below is log.

```2015-03-16 18:15:24,354 ERROR [log4jdbc.log4j2] null. DataSource.getConnection()
org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'net.sf.log4jdbc.sql.jdbcapi.DriverSpy' for connect URL 'jdbc:log4jdbc:edb://218.145.26.12:5445/dementia'
    at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1452) ~[commons-dbcp-1.4.jar:1.4]
    at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371) ~[commons-dbcp-1.4.jar:1.4]
    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) ~[commons-dbcp-1.4.jar:1.4]
    at net.sf.log4jdbc.sql.jdbcapi.DataSourceSpy.getConnection(DataSourceSpy.java:147) [log4jdbc-log4j2-jdbc4-1.16.jar:?]
    at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111) [spring-jdbc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy$TransactionAwareInvocationHandler.invoke(TransactionAwareDataSourceProxy.java:224) [spring-jdbc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at com.sun.proxy.$Proxy22.prepareStatement(Unknown Source) [?:?]
    at com.ibatis.sqlmap.engine.execution.SqlExecutor.prepareStatement(SqlExecutor.java:497) [ibatis-sqlmap-2.3.4.726.jar:?]
    at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:175) [ibatis-sqlmap-2.3.4.726.jar:?]
    at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteQuery(MappedStatement.java:221) [ibatis-sqlmap-2.3.4.726.jar:?]
    at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:189) [ibatis-sqlmap-2.3.4.726.jar:?]
    at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForObject(MappedStatement.java:120) [ibatis-sqlmap-2.3.4.726.jar:?]
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:518) [ibatis-sqlmap-2.3.4.726.jar:?]
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:493) [ibatis-sqlmap-2.3.4.726.jar:?]
    at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106) [ibatis-sqlmap-2.3.4.726.jar:?]
    at org.springframework.orm.ibatis.SqlMapClientTemplate$1.doInSqlMapClient(SqlMapClientTemplate.java:273) [spring-orm-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:203) [spring-orm-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(SqlMapClientTemplate.java:271) [spring-orm-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at dementia.casestudy.login.dao.CaseLoginDAO.getLoginUserCountMac(CaseLoginDAO.java:22) [CaseLoginDAO.class:?]
    at dementia.casestudy.login.service.CaseLoginService.getLoginUserCountMac(CaseLoginService.java:30) [CaseLoginService.class:?]
    at dementia.casestudy.login.controller.CaseLoginController.loginProc(CaseLoginController.java:74) [CaseLoginController.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_75]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_75]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_75]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_75]
    at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176) [spring-web-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at dementia.casestudy.common.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:456) [AnnotationMethodHandlerAdapter.class:?]
    at dementia.casestudy.common.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:426) [AnnotationMethodHandlerAdapter.class:?]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:919) [spring-webmvc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:851) [spring-webmvc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953) [spring-webmvc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:855) [spring-webmvc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:643) [servlet-api.jar:?]
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829) [spring-webmvc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:723) [servlet-api.jar:?]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) [catalina.jar:6.0.37]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:6.0.37]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) [spring-web-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106) [spring-web-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) [catalina.jar:6.0.37]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:6.0.37]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) [catalina.jar:6.0.37]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [catalina.jar:6.0.37]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [catalina.jar:6.0.37]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) [catalina.jar:6.0.37]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [catalina.jar:6.0.37]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) [catalina.jar:6.0.37]
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861) [tomcat-coyote.jar:6.0.37]
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606) [tomcat-coyote.jar:6.0.37]
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) [tomcat-coyote.jar:6.0.37]
    at java.lang.Thread.run(Unknown Source) [?:1.7.0_75]
Caused by: java.sql.SQLException: No suitable driver
    at java.sql.DriverManager.getDriver(Unknown Source) ~[?:1.7.0_75]
    at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437) ~[commons-dbcp-1.4.jar:1.4]
    ... 50 more
[http-8080-7] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
[http-8080-7] INFO org.springframework.jdbc.support.SQLErrorCodesFactory - SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]
2015-03-16 18:15:24,444 ERROR [log4jdbc.log4j2] null. DataSource.getConnection()
org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'net.sf.log4jdbc.sql.jdbcapi.DriverSpy' for connect URL 'jdbc:log4jdbc:edb://218.145.26.12:5445/dementia'
    at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1452) ~[commons-dbcp-1.4.jar:1.4]
    at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371) ~[commons-dbcp-1.4.jar:1.4]
    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) ~[commons-dbcp-1.4.jar:1.4]
    at net.sf.log4jdbc.sql.jdbcapi.DataSourceSpy.getConnection(DataSourceSpy.java:147) [log4jdbc-log4j2-jdbc4-1.16.jar:?]
    at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111) [spring-jdbc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy$TransactionAwareInvocationHandler.invoke(TransactionAwareDataSourceProxy.java:224) [spring-jdbc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at com.sun.proxy.$Proxy22.getMetaData(Unknown Source) [?:?]
    at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:285) [spring-jdbc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:320) [spring-jdbc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.jdbc.support.SQLErrorCodesFactory.getErrorCodes(SQLErrorCodesFactory.java:214) [spring-jdbc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.setDataSource(SQLErrorCodeSQLExceptionTranslator.java:140) [spring-jdbc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.<init>(SQLErrorCodeSQLExceptionTranslator.java:103) [spring-jdbc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.jdbc.support.JdbcAccessor.getExceptionTranslator(JdbcAccessor.java:99) [spring-jdbc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:206) [spring-orm-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(SqlMapClientTemplate.java:271) [spring-orm-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at dementia.casestudy.login.dao.CaseLoginDAO.getLoginUserCountMac(CaseLoginDAO.java:22) [CaseLoginDAO.class:?]
    at dementia.casestudy.login.service.CaseLoginService.getLoginUserCountMac(CaseLoginService.java:30) [CaseLoginService.class:?]
    at dementia.casestudy.login.controller.CaseLoginController.loginProc(CaseLoginController.java:74) [CaseLoginController.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_75]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_75]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_75]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_75]
    at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176) [spring-web-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at dementia.casestudy.common.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:456) [AnnotationMethodHandlerAdapter.class:?]
    at dementia.casestudy.common.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:426) [AnnotationMethodHandlerAdapter.class:?]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:919) [spring-webmvc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:851) [spring-webmvc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953) [spring-webmvc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:855) [spring-webmvc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:643) [servlet-api.jar:?]
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829) [spring-webmvc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:723) [servlet-api.jar:?]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) [catalina.jar:6.0.37]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:6.0.37]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) [spring-web-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106) [spring-web-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) [catalina.jar:6.0.37]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:6.0.37]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) [catalina.jar:6.0.37]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [catalina.jar:6.0.37]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [catalina.jar:6.0.37]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) [catalina.jar:6.0.37]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [catalina.jar:6.0.37]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) [catalina.jar:6.0.37]
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861) [tomcat-coyote.jar:6.0.37]
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606) [tomcat-coyote.jar:6.0.37]
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) [tomcat-coyote.jar:6.0.37]
    at java.lang.Thread.run(Unknown Source) [?:1.7.0_75]
Caused by: java.sql.SQLException: No suitable driver
    at java.sql.DriverManager.getDriver(Unknown Source) ~[?:1.7.0_75]
    at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437) ~[commons-dbcp-1.4.jar:1.4]
    ... 47 more
[http-8080-7] WARN org.springframework.jdbc.support.SQLErrorCodesFactory - Error while extracting database product name - falling back to empty error codes
org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'net.sf.log4jdbc.sql.jdbcapi.DriverSpy' for connect URL 'jdbc:log4jdbc:edb://218.145.26.12:5445/dementia'
    at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:296)
    at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:320)
    at org.springframework.jdbc.support.SQLErrorCodesFactory.getErrorCodes(SQLErrorCodesFactory.java:214)
    at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.setDataSource(SQLErrorCodeSQLExceptionTranslator.java:140)
    at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.<init>(SQLErrorCodeSQLExceptionTranslator.java:103)
    at org.springframework.jdbc.support.JdbcAccessor.getExceptionTranslator(JdbcAccessor.java:99)
    at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:206)
    at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(SqlMapClientTemplate.java:271)
    at dementia.casestudy.login.dao.CaseLoginDAO.getLoginUserCountMac(CaseLoginDAO.java:22)
    at dementia.casestudy.login.service.CaseLoginService.getLoginUserCountMac(CaseLoginService.java:30)
    at dementia.casestudy.login.controller.CaseLoginController.loginProc(CaseLoginController.java:74)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
    at dementia.casestudy.common.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:456)
    at dementia.casestudy.common.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:426)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:919)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:851)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:855)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'net.sf.log4jdbc.sql.jdbcapi.DriverSpy' for connect URL 'jdbc:log4jdbc:edb://218.145.26.12:5445/dementia'
    at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1452)
    at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
    at net.sf.log4jdbc.sql.jdbcapi.DataSourceSpy.getConnection(DataSourceSpy.java:147)
    at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
    at org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy$TransactionAwareInvocationHandler.invoke(TransactionAwareDataSourceProxy.java:224)
    at com.sun.proxy.$Proxy22.getMetaData(Unknown Source)
    at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:285)
    ... 40 more
Caused by: java.sql.SQLException: No suitable driver
    at java.sql.DriverManager.getDriver(Unknown Source)
    at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437)
    ... 47 more
org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0];
--- The error occurred in egovframework/sqlmap/case/login/CaseLogin_Postgres.xml.
--- The error occurred while executing query.
--- Check the    SELECT COUNT(ID) FROM TB_MAC    WHERE     PLACE IN (SELECT ADMIN_PLACE FROM TB_MEMBER_ADMIN      WHERE ADMIN_ID = ?     AND admin_value  = 'Y'      AND admin_level != '0')     AND log_YN       = 'Y'      AND mac_addr     = ?  .
--- Check the SQL Statement (preparation failed).
--- Cause: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'net.sf.log4jdbc.sql.jdbcapi.DriverSpy' for connect URL 'jdbc:log4jdbc:edb://218.145.26.12:5445/dementia'; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in egovframework/sqlmap/case/login/CaseLogin_Postgres.xml.
--- The error occurred while executing query.
--- Check the    SELECT COUNT(ID) FROM TB_MAC    WHERE     PLACE IN (SELECT ADMIN_PLACE FROM TB_MEMBER_ADMIN      WHERE ADMIN_ID = ?     AND admin_value  = 'Y'      AND admin_level != '0')     AND log_YN       = 'Y'      AND mac_addr     = ?  .
--- Check the SQL Statement (preparation failed).
--- Cause: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'net.sf.log4jdbc.sql.jdbcapi.DriverSpy' for connect URL 'jdbc:log4jdbc:edb://218.145.26.12:5445/dementia'
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
    at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:206)
    at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(SqlMapClientTemplate.java:271)
    at dementia.casestudy.login.dao.CaseLoginDAO.getLoginUserCountMac(CaseLoginDAO.java:22)
    at dementia.casestudy.login.service.CaseLoginService.getLoginUserCountMac(CaseLoginService.java:30)
    at dementia.casestudy.login.controller.CaseLoginController.loginProc(CaseLoginController.java:74)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
    at dementia.casestudy.common.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:456)
    at dementia.casestudy.common.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:426)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:919)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:851)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:855)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Unknown Source)
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in egovframework/sqlmap/case/login/CaseLogin_Postgres.xml.
--- The error occurred while executing query.
--- Check the    SELECT COUNT(ID) FROM TB_MAC    WHERE     PLACE IN (SELECT ADMIN_PLACE FROM TB_MEMBER_ADMIN      WHERE ADMIN_ID = ?     AND admin_value  = 'Y'      AND admin_level != '0')     AND log_YN       = 'Y'      AND mac_addr     = ?  .
--- Check the SQL Statement (preparation failed).
--- Cause: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'net.sf.log4jdbc.sql.jdbcapi.DriverSpy' for connect URL 'jdbc:log4jdbc:edb://218.145.26.12:5445/dementia'
    at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:201)
    at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForObject(MappedStatement.java:120)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:518)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:493)
    at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106)
    at org.springframework.orm.ibatis.SqlMapClientTemplate$1.doInSqlMapClient(SqlMapClientTemplate.java:273)
    at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:203)
    ... 34 more
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'net.sf.log4jdbc.sql.jdbcapi.DriverSpy' for connect URL 'jdbc:log4jdbc:edb://218.145.26.12:5445/dementia'
    at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1452)
    at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
    at net.sf.log4jdbc.sql.jdbcapi.DataSourceSpy.getConnection(DataSourceSpy.java:147)
    at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
    at org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy$TransactionAwareInvocationHandler.invoke(TransactionAwareDataSourceProxy.java:224)
    at com.sun.proxy.$Proxy22.prepareStatement(Unknown Source)
    at com.ibatis.sqlmap.engine.execution.SqlExecutor.prepareStatement(SqlExecutor.java:497)
    at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:175)
    at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteQuery(MappedStatement.java:221)
    at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:189)
    ... 40 more
Caused by: java.sql.SQLException: No suitable driver
    at java.sql.DriverManager.getDriver(Unknown Source)
    at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437)
    ... 50 more
```

答:
In my case it kept throwing undetailed

```<code> Caused by: java.lang.NoClassDefFoundError: Could not initialize class net.sf.log4jdbc.sql.jdbcapi.DriverSpy
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:247)
      at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.getDriver(LocalManagedConnectionFactory.java:283)
      at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:171)
</code>```

until I added log4jdbc.log4j2.properties file to classpath with

```<code>log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator
</code>```

It seems log4jdbc-log4j2 requires this file in case log4j2 is not present on classpath.

See the docs at http://log4jdbc.brunorozendo.com.

Body:
I'd checkout the web-project(Spring framework) from my company's svn.

When I run it on tomcat server, It was ok.

But I tried to log-in at webpage from project, the error log of below has occurred.

It seems error because of kinds of log4j2 jars, but I checked the maven dependency, and the jar file is already downloaded.

I checked the compiler compiliance level also, it was 1.7.

I delete the project and re-checkout from our svn over and over.

What's wrong about this??

at POM.xml

        <dependency>
            <groupId>org.bgee.log4jdbc-log4j2</groupId>
            <artifactId>log4jdbc-log4j2-jdbc4</artifactId>
            <version>1.16</version>
        </dependency>

below is log.

2015-03-16 18:15:24,354 ERROR [log4jdbc.log4j2] null. DataSource.getConnection()
org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'net.sf.log4jdbc.sql.jdbcapi.DriverSpy' for connect URL 'jdbc:log4jdbc:edb://218.145.26.12:5445/dementia'
    at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1452) ~[commons-dbcp-1.4.jar:1.4]
    at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371) ~[commons-dbcp-1.4.jar:1.4]
    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) ~[commons-dbcp-1.4.jar:1.4]
    at net.sf.log4jdbc.sql.jdbcapi.DataSourceSpy.getConnection(DataSourceSpy.java:147) [log4jdbc-log4j2-jdbc4-1.16.jar:?]
    at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111) [spring-jdbc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy$TransactionAwareInvocationHandler.invoke(TransactionAwareDataSourceProxy.java:224) [spring-jdbc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at com.sun.proxy.$Proxy22.prepareStatement(Unknown Source) [?:?]
    at com.ibatis.sqlmap.engine.execution.SqlExecutor.prepareStatement(SqlExecutor.java:497) [ibatis-sqlmap-2.3.4.726.jar:?]
    at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:175) [ibatis-sqlmap-2.3.4.726.jar:?]
    at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteQuery(MappedStatement.java:221) [ibatis-sqlmap-2.3.4.726.jar:?]
    at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:189) [ibatis-sqlmap-2.3.4.726.jar:?]
    at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForObject(MappedStatement.java:120) [ibatis-sqlmap-2.3.4.726.jar:?]
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:518) [ibatis-sqlmap-2.3.4.726.jar:?]
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:493) [ibatis-sqlmap-2.3.4.726.jar:?]
    at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106) [ibatis-sqlmap-2.3.4.726.jar:?]
    at org.springframework.orm.ibatis.SqlMapClientTemplate$1.doInSqlMapClient(SqlMapClientTemplate.java:273) [spring-orm-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:203) [spring-orm-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(SqlMapClientTemplate.java:271) [spring-orm-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at dementia.casestudy.login.dao.CaseLoginDAO.getLoginUserCountMac(CaseLoginDAO.java:22) [CaseLoginDAO.class:?]
    at dementia.casestudy.login.service.CaseLoginService.getLoginUserCountMac(CaseLoginService.java:30) [CaseLoginService.class:?]
    at dementia.casestudy.login.controller.CaseLoginController.loginProc(CaseLoginController.java:74) [CaseLoginController.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_75]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_75]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_75]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_75]
    at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176) [spring-web-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at dementia.casestudy.common.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:456) [AnnotationMethodHandlerAdapter.class:?]
    at dementia.casestudy.common.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:426) [AnnotationMethodHandlerAdapter.class:?]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:919) [spring-webmvc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:851) [spring-webmvc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953) [spring-webmvc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:855) [spring-webmvc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:643) [servlet-api.jar:?]
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829) [spring-webmvc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:723) [servlet-api.jar:?]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) [catalina.jar:6.0.37]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:6.0.37]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) [spring-web-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106) [spring-web-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) [catalina.jar:6.0.37]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:6.0.37]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) [catalina.jar:6.0.37]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [catalina.jar:6.0.37]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [catalina.jar:6.0.37]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) [catalina.jar:6.0.37]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [catalina.jar:6.0.37]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) [catalina.jar:6.0.37]
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861) [tomcat-coyote.jar:6.0.37]
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606) [tomcat-coyote.jar:6.0.37]
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) [tomcat-coyote.jar:6.0.37]
    at java.lang.Thread.run(Unknown Source) [?:1.7.0_75]
Caused by: java.sql.SQLException: No suitable driver
    at java.sql.DriverManager.getDriver(Unknown Source) ~[?:1.7.0_75]
    at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437) ~[commons-dbcp-1.4.jar:1.4]
    ... 50 more
[http-8080-7] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
[http-8080-7] INFO org.springframework.jdbc.support.SQLErrorCodesFactory - SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]
2015-03-16 18:15:24,444 ERROR [log4jdbc.log4j2] null. DataSource.getConnection()
org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'net.sf.log4jdbc.sql.jdbcapi.DriverSpy' for connect URL 'jdbc:log4jdbc:edb://218.145.26.12:5445/dementia'
    at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1452) ~[commons-dbcp-1.4.jar:1.4]
    at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371) ~[commons-dbcp-1.4.jar:1.4]
    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) ~[commons-dbcp-1.4.jar:1.4]
    at net.sf.log4jdbc.sql.jdbcapi.DataSourceSpy.getConnection(DataSourceSpy.java:147) [log4jdbc-log4j2-jdbc4-1.16.jar:?]
    at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111) [spring-jdbc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy$TransactionAwareInvocationHandler.invoke(TransactionAwareDataSourceProxy.java:224) [spring-jdbc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at com.sun.proxy.$Proxy22.getMetaData(Unknown Source) [?:?]
    at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:285) [spring-jdbc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:320) [spring-jdbc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.jdbc.support.SQLErrorCodesFactory.getErrorCodes(SQLErrorCodesFactory.java:214) [spring-jdbc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.setDataSource(SQLErrorCodeSQLExceptionTranslator.java:140) [spring-jdbc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.<init>(SQLErrorCodeSQLExceptionTranslator.java:103) [spring-jdbc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.jdbc.support.JdbcAccessor.getExceptionTranslator(JdbcAccessor.java:99) [spring-jdbc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:206) [spring-orm-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(SqlMapClientTemplate.java:271) [spring-orm-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at dementia.casestudy.login.dao.CaseLoginDAO.getLoginUserCountMac(CaseLoginDAO.java:22) [CaseLoginDAO.class:?]
    at dementia.casestudy.login.service.CaseLoginService.getLoginUserCountMac(CaseLoginService.java:30) [CaseLoginService.class:?]
    at dementia.casestudy.login.controller.CaseLoginController.loginProc(CaseLoginController.java:74) [CaseLoginController.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_75]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_75]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_75]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_75]
    at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176) [spring-web-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at dementia.casestudy.common.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:456) [AnnotationMethodHandlerAdapter.class:?]
    at dementia.casestudy.common.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:426) [AnnotationMethodHandlerAdapter.class:?]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:919) [spring-webmvc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:851) [spring-webmvc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953) [spring-webmvc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:855) [spring-webmvc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:643) [servlet-api.jar:?]
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829) [spring-webmvc-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:723) [servlet-api.jar:?]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) [catalina.jar:6.0.37]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:6.0.37]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) [spring-web-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106) [spring-web-3.2.9.RELEASE.jar:3.2.9.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) [catalina.jar:6.0.37]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:6.0.37]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) [catalina.jar:6.0.37]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [catalina.jar:6.0.37]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [catalina.jar:6.0.37]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) [catalina.jar:6.0.37]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [catalina.jar:6.0.37]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) [catalina.jar:6.0.37]
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861) [tomcat-coyote.jar:6.0.37]
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606) [tomcat-coyote.jar:6.0.37]
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) [tomcat-coyote.jar:6.0.37]
    at java.lang.Thread.run(Unknown Source) [?:1.7.0_75]
Caused by: java.sql.SQLException: No suitable driver
    at java.sql.DriverManager.getDriver(Unknown Source) ~[?:1.7.0_75]
    at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437) ~[commons-dbcp-1.4.jar:1.4]
    ... 47 more
[http-8080-7] WARN org.springframework.jdbc.support.SQLErrorCodesFactory - Error while extracting database product name - falling back to empty error codes
org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'net.sf.log4jdbc.sql.jdbcapi.DriverSpy' for connect URL 'jdbc:log4jdbc:edb://218.145.26.12:5445/dementia'
    at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:296)
    at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:320)
    at org.springframework.jdbc.support.SQLErrorCodesFactory.getErrorCodes(SQLErrorCodesFactory.java:214)
    at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.setDataSource(SQLErrorCodeSQLExceptionTranslator.java:140)
    at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.<init>(SQLErrorCodeSQLExceptionTranslator.java:103)
    at org.springframework.jdbc.support.JdbcAccessor.getExceptionTranslator(JdbcAccessor.java:99)
    at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:206)
    at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(SqlMapClientTemplate.java:271)
    at dementia.casestudy.login.dao.CaseLoginDAO.getLoginUserCountMac(CaseLoginDAO.java:22)
    at dementia.casestudy.login.service.CaseLoginService.getLoginUserCountMac(CaseLoginService.java:30)
    at dementia.casestudy.login.controller.CaseLoginController.loginProc(CaseLoginController.java:74)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
    at dementia.casestudy.common.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:456)
    at dementia.casestudy.common.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:426)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:919)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:851)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:855)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'net.sf.log4jdbc.sql.jdbcapi.DriverSpy' for connect URL 'jdbc:log4jdbc:edb://218.145.26.12:5445/dementia'
    at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1452)
    at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
    at net.sf.log4jdbc.sql.jdbcapi.DataSourceSpy.getConnection(DataSourceSpy.java:147)
    at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
    at org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy$TransactionAwareInvocationHandler.invoke(TransactionAwareDataSourceProxy.java:224)
    at com.sun.proxy.$Proxy22.getMetaData(Unknown Source)
    at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:285)
    ... 40 more
Caused by: java.sql.SQLException: No suitable driver
    at java.sql.DriverManager.getDriver(Unknown Source)
    at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437)
    ... 47 more
org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0];
--- The error occurred in egovframework/sqlmap/case/login/CaseLogin_Postgres.xml.
--- The error occurred while executing query.
--- Check the    SELECT COUNT(ID) FROM TB_MAC    WHERE     PLACE IN (SELECT ADMIN_PLACE FROM TB_MEMBER_ADMIN      WHERE ADMIN_ID = ?     AND admin_value  = 'Y'      AND admin_level != '0')     AND log_YN       = 'Y'      AND mac_addr     = ?  .
--- Check the SQL Statement (preparation failed).
--- Cause: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'net.sf.log4jdbc.sql.jdbcapi.DriverSpy' for connect URL 'jdbc:log4jdbc:edb://218.145.26.12:5445/dementia'; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in egovframework/sqlmap/case/login/CaseLogin_Postgres.xml.
--- The error occurred while executing query.
--- Check the    SELECT COUNT(ID) FROM TB_MAC    WHERE     PLACE IN (SELECT ADMIN_PLACE FROM TB_MEMBER_ADMIN      WHERE ADMIN_ID = ?     AND admin_value  = 'Y'      AND admin_level != '0')     AND log_YN       = 'Y'      AND mac_addr     = ?  .
--- Check the SQL Statement (preparation failed).
--- Cause: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'net.sf.log4jdbc.sql.jdbcapi.DriverSpy' for connect URL 'jdbc:log4jdbc:edb://218.145.26.12:5445/dementia'
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
    at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:206)
    at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(SqlMapClientTemplate.java:271)
    at dementia.casestudy.login.dao.CaseLoginDAO.getLoginUserCountMac(CaseLoginDAO.java:22)
    at dementia.casestudy.login.service.CaseLoginService.getLoginUserCountMac(CaseLoginService.java:30)
    at dementia.casestudy.login.controller.CaseLoginController.loginProc(CaseLoginController.java:74)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
    at dementia.casestudy.common.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:456)
    at dementia.casestudy.common.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:426)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:919)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:851)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:855)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Unknown Source)
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in egovframework/sqlmap/case/login/CaseLogin_Postgres.xml.
--- The error occurred while executing query.
--- Check the    SELECT COUNT(ID) FROM TB_MAC    WHERE     PLACE IN (SELECT ADMIN_PLACE FROM TB_MEMBER_ADMIN      WHERE ADMIN_ID = ?     AND admin_value  = 'Y'      AND admin_level != '0')     AND log_YN       = 'Y'      AND mac_addr     = ?  .
--- Check the SQL Statement (preparation failed).
--- Cause: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'net.sf.log4jdbc.sql.jdbcapi.DriverSpy' for connect URL 'jdbc:log4jdbc:edb://218.145.26.12:5445/dementia'
    at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:201)
    at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForObject(MappedStatement.java:120)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:518)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:493)
    at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106)
    at org.springframework.orm.ibatis.SqlMapClientTemplate$1.doInSqlMapClient(SqlMapClientTemplate.java:273)
    at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:203)
    ... 34 more
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'net.sf.log4jdbc.sql.jdbcapi.DriverSpy' for connect URL 'jdbc:log4jdbc:edb://218.145.26.12:5445/dementia'
    at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1452)
    at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
    at net.sf.log4jdbc.sql.jdbcapi.DataSourceSpy.getConnection(DataSourceSpy.java:147)
    at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
    at org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy$TransactionAwareInvocationHandler.invoke(TransactionAwareDataSourceProxy.java:224)
    at com.sun.proxy.$Proxy22.prepareStatement(Unknown Source)
    at com.ibatis.sqlmap.engine.execution.SqlExecutor.prepareStatement(SqlExecutor.java:497)
    at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:175)
    at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteQuery(MappedStatement.java:221)
    at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:189)
    ... 40 more
Caused by: java.sql.SQLException: No suitable driver
    at java.sql.DriverManager.getDriver(Unknown Source)
    at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437)
    ... 50 more

Body:
In my case it kept throwing undetailed

 Caused by: java.lang.NoClassDefFoundError: Could not initialize class net.sf.log4jdbc.sql.jdbcapi.DriverSpy
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:247)
      at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.getDriver(LocalManagedConnectionFactory.java:283)
      at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:171)

until I added log4jdbc.log4j2.properties file to classpath with

log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator

It seems log4jdbc-log4j2 requires this file in case log4j2 is not present on classpath.

See the docs at http://log4jdbc.brunorozendo.com.


问:
Using absolute unix paths in windows with python
I'm creating an application that stores blob files into the hard drive, but this script must run in both linux and windows, the issue is that i want to give it an absolute path from the filesystem root and not one relative to the project files, this because im using git and dont want to deal with excluding all these files from syncing.

So i would like to have something like this:

```<code>path = '/var/lib/blob_files/'
file = open(path+'myfile.blob', 'w')
</code>```

and get a file in unix at:

```<code>/var/lib/blob_files/myfile.blob
</code>```

and in windows at:

```<code>C:\var\lib\blob_files\myfile.blob
</code>```

it could also be relative to the user home folder (/home/user in unix and C:/Users/User in windows) but i guess the problem is very similar.

How can i achieve this? is there any library or function that can help me transparently to convert this paths without having to ask in what plataform is the scrip running all the time?

Of my two options, absolute from root or relative from home folder, which one do you recomend to use?

Thanks in advance for any advice on this

答:
Ok, I got an answer by myself.

```<code>os.path.exists(os.path.abspath(filePath))
</code>```

Maybe it will be useful for anybody

Body:
I'm creating an application that stores blob files into the hard drive, but this script must run in both linux and windows, the issue is that i want to give it an absolute path from the filesystem root and not one relative to the project files, this because im using git and dont want to deal with excluding all these files from syncing.

So i would like to have something like this:

path = '/var/lib/blob_files/'
file = open(path+'myfile.blob', 'w')

and get a file in unix at:

/var/lib/blob_files/myfile.blob

and in windows at:

C:\var\lib\blob_files\myfile.blob

it could also be relative to the user home folder (/home/user in unix and C:/Users/User in windows) but i guess the problem is very similar.

How can i achieve this? is there any library or function that can help me transparently to convert this paths without having to ask in what plataform is the scrip running all the time?

Of my two options, absolute from root or relative from home folder, which one do you recomend to use?

Thanks in advance for any advice on this

Body:
Ok, I got an answer by myself.

os.path.exists(os.path.abspath(filePath))

Maybe it will be useful for anybody


问:
php cannot find Class when using namespace
I'm trying to make a object of a class from another file. Both file is located in the same folder & I used 'namespace App' in the both files. In the login files I'm trying to get the class object but it couldn't find the class. Codes are given below.

Database Class : 'Database.php'

```<code><?php
    namespace App;

    require_once 'config.php';

class Database{

    private $db;

    public function __construct(){

        $this->db =  new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);

    }

    public function getConnection(){

        return $this->db;

    }
</code>```

login.php file :

```<code><?php

    namespace App;

    use App\Database;

    require_once 'config.php';

    $DB = new Database();

    $con = $DB->getConnection;
</code>```

When I execute login.php , it says Fatal error: Uncaught Error: Class 'App\Database' not found in login.php on line 10

答:
If you are referencing the namespace in:

```<code>namespace App;
</code>```

You do not need to then include the namespace in the 'use'.

```<code>namespace App;
use Database;
</code>```

Body:
I'm trying to make a object of a class from another file. Both file is located in the same folder & I used 'namespace App' in the both files. In the login files I'm trying to get the class object but it couldn't find the class. Codes are given below.

Database Class : 'Database.php'

<?php
    namespace App;

    require_once 'config.php';

class Database{

    private $db;

    public function __construct(){

        $this->db =  new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);

    }

    public function getConnection(){

        return $this->db;

    }

login.php file :

<?php

    namespace App;

    use App\Database;

    require_once 'config.php';

    $DB = new Database();

    $con = $DB->getConnection;

When I execute login.php , it says Fatal error: Uncaught Error: Class 'App\Database' not found in login.php on line 10

Body:
If you are referencing the namespace in:

namespace App;

You do not need to then include the namespace in the 'use'.

namespace App;
use Database;


问:
INSERT data in table with result of a SELECT
I'm trying to populate a table with the result of a select, but I always get the following error :

Duplicate entry '0' for key 'PRIMARY' SQL=INSERT INTO fab_bloquer_jours ( id,day,date ) VALUES ( '','4','2017-12-04 14:55:49' )

My table fab_bloquer_jours is :

```<code>1   id Primary  int(11)
2   day int(13)
3   date    datetime
</code>```

My query is :

```<code>$day=$data['fab_bloquer_jours___day'];

$query = $db->getQuery(true);
$query = "INSERT INTO fab_bloquer_jours (day)
SELECT *
   FROM (
        SELECT DATE_ADD('2018-01-01',
            INTERVAL n4.num*1000+n3.num*100+n2.num*10+n1.num DAY ) AS DATE
          FROM (
              SELECT 0 AS num
              UNION ALL SELECT 1
              UNION ALL SELECT 2
              UNION ALL SELECT 3
              UNION ALL SELECT 4
              UNION ALL SELECT 5
              UNION ALL SELECT 6
              UNION ALL SELECT 7
              UNION ALL SELECT 8
              UNION ALL SELECT 9
         ) AS n1,
         (
              SELECT 0 AS num
              UNION ALL SELECT 1
              UNION ALL SELECT 2
              UNION ALL SELECT 3
              UNION ALL SELECT 4
              UNION ALL SELECT 5
              UNION ALL SELECT 6
              UNION ALL SELECT 7
              UNION ALL SELECT 8
              UNION ALL SELECT 9
        ) AS n2,
        (
              SELECT 0 AS num
              UNION ALL SELECT 1
              UNION ALL SELECT 2
              UNION ALL SELECT 3
              UNION ALL SELECT 4
              UNION ALL SELECT 5
              UNION ALL SELECT 6
              UNION ALL SELECT 7
              UNION ALL SELECT 8
              UNION ALL SELECT 9
        ) AS n3,
        (
              SELECT 0 AS num
              UNION ALL SELECT 1
              UNION ALL SELECT 2
              UNION ALL SELECT 3
              UNION ALL SELECT 4
              UNION ALL SELECT 5
              UNION ALL SELECT 6
              UNION ALL SELECT 7
              UNION ALL SELECT 8
              UNION ALL SELECT 9
        ) AS n4
    ) AS a
WHERE DATE >= '2018-01-01' AND DATE < '2019-01-01'
  AND WEEKDAY(DATE) = '$day'";
$db->setQuery($query);
$query=$db->execute();
</code>```

I get the $date value through a dropdown.

I would appreciate some help here, since I can't figure out how to make it work.

答:
Remove Id and it's empty value, see below:

```<code>INSERT INTO `fab_bloquer_jours` (`day`,`date`) VALUES ('4','2017-12-04 14:55:49');
</code>```

On your second query, the select statement is wrong. You're trying to insert into one column, but your select statement is saying select all. Anything you make for select statement must be inside of brackets and as one column. e.g.

```<code>INSERT INTO fab_bloquer_jours (day) VALUES (your SELECT COLUMNNAME FROM TABLE)
</code>```

Body:
I'm trying to populate a table with the result of a select, but I always get the following error :

Duplicate entry '0' for key 'PRIMARY' SQL=INSERT INTO fab_bloquer_jours ( id,day,date ) VALUES ( '','4','2017-12-04 14:55:49' )

My table fab_bloquer_jours is :

1   id Primary  int(11)
2   day int(13)
3   date    datetime

My query is :

$day=$data['fab_bloquer_jours___day'];

$query = $db->getQuery(true);
$query = "INSERT INTO fab_bloquer_jours (day)
SELECT *
   FROM (
        SELECT DATE_ADD('2018-01-01',
            INTERVAL n4.num*1000+n3.num*100+n2.num*10+n1.num DAY ) AS DATE
          FROM (
              SELECT 0 AS num
              UNION ALL SELECT 1
              UNION ALL SELECT 2
              UNION ALL SELECT 3
              UNION ALL SELECT 4
              UNION ALL SELECT 5
              UNION ALL SELECT 6
              UNION ALL SELECT 7
              UNION ALL SELECT 8
              UNION ALL SELECT 9
         ) AS n1,
         (
              SELECT 0 AS num
              UNION ALL SELECT 1
              UNION ALL SELECT 2
              UNION ALL SELECT 3
              UNION ALL SELECT 4
              UNION ALL SELECT 5
              UNION ALL SELECT 6
              UNION ALL SELECT 7
              UNION ALL SELECT 8
              UNION ALL SELECT 9
        ) AS n2,
        (
              SELECT 0 AS num
              UNION ALL SELECT 1
              UNION ALL SELECT 2
              UNION ALL SELECT 3
              UNION ALL SELECT 4
              UNION ALL SELECT 5
              UNION ALL SELECT 6
              UNION ALL SELECT 7
              UNION ALL SELECT 8
              UNION ALL SELECT 9
        ) AS n3,
        (
              SELECT 0 AS num
              UNION ALL SELECT 1
              UNION ALL SELECT 2
              UNION ALL SELECT 3
              UNION ALL SELECT 4
              UNION ALL SELECT 5
              UNION ALL SELECT 6
              UNION ALL SELECT 7
              UNION ALL SELECT 8
              UNION ALL SELECT 9
        ) AS n4
    ) AS a
WHERE DATE >= '2018-01-01' AND DATE < '2019-01-01'
  AND WEEKDAY(DATE) = '$day'";
$db->setQuery($query);
$query=$db->execute();

I get the $date value through a dropdown.

I would appreciate some help here, since I can't figure out how to make it work.

Body:
Remove Id and it's empty value, see below:

INSERT INTO `fab_bloquer_jours` (`day`,`date`) VALUES ('4','2017-12-04 14:55:49');

On your second query, the select statement is wrong. You're trying to insert into one column, but your select statement is saying select all. Anything you make for select statement must be inside of brackets and as one column. e.g.

INSERT INTO fab_bloquer_jours (day) VALUES (your SELECT COLUMNNAME FROM TABLE)


问:
Python: Removing a specific item that has a duplicate only knowing its index in a list
What I want this program to do is to delete all the 1's that are in the list that follow by index all the 2's.

This is the code:

```<code>a = [3, 1, 2, 1]
a.remove(a[3])
print(a)
</code>```

I really put this program into the basics but the point is that I have only got the index of the 1 that follows the 2, tho when I do this the result is:

```<code>[3, 2, 1]
</code>```

This means that it doesn't delete the 1 I want but just the first 1 it finds. Tho this is really a problem in a real program situation where the first 1 is an important value.

How can I fix it? Thanks

答:
You can use list comprehension:

```<code>a = [3, 1, 2, 1]
new_a = [c for i, c in enumerate(a) if c != 1 and i+1 < len(a) and a[i+1] != 2]+[a[-1]]
</code>```

Output:

```<code>[3, 2, 1]
</code>```

Body:
What I want this program to do is to delete all the 1's that are in the list that follow by index all the 2's.

This is the code:

a = [3, 1, 2, 1]
a.remove(a[3])
print(a)

I really put this program into the basics but the point is that I have only got the index of the 1 that follows the 2, tho when I do this the result is:

[3, 2, 1]

This means that it doesn't delete the 1 I want but just the first 1 it finds. Tho this is really a problem in a real program situation where the first 1 is an important value.

How can I fix it? Thanks

Body:
You can use list comprehension:

a = [3, 1, 2, 1]
new_a = [c for i, c in enumerate(a) if c != 1 and i+1 < len(a) and a[i+1] != 2]+[a[-1]]

Output:

[3, 2, 1]


问:
JavaScript single quote using regex specific matching
I am learning regex and I want to do regex matching. However, I can't escape single quote properly using code the below. So, I am getting " [ 'Hell\'o', 'World' ] ". Probably I can use /[^\s]+/g for the quick answer  " [ 'Hell'o', 'World' ] " other than the code below. However, it's hard for me to understand how regex system works if I use it. Is it possible to use other regex matching tokens for escape single quote when it outputs?

function printWords(str) {
  var count = 0;
  var arr = str.match(/[\w’]+/g);
  console.log(arr);

}
printWords("Hell'o　World ")```

--

答:
Ok, I'm not sure if I understood you correctly if not please don't give mi minus :) But if I use your code and change single quote to normal single quote it works the same way as /[^\s]+/g. So I guess it's what you wanted. If not, then sorry :)

function printWords(str) {
  var count = 0;
  var arr = str.match(/[\w']+/g);
  console.log("/[\w']+/g\n", arr);
}
printWords("Hell'o　World ");

function printWordss(str) {
  var count = 0;
  var arr = str.match(/[^\s]+/g);
  console.log("/[^\s]+/g\n", arr);
}
printWordss("Hell'o　World ")```

Regards, KJ

Body:
I am learning regex and I want to do regex matching. However, I can't escape single quote properly using code the below. So, I am getting " [ 'Hell\'o', 'World' ] ". Probably I can use /[^\s]+/g for the quick answer  " [ 'Hell'o', 'World' ] " other than the code below. However, it's hard for me to understand how regex system works if I use it. Is it possible to use other regex matching tokens for escape single quote when it outputs?

function printWords(str) {
  var count = 0;
  var arr = str.match(/[\w’]+/g);
  console.log(arr);

}
printWords("Hell'o　World ")

--

Body:
Ok, I'm not sure if I understood you correctly if not please don't give mi minus :) But if I use your code and change single quote to normal single quote it works the same way as /[^\s]+/g. So I guess it's what you wanted. If not, then sorry :)

function printWords(str) {
  var count = 0;
  var arr = str.match(/[\w']+/g);
  console.log("/[\w']+/g\n", arr);
}
printWords("Hell'o　World ");

function printWordss(str) {
  var count = 0;
  var arr = str.match(/[^\s]+/g);
  console.log("/[^\s]+/g\n", arr);
}
printWordss("Hell'o　World ")

Regards, KJ


问:
Writing a log bespoke log reader in PowerShell
I am trying to create a log reader. The data looks like so:

2017-11-27 13:24:41,791 [8] INFO  CTSipEndpoint.CLogger.provider.gsiplib [(null)] - -00001 [Info] Info    | 4744    | REGISTERdialog[1] 2-e:5;t:1-3 (dn:85188)

2017-11-27 13:24:41,791 [8] INFO  CTSipEndpoint.CLogger.provider.gsiplib [(null)] - -00001 [Info] Info    | 4744    | REGISTERdialog[1] event 2 REG/accepted

I am trying to do the following:

Return only lines in the last 48 hours to query further.

From above return any lines that contain the following phrases: "error"
"device","does not exist", "Could not identify speaker!","warn"

So far i have only been able to get this to work in an inefficient way, which runs against the file for each phrase and appends an array. Unfortunately this means that the date time becomes non-sequential. I need to now sort the content object at the end of the script to it be in sequence, or find a way to run this query smarter. Here is my script for reference:

```<code>$logfile =  "C:\users\test\desktop\programlogs.log"
$content = ""
cat $logfile |
Select-String "ERROR" -SimpleMatch |
  select -expand line |
   foreach {
              $_ -match '(.+)\s\[(ERROR)\]\s(.+)'| Out-Null
              $error_time = [datetime]($matches[1]).split(",")[0]
              if ($error_time -gt (Get-Date).AddDays(-2))  {
               $content += $_ + "`n"
               }
            }

cat $logfile |
Select-String "device" -SimpleMatch |
  select -expand line |
   foreach {
              $_ -match '(.+)\s\[(device)\]\s(.+)'| Out-Null
              $error_time = [datetime]($matches[1]).split(",")[0]
              if ($error_time -gt (Get-Date).AddDays(-2))  {
               $content += $_ + "`n"
               }
            }

cat $logfile |
Select-String "does not exist" -SimpleMatch |
  select -expand line |
   foreach {
              $_ -match '(.+)\s\[(does not exist)\]\s(.+)'| Out-Null
              $error_time = [datetime]($matches[1]).split(",")[0]
              if ($error_time -gt (Get-Date).AddDays(-2))  {
               $content += $_ + "`n"
               }
            }

cat $logfile |
Select-String "Could not identify speaker!" -SimpleMatch |
  select -expand line |
   foreach {
              $_ -match '(.+)\s\[(Could not identify speaker!)\]\s(.+)'| Out-Null
              $error_time = [datetime]($matches[1]).split(",")[0]
              if ($error_time -gt (Get-Date).AddDays(-2))  {
               $content += $_ + "`n"
               }
            }

cat $logfile |
Select-String "Warn" -SimpleMatch |
  select -expand line |
   foreach {
              $_ -match '(.+)\s\[(Warn)\]\s(.+)'| Out-Null
              $error_time = [datetime]($matches[1]).split(",")[0]
              if ($error_time -gt (Get-Date).AddDays(-2))  {
               $content += $_ + "`n"
               }
            }

            $content = $content | select -uniq
            $file = "c:\temp\shortenedlog.txt"
            $content| Add-Content -Path $file
</code>```

答:
Came up with a solution which I have fed in the days i am interested in, followed by the search criteria. Used this solution as works quickly.</p>

```<code>#Set parameters.
$File = "c:\temp\RefinedLogs.txt"
$DateParam = (Get-Date).AddDays(-1).ToString('yyyy-MM-dd')
$DateParam1 = (Get-Date).ToString('yyyy-MM-dd')
$SearchForDate = @("$dateparam", "$dateparam1")
$SearchFor=@("error","device","does not exist","Could not identify speaker!","warn")

#Filter file with dates set in $SearchForDate.
$DateFiltered = Get-Content '.\MyAPP.log' | Select-String -Pattern $SearchForDate -SimpleMatch

#Filter variable for phrases set in $SearchFor.
$Content = $DateFiltered | Select-String -Pattern $SearchFor -SimpleMatch

#Make results readable
ForEach($line in $content){
    $Object = "$line" + "`n"
    $FinalResult +=  $Object
    }

#Output results.
write-host $FinalResult
</code>```

Body:
I am trying to create a log reader. The data looks like so:

2017-11-27 13:24:41,791 [8] INFO  CTSipEndpoint.CLogger.provider.gsiplib [(null)] - -00001 [Info] Info    | 4744    | REGISTERdialog[1] 2-e:5;t:1-3 (dn:85188)

2017-11-27 13:24:41,791 [8] INFO  CTSipEndpoint.CLogger.provider.gsiplib [(null)] - -00001 [Info] Info    | 4744    | REGISTERdialog[1] event 2 REG/accepted

I am trying to do the following:

Return only lines in the last 48 hours to query further.

From above return any lines that contain the following phrases: "error"
"device","does not exist", "Could not identify speaker!","warn"

So far i have only been able to get this to work in an inefficient way, which runs against the file for each phrase and appends an array. Unfortunately this means that the date time becomes non-sequential. I need to now sort the content object at the end of the script to it be in sequence, or find a way to run this query smarter. Here is my script for reference:

$logfile =  "C:\users\test\desktop\programlogs.log"
$content = ""
cat $logfile |
Select-String "ERROR" -SimpleMatch |
  select -expand line |
   foreach {
              $_ -match '(.+)\s\[(ERROR)\]\s(.+)'| Out-Null
              $error_time = [datetime]($matches[1]).split(",")[0]
              if ($error_time -gt (Get-Date).AddDays(-2))  {
               $content += $_ + "`n"
               }
            }

cat $logfile |
Select-String "device" -SimpleMatch |
  select -expand line |
   foreach {
              $_ -match '(.+)\s\[(device)\]\s(.+)'| Out-Null
              $error_time = [datetime]($matches[1]).split(",")[0]
              if ($error_time -gt (Get-Date).AddDays(-2))  {
               $content += $_ + "`n"
               }
            }

cat $logfile |
Select-String "does not exist" -SimpleMatch |
  select -expand line |
   foreach {
              $_ -match '(.+)\s\[(does not exist)\]\s(.+)'| Out-Null
              $error_time = [datetime]($matches[1]).split(",")[0]
              if ($error_time -gt (Get-Date).AddDays(-2))  {
               $content += $_ + "`n"
               }
            }

cat $logfile |
Select-String "Could not identify speaker!" -SimpleMatch |
  select -expand line |
   foreach {
              $_ -match '(.+)\s\[(Could not identify speaker!)\]\s(.+)'| Out-Null
              $error_time = [datetime]($matches[1]).split(",")[0]
              if ($error_time -gt (Get-Date).AddDays(-2))  {
               $content += $_ + "`n"
               }
            }

cat $logfile |
Select-String "Warn" -SimpleMatch |
  select -expand line |
   foreach {
              $_ -match '(.+)\s\[(Warn)\]\s(.+)'| Out-Null
              $error_time = [datetime]($matches[1]).split(",")[0]
              if ($error_time -gt (Get-Date).AddDays(-2))  {
               $content += $_ + "`n"
               }
            }

            $content = $content | select -uniq
            $file = "c:\temp\shortenedlog.txt"
            $content| Add-Content -Path $file

Body:
Came up with a solution which I have fed in the days i am interested in, followed by the search criteria. Used this solution as works quickly.

#Set parameters.
$File = "c:\temp\RefinedLogs.txt"
$DateParam = (Get-Date).AddDays(-1).ToString('yyyy-MM-dd')
$DateParam1 = (Get-Date).ToString('yyyy-MM-dd')
$SearchForDate = @("$dateparam", "$dateparam1")
$SearchFor=@("error","device","does not exist","Could not identify speaker!","warn")

#Filter file with dates set in $SearchForDate.
$DateFiltered = Get-Content '.\MyAPP.log' | Select-String -Pattern $SearchForDate -SimpleMatch

#Filter variable for phrases set in $SearchFor.
$Content = $DateFiltered | Select-String -Pattern $SearchFor -SimpleMatch

#Make results readable
ForEach($line in $content){
    $Object = "$line" + "`n"
    $FinalResult +=  $Object
    }

#Output results.
write-host $FinalResult


问:
More than 10 lines in a node.js stack error?
Is there a way to get more than 10 lines in a node.js stack error?

```<code>function a() { dieInHell(); }
function b() { a(); }
function c() { b(); }
function d() { c(); }
function e() { d(); }
function f() { e(); }
function g() { f(); }
function h() { g(); }
function i() { h(); }
function j() { i(); }
function k() { j(); }
function l() { k(); }
function m() { l(); }
function n() { m(); }
function o() { n(); }
function p() { o(); }
function q() { p(); }

try {
    q();
}
catch(e) {
    console.log(e.stack);
}
</code>```

shows :

```<code>$ node debug.js
ReferenceError: dieInHell is not defined
    at a (/Users/julien/tmp/debug.js:2:5)
    at b (/Users/julien/tmp/debug.js:6:5)
    at c (/Users/julien/tmp/debug.js:10:5)
    at d (/Users/julien/tmp/debug.js:14:5)
    at e (/Users/julien/tmp/debug.js:18:5)
    at f (/Users/julien/tmp/debug.js:22:5)
    at g (/Users/julien/tmp/debug.js:26:5)
    at h (/Users/julien/tmp/debug.js:30:5)
    at i (/Users/julien/tmp/debug.js:34:5)
    at j (/Users/julien/tmp/debug.js:38:5)
</code>```

Is there a way to get more than 10 calls?

答:
Also you can use built-in debugger, which opens familiar Google Chrome's dev-tools debugger. It stops on any error and you can browse the whole stack. Just run:</p>

```<code>$ node --inspect debug.js

Debugger listening on port 9229.
To start debugging, open the following URL in Chrome: chrome-devtools://devtools/remote/serve_file/...
</code>```

Body:
Is there a way to get more than 10 lines in a node.js stack error?

function a() { dieInHell(); }
function b() { a(); }
function c() { b(); }
function d() { c(); }
function e() { d(); }
function f() { e(); }
function g() { f(); }
function h() { g(); }
function i() { h(); }
function j() { i(); }
function k() { j(); }
function l() { k(); }
function m() { l(); }
function n() { m(); }
function o() { n(); }
function p() { o(); }
function q() { p(); }

try {
    q();
}
catch(e) {
    console.log(e.stack);
}

shows :

$ node debug.js
ReferenceError: dieInHell is not defined
    at a (/Users/julien/tmp/debug.js:2:5)
    at b (/Users/julien/tmp/debug.js:6:5)
    at c (/Users/julien/tmp/debug.js:10:5)
    at d (/Users/julien/tmp/debug.js:14:5)
    at e (/Users/julien/tmp/debug.js:18:5)
    at f (/Users/julien/tmp/debug.js:22:5)
    at g (/Users/julien/tmp/debug.js:26:5)
    at h (/Users/julien/tmp/debug.js:30:5)
    at i (/Users/julien/tmp/debug.js:34:5)
    at j (/Users/julien/tmp/debug.js:38:5)

Is there a way to get more than 10 calls?

Body:
Also you can use built-in debugger, which opens familiar Google Chrome's dev-tools debugger. It stops on any error and you can browse the whole stack. Just run:

$ node --inspect debug.js

Debugger listening on port 9229.
To start debugging, open the following URL in Chrome: chrome-devtools://devtools/remote/serve_file/...