readthefuckingmanual.net

[SOLVED] javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial

Error added: 2008-07-26T19:14:36Z

1 people waiting for the answer...

1 answers found.

Answer 2077 (100.0% helpful)

	<bean id="dao" class="package.DaoImpl">
		<constructor-arg index="0" ref="dataSource" />
	</bean>

	<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
		<property name="driverClassName" value="org.postgresql.Driver"/>
		<property name="url" value="jdbc:postgresql://host/db"/>
		<property name="username" value="username"/>
		<property name="password" value="password"/>
	</bean>


    public Dao(final DataSource dataSource) {
        setDataSource(dataSource);
    }

    @Override
    protected void initDao() throws Exception {
        super.initDao();
    }
Permalink

Add an answer/solution

If you know the answer, please add your own solution below.
If you don't know, but find out later, please come back and share your answer - there will be other people struggling with this too.


Please enter 61948 here

If you want to be notified via email when this is solved, enter your email address here: