users@cargotracker.java.net

Re: Unable to deploy

From: Reza Rahman <Reza.Rahman_at_oracle.com>
Date: Sat, 05 Oct 2013 12:54:44 -0400

FYI, the Derby path really should just be auto-created:
http://db.apache.org/derby/docs/10.0/manuals/develop/develop14.html.
I'll double check but it looks like this works properly on Windows only.

On 10/5/2013 12:51 PM, Reza Rahman wrote:
> The previous problem you were having was very likely a GlassFish bug.
> The promoted version of GlassFish you are running also has knows bugs
> that we've documented on the site FYI.
>
> To change the database location, all you should need to do is change
> the <webapp.databaseTempDir> entry in pom.xml and rebuild. The
> test-web.xml entry is used only for tests.
>
> Could you kindly try out different values for 'databaseTempDir' and
> see if something can work without needing to muck with
> permissions/creating directories? Otherwise, we really need to add
> this to our setup instructions ASAP:
> https://java.net/projects/cargotracker/pages/NetBeans. I would do this
> myself but I'll take me a while to get a Linux/UNIX version up and
> running...
>
> On 10/5/2013 12:36 PM, David Heffelfinger wrote:
>> Better, but not a flawless experience.
>>
>> Originally I got an exception:
>>
>> java.sql.SQLException: *Failed to create database
>> '/temp/cargo-tracker-database', see the next exception for details.*
>> at
>> org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown
>> Source)
>> at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
>>
>> I'm on a Linux system, not running as root, and there is no /temp
>> directory, so I changed the following line in pom.xml:
>>
>> <webapp.databaseTempDir>/temp</webapp.databaseTempDir>
>>
>> to
>>
>> <webapp.databaseTempDir>/tmp</webapp.databaseTempDir>
>>
>> Then changed the following line in test-web.xml
>>
>> <url>jdbc:derby:/temp/test/cargo-tracker-database;create=true</url>
>>
>> to
>>
>> <url>jdbc:derby:/tmp/test/cargo-tracker-database;create=true</url>
>>
>> Rebuilt and redeployed, but I was still getting the exception, I
>> searched all over the code for references to "/temp" but couldn't
>> find any.
>>
>> As a workaround I sudo'ed to root, created /temp and chmod'ed it 777,
>> and was finally able to deploy.
>>
>> FWIW, this is the version of GlassFish I downloaded:
>>
>> http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/latest-glassfish.zip
>> <http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/>
>>
>> Added it to NetBeans ("Services" tab, right click "Servers" | "Add
>> Server")
>>
>> David
>>
>>
>>
>> On Sat, Oct 5, 2013 at 12:05 PM, Reza Rahman <reza.rahman_at_oracle.com
>> <mailto:reza.rahman_at_oracle.com>> wrote:
>>
>> Could you kindly try the nightly build of GlassFish 4 and tell me
>> what happens?
>>
>> Sent from my iPhone
>>
>> On Oct 5, 2013, at 12:01 PM, David Heffelfinger
>> <dheffelfinger_at_gmail.com <mailto:dheffelfinger_at_gmail.com>> wrote:
>>
>>> All,
>>>
>>> I got the latest source code from SVN as of this morning
>>> (revision 123).
>>>
>>> I loaded the project into NetBeans 7.4 RC2, and built it without
>>> a problem.
>>>
>>> I then attempted to deploy and run the project to GlassFish 4
>>> (included with NetBeans), but was unsuccessful, I got a
>>> NoClassDefFoundError.
>>>
>>> Here is a partial stack trace:
>>>
>>> SEVERE: Exception while preparing the app :
>>> java.lang.NoClassDefFoundError: Could not initialize class
>>> org.apache.derby.jdbc.EmbeddedDriver
>>> java.lang.NoClassDefFoundError: Could not initialize class
>>> org.apache.derby.jdbc.EmbeddedDriver
>>> at java.lang.Class.forName0(Native Method)
>>> at java.lang.Class.forName(Class.java:188)
>>> at
>>> com.sun.gjc.spi.DMManagedConnectionFactory.createManagedConnection(DMManagedConnectionFactory.java:114)
>>> at
>>> com.sun.enterprise.resource.allocator.LocalTxConnectorAllocator.createResource(LocalTxConnectorAllocator.java:87)
>>> at
>>> com.sun.enterprise.resource.pool.ConnectionPool.createSingleResource(ConnectionPool.java:907)
>>> at
>>> com.sun.enterprise.resource.pool.ConnectionPool.createResource(ConnectionPool.java:1189)
>>> at
>>> com.sun.enterprise.resource.pool.datastructure.RWLockDataStructure.addResource(RWLockDataStructure.java:98)
>>>
>>> I made sure I had derby.jar under .../domain1/lib but the
>>> problem persists.
>>>
>>> I would look deeper into it but unfortunately I'm busy with some
>>> other stuff.
>>>
>>> Is this a known issue or am I missing something here?
>>>
>>> Thanks,
>>> David
>>>
>>>
>>> --
>>> http://ensode.net <http://ensode.net/> - A Guide to Java, Linux
>>> and Other Technology Topics
>>> My Books:
>>> http://www.packtpub.com/authors/profiles/david-heffelfinger
>>> My Video Training:
>>> http://www.packtpub.com/java-ee-development-with-netbeans-7/video
>>> Follow me on Twitter: https://twitter.com/ensode
>>
>>
>>
>>
>> --
>> http://ensode.net <http://ensode.net/> - A Guide to Java, Linux and
>> Other Technology Topics
>> My Books: http://www.packtpub.com/authors/profiles/david-heffelfinger
>> My Video Training:
>> http://www.packtpub.com/java-ee-development-with-netbeans-7/video
>> Follow me on Twitter: https://twitter.com/ensode
>