If you just want to know if an object is an instance of or extends a certain class, or implements a certain interface, you can use the instanceof keyword. 

public void myMethod(Object obj) {
    if (obj instanceof String) {
        System.out.println("It's a String");
    }
    else {
        System.out.println("It's not a String");
    }
}

 

https://coderanch.com/t/404450/java/type-object

 

how can I get the type of the object ? (Beginning Java forum at Coderanch)

 

coderanch.com

 

반응형
java.net.UnknownHostException: Unable to resolve host : No address associated with hostname

테스트할 기기에 인터넷 연결 안해두고,, 인터넷 요청을 해버림...ㅍㅎㅎ

외국에선 간혹 wifi bug라고 하긴 하지만..

 

 

Stack Overflow - Where Developers Learn, Share, & Build Careers

Stack Overflow | The World’s Largest Online Community for Developers

stackoverflow.com

 

반응형

'Backend > Java&Spring Framework' 카테고리의 다른 글

[JAVA] instanseof : Object 의 타입알기  (0) 2019.10.13
JAVA8 | lamda  (0) 2016.08.18
spring + mybatis + ppas error message 2  (0) 2015.07.14
spring + mybatis + ppas error message 1  (0) 2015.07.14
ppas  (0) 2015.07.09

# .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener(){ public void onClick(DialogInterface dialog, int which) { result.confirm(); } }).create();

lamda

.setPositiveButton(android.R.string.ok, (dialog, which) -> { result.confirm(); }).create();

반응형

Driver must not be null
  <property name="driver" value="com.edb.Driver" />

Cannot convert value of type [java.lang.String] to required type [java.sql.Driver] for property 'driver': no matching editors or conversion strategy found

<property name="driverClass" value="com.edb.Driver" />

java.lang.IllegalArgumentException: Cannot find class [com.edb.Driver]

 

1. 프로젝트 build path에 로컬경로로 넣어줌.

2. 로컬경로로 인식이 안되는 경우도 있다고 하여 webapp > WEB-INF > spring > lib 폴더 생성 > jdbc파일 추가

3. 프로젝트 build path로 위경로 인식함.

4. 안됨... 톰캣 이것저것만지다가

5. Run configration > classpath > User Entries > Add External JARs > jdbc 파일 추가 하니까 된다!!!!!

와ㅜㅜ이걸로보낸 시간이 얼마여............ㅜㅜ




There is no setter for property named 'seq' in 'class com.restful.test.model.Measure'


* Measure에 변수선언, set, get 등록 안함..

** extends 는 java에서는 변수명이 될 수 없음 (Syntax error on token "extends", invalid VariableDeclarator)

extends_etc로 변수명 선언



There is no setter for property named 'extends' in 'class com.restful.test.model.Measure'


sql.xml

 <result column="extends_etc" property="extends_etc"/>

바꾼 변수명으로 연결시켜줘야함.


====================== 이제 드디어 정상동작!! ===================================


HTTP Status 404 - /test/WEB-INF/views/lists.jsp

controller 에 return 값을 ##@#.jsp 명으로!

return "home";


HTTP Status 500 - An exception occurred processing JSP page /WEB-INF/views/home.jsp at line 24

Property 'values' not found on type com.restful.test.model.Measure


jstl 객체뿌려주는 곳에

        <td>${lists.date}</td> ->      <td>${lists.input_dt}</td>
        <td>${lists.extends}</td> -> <td>${lists.extends_etc}</td>

한번에 좀 바꿔줍시다!


====================== 이제 드디어 정상동작!! ===================================





근데 왜 values가 안나오지..?  

java 대소문자 구문한다... (확실한가... Values -> values 로 변경)


====================== 이제 드디어 정상동작!! ===================================


http://localhost:8080/test/list




반응형

BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

    <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>


Injection of autowired dependencies failed
Could not autowire field
@Repository("iMeasureDAO") 잘못선언되어잇었음       


Result Maps collection does not contain value -> Could not find result map com.spring.myapp.book.model.Measure] with root cause
Result Maps collection does not contain value for com.restful.test.model.Measure

    <resultMap  id="AllMemberList" type="com.restful.test.model.Measure"> 
               <result column="seq" property="seq"/>
               <result column="key" property="key"/>
               <result column="contents" property="contents"/>
               <result column="input_dt" property="input_dt"/>
               <result column="extends" property="extends"/>
        </resultMap>
       
        <!-- parameterType="int"  where seq = #{seq} -->
       
        <select id="getMeasureList" resultMap="AllMemberList" >
               select seq, key, values, input_dt, extends
               from measures
        </select>

위에 부분을 지정안해줌
http://hyeonstorage.tistory.com/283



반응형

https://jdbc.postgresql.org/documentation/publicapi/org/postgresql/ds/PGConnectionPoolDataSource.html

property 확인


In any case, in order to use this ConnectionPoolDataSource, you must set the property databaseName. The settings for serverName, portNumber, user, and password are optional. Note: these properties are declared in the superclass.




No bean class specified on bean definition - Spring Forum

http://stackoverflow.com/questions/20544963/java-lang-illegalstateexception-no-bean-class-specified-on-bean-definition



nested exception is java.lang.ClassNotFoundException: com.edb.ds.PGConnectionPoolDataSource




Could not load properties; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/dbpool.properties]



반응형

 



postgreSQL Database Cluster Initialisation Failed... 

문제
계속 이래서 왜그런지 몰랐는데... 
보안때문에 특정 폴더 예)Programs files 같은 폴더에 생성이 안되도록 하는 것이 있단다.. 윈도우 vista 이후에서부터는...
그래서 관리자 권한으로 실행해도 안되고,, 계속 database cluster 만들때 오류가 났던것...

해결
* Data Directory 와 WAL Directory를 c:\Programs Files\ 로 하지말고, 다른 경로에 지정하자! 그럼 해결^.^

참고

http://www.geekscribes.net/blog/2009/04/22/postgresql-database-cluster-initialisation-failed-solution/

반응형

The ResourceConfig instance does not contain any root resource classes.


web.xml 안에 

 <servlet-name>Jersey Web Application</servlet-name>

  <url-pattern>com.pretech/*</url-pattern> 


위에 구조가 package 이름과 맞춰져야 한다. 

반응형

'Backend > Java&Spring Framework' 카테고리의 다른 글

ppas  (0) 2015.07.09
postgreSQL Database Cluster Initialisation Failed....  (0) 2015.07.08
'Building workspace' has encountered an error  (0) 2015.07.01
JSTL c:forEach  (0) 2013.01.25
jsonObject의 해당값 접근하기  (0) 2013.01.23

'Building workspace' has encountered an error"




Errors occurred during the build.

Errors running builder 'Maven Project Builder' on project 'RESTJerseyExample'.

Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6

Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6

Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6

Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6

반응형

<c:forEach items="${sdatas}" var="staff" varStatus="sdatas">


sdatas에 담겨진

index를 알고싶으면?  ${sdatas.index}

count를 알고싶으면? ${sdatas.count}

반응형

System.out.println("StaffList:"+jsonObject.names()+"::"+jsonObject.values());

반응형

swt Browser url 찾기


swt browser에서 url을 타면서 이동할 때 URL를 알아내는 방법





반응형

HTTP Status 500 -

The server encountered an internal error () that prevented it from fulfilling this request. 

The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application



------------------------------------------------------------------------------------------------------------------


이런 에러가 난다면??


1. JavaBeans를 잘 사용했는지 확인! (인터넷에서 열심히 찾아보자!)

2. 기존에 잘 됐었는데 갑자기 안되었다면????

  -> 톰캣을 너무많이 실행해서 톰켓안에서 꼬인것이다.ㅜㅜ.(test를 너무 많이 해서.)


그렇다면,, 이렇게 해보자!




반응형
String url = request.getRequestURL().toString();

  String[] str = url.split("/",7);

    String geturl = str[6];

  

   int page_size = 7;

   int group_size = 3;

   int totalCount;

   int pageCount;

   int curPage;

   

   if(reqPage==null){

   curPage=1;

   }else{

   curPage= Integer.parseInt(reqPage);

   }

  

 

반응형



<!-- 세션 -->


<!-- 로그인 안된 상태에서 uri을 통한 접근 방지 -->

<% String name=(String)session.getAttribute("username"); 

    String auth=(String)session.getAttribute("right"); 

    boolean sessionchk = name == null ? false : true;

    if(sessionchk == false){     System.out.println("baseurl :"+baseurl);

    out.println("<script>alert('로그인이 필요합니다.');");

    out.println("location.replace('"+baseurl+"/main.jsp');</script>");

    return;

    }

    %>


반응형

+ Recent posts