How to set up roo to use derby client driver with DBRE addon? - derby

How can one set up roo so that it uses derby client driver to reverse engineer existing database objects?

First, try DBRE command and see what errors do you get. Command:
> database reverse engineering --schema <your_schema_name> --package ~.domain
Then you will see what are the errors...
I needed to install addons for Derby like this:
> addon install bundle --bundleSymbolicName org.springframework.roo.wrapping.derby
> addon install bundle --bundleSymbolicName org.springframework.roo.wrapping.derbyclient
Then called:
> persistence setup --provider HIBERNATE --database DERBY
Then you would probably need to change your database.properties file in your project to contain correct location of your database. Mine settings are:
// database.password=
// database.url=jdbc\:derby\:roo_crm;
// database.username=
// database.driverClassName=org.apache.derby.jdbc.EmbeddedDriver
Again, different database (other than Derby) might have another driver and database.url.
Then I was able to generate code using DBRE Spring Roo feature like this:
> database reverse engineer --schema APP --package ~.domain
Then I have opened my project in springroo tool suite and I was able to see code in java and aspectJ.

Related

Application Issues in Migrating Websphere from 8.0.0.10 to Liberty profile

i'm trying to migrate WAS server 8.0.0.10 to Liberty Profile. So I downloaded the Migration Tool using the "Install New Software" option in the "Help" Menu just a week ago. I selected the "Migration Tools" -> "Websphere Application Server Migration" -> "Configuration Manager" -> "Websphere Configuration Migration Toolkit for Websphere". Followed below link steps http://www.ibm.com/developerworks/websphere/library/techarticles/1404_vines2/1404_vines2.html . But while executing comments in command prompt:
wsadmin -lang jython -c "AdminTask.extractConfigProperties(['-propertiesFileName my.props'])"
Getting Below error message :
C:\Users\DSIVARAM\WAS-profiles\8.0\SFQ\bin>wsadmin(.sh/.bat) -lang jython -c "AdminTask.extractConfigProperties(['-propertiesFileName my.props'])"
WASX7209I: Connected to process "SFQ" on node SFQNode using SOAP connector; The type of process is: UnManagedProcess
WASX7411W: Ignoring the following provided option: [(.sh/.bat)]
WASX7015E: Exception running command: "AdminTask.extractConfigProperties(['-propertiesFileName my.props'])"; exception information:
com.ibm.ws.management.wasresource.common.WASResourceException: com.ibm.ws.management.wasresource.common.WASResourceException: com.ibm.ws.management.wasresource.common.WASResourceException: com.ibm.websphere.management.exception.AdminException:
ADMA0144E: Application SourcingForQuality20031104 is installed with the zero binary copy option. Applications are installed using this option in a Rational unit test environment or using AppManagement MBean API.
When an application is installed using this option it is not possible to perform any operation on this application using wsadmin or administrative console that involves accessing the application metadata or EAR file.
Such operations include view/edit application information, export, export DDL etc. The only possible operations using wsadmin or admin console are start, stop and uninstall.
If this application is installed using WSAD unit test environment then use WSAD to view/edit application information.
Please help me to sort out the issue.
If you are running your server from development tool (Eclipse/Rad), change your server publishing settings from run resources from workspace to run from server , restart and redeploy application. You should be able to export then.
You won't be able to extract application information with extractConfigProperties if you have a zero-binary installed application. I think you can limit the extent of the extract using the -filterMechanism or -configData options to just extract the configuration needed by the application without extracting the application information itself.
See http://www.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.nd.doc/ae/txml_7extractprops.html for examples.

weblogic 12cR2. How to add library before run config.sh

This is maybe not an issue for who knows how config.sh work when you config weblogic after you installed it into your disk.
My question is: After I installed weblogic 12cR2. How I can add a customer JDBC driver jar file into weblogic 12cR2 before I run config.sh as when I do config, system need use it to connect my database?
I tried to put it in:
$ORACLE_HOME/oracle_common/modules/db2jcc4.jar
and then, I add the full driver jar file path into java class path with this file:
$ORACLE_HOME/oracle_common/common/bin/commExtEnv.sh
Then I restart my Mac and then, redo config.sh to set up component datasource (em module need it) for RCU. Weblogic blaming driver not found.
but, if I start weblogic server by using $DOMAINH_HOME/startWebLogic.sh. weblogic can find that driver in the path.
What's wrong I did? Please advise!
You don't have to change "commExtEnv.sh". In Weblogic 12c you can create a file called "setUserOverrides.sh" in order to customize the Weblogic starting paramters like the classpath. In your case you could have something like this:
# add custom libraries to the WebLogic Server system classpath
if [ "${POST_CLASSPATH}" != "" ] ; then
POST_CLASSPATH="${POST_CLASSPATH}${CLASSPATHSEP}$ORACLE_HOME/oracle_common/modules/db2jcc4.jar"
export POST_CLASSPATH
else
POST_CLASSPATH="$ORACLE_HOME/oracle_common/modules/db2jcc4.jar"
export POST_CLASSPATH
fi
The "setUserOverrides.sh" must be placed in the bin folder of your domain, where setDomainEnv.sh, setStartupEnv.sh and startWebLogic.sh reside.
You can find more information here in the Oracle documentation: http://docs.oracle.com/middleware/1212/wls/START/overview.htm#START250

Glassfish deploy command with createtables error

I have an application packaged as .war file. I want to deploy this web application to Glassfish v4.0 server using this command:
./asadmin deploy --force=true --createtables --contextroot test /tmp/test.war
Deployment without --createtables parameter works fine, however I want the tables to be generated/updated during the deployment. On my local server where I have only one JDBC resource defined in glassfish it works fine. But on the test server there are more JDBC resources defined with limited privilegies and one JDBC resource that I want to use just for this task. How do I tell glassfish to use this particular JDBC resource when creating and updating tables?
Thank you
You need to provide {true|false} to the --createtables option:
./asadmin deploy --force=true --createtables=true --contextroot test /tmp/test.war

Apache Derby nature cannot be added [duplicate]

Edit: According to the Derby community the Eclipse plug-in won't be maintained nor built automatically along the Derby project.
But is there anybody still using this plug-in? Because if so, is there a place he/she publishes the actual builds - which (hopefully) would run under Eclipse Juno?
Or, if this is a real dead end, what are the alternatives?
The original problem
Using
jdk1.7.0_03
Eclipse IDE for Java EE Developers (Win32) version Juno (build from 2012/06/14)
derby-core-plugin 10.8.2 and -ui-plugin 1.1.3 (as there is no eclipse plugin for the latest version 10.9.1.0)
Problem
When trying to add a new derby nature (right-click on the java project -> "Apache Derby" -> "Add Apache Derby nature") I only get the following message:
Apache Derby Ui Plug-in
Error adding Derby jars to the project:
org.eclipse.ui.internal.WorkbenchWindow cannot be cast to
org.eclipse.jface.window.ApplicationWindow
Any ideas?
Apache Derby db-derby-10.9.1.0-src / Eclipse 4.2.1 (Juno) / Java 7
Some kind of fix. Needs more research but this will work.
References:
db-derby-10.9.1.0-src/BUILDING.html
db-derby-10.8.1.2-src/plugins/eclipse/Readme.txt
Download the Apache Derby source zip.
Extract the zip.
Change to the source directory.
db-derby-10.9.1.0-src
Perform the following ant targets.
ant -quiet clobber
ant -quiet buildsource
ant -quiet buildjars
Build the core plugin.
ant plugin
You should now have a derby_core_plugin_10.9.1.zip file in the db-derby-10.9.1.0-src/jars/sane directory.
Note: Your Eclipse IDE should not be running.
Extract the derby core plugin created by the ant plugin task above and copy the contents to your Eclipse plugins directory.
Run Eclipse.
Import the org.apache.derby.ui from the source tree.
(Import > General > Existing Projects into Workspace)
Open the plugin.xml file
On the Overview tab, bump up the version number to let's say 1.1.4.
Save the file.
The bug(s) are in ...
1.)package org.apache.derby.ui.popup.actions.AddDerbyNature.java
2.)package org.apache.derby.ui.popup.actions.RemoveDerbyNature.java
Where the .setStatus method are called in these two units.
Note: ( from the javadoc of ApplicationWindow )
void org.eclipse.jface.window.ApplicationWindow.setStatus(String message)
Sets or clears the message displayed in this window's status line (if it has >one). This method has no effect if the window does not have a status line.
Parameters:
message the status message, or null to clear it
So let's assume the IDE doesn't have a status line, so this call has no effect according to the Java doc.
Commenting out these method calls from:
AddDerbyNature.java
//((ApplicationWindow) window).setStatus(Messages.ADDING_NATURE);
//((ApplicationWindow) window).setStatus(Messages.DERBY_NATURE_ADDED);
RemoveDerbyNature.java
//((ApplicationWindow)window).setStatus(Messages.REMOVING_NATURE);
//((ApplicationWindow)window).setStatus(Messages.DERBY_NATURE_REMOVED);
Test(s):
Run As Eclipse Application.
Create a project. Maybe call it “org.apache.derby.ui.test”.
Right Click on project / Select Add Apache Derby nature
No error.
Right Click on project / Select Remove Apache Derby nature
No error.
Add the nature again to test the other menu items.
Right Click on project / Select Add Apache Derby nature
Right Click on project / Select Start Derby Network Server
No error, server was started.
From the console log ...
Sun Jan 27 17:51:29 EST 2013 : Security manager installed using the Basic server security policy.
Sun Jan 27 17:51:29 EST 2013 : Apache Derby Network Server - 10.9.1.0 - (Unversioned directory) started and ready to accept connections on port 1527
Note: Not sure what the Unversioned directory message means
Right Click on project / Select Stop Derby Network Server
No error, server was stopped.
Sun Jan 27 17:53:32 EST 2013 : Apache Derby Network Server - 10.9.1.0 - (Unversioned directory) shutdown
Start the server back up …
Right Click on project / Select Start Derby Network Server
create a sql folder.
create a test.sql file
my test sql file.
connect 'jdbc:derby://localhost:1527/TESTDB;create=true;user=test;password=test;';
-- drop User Indexes - ignore error if first time creating
drop index UserNameIdx1;
-- drop the table if it exists - ignore error if first time creating
drop table TEST_USER;
-- create the table
create table TEST_USER (
ID integer generated by default as identity,
USER_NAME varchar(255) not null,
FIRST_NAME varchar(255),
LAST_NAME varchar(255),
PASSWORD varchar(255),
ENABLED integer,
CREATED_STAMP timestamp,
CREATED_TX_STAMP timestamp,
LAST_UPDATED_STAMP timestamp,
LAST_UPDATED_TX_STAMP timestamp,
constraint TEST_USER_PK primary key (ID)
);
-- insert some data -- oops --- will mess with the ID generator, see the alter table restart line below.
insert into TEST_USER values(0, 'admin','admin','admin','admin',1,'2013-01-18 12:00:00.000','2013-01-18 12:00:00.000','2013-01-18 12:00:00.000','2013-01-18 12:00:00.000');
-- make the USER_NAME unique
create unique index UserNameIdx1 on TEST_USER(USER_NAME);
-- reset the generator
alter table TEST_USER alter column ID restart with 1;
Right click on file > Apache Derby > Run SQL Script using 'ij'
Refesh the projects workspace, now there should be a TESTDB folder.
Database was created. Ok.
Create a zip.
Right click on project > Export
Click on Plug-in Development > Deplyable plug-ins and fragments.
Destination Tab
Archive file
/derby_ui_plugin_1.1.4-fix.zip
Options Tab
Unselect Package plugins as individual JAR archives
Click finish.
Close / Exit the test instance.
Exit Eclipse.
Extract the zip that you just created from above.
Copy it's contents to the plugins directory to your Eclipse (Juno) plugins directory.
Restart Eclipse. Create a new project.
You should be able to install an Apache Derby (10.9.1) nature onto your projects.
Note: if you built this with Java 7, don't expect it to work for any lesser JVM version.
The Derby UI plugin for Eclipse has not been maintained for several years, I believe, as none of the regular Derby committers uses that plugin, and there have not been any volunteers from the community to maintain it. So I think it only works with older versions of Eclipse.
I suspect that it is not very much work to bring it up to date to make it work with current Eclipse. If you are interested in that functionality, I'm sure the Derby community would love to hear from you!
See also: Is it possible to use derby from apache in Eclipse now that they stopped developing the derby plugin for Eclipse?

H2 console access for databases other than h2

H2 console (http://localhost:8082/login.jsp) has the option to look at details of any database, where should we copy the jdbc driver if we have tp talk to the mysql or other database servers. Copying the jdbc driver file (mysql-connector-java-5.0.8-bin.jar) under bin directory didn't seem to help
Note: My H2 server is running as a service
To use other databases (for example MySQL), the location of the JDBC drivers of those databases need to be added to the environment variables H2DRIVERS or CLASSPATH before installing the service. Multiple drivers can be set; each entry needs to be separated with a ; (Windows) or : (other operating systems). Spaces in the path names are supported. The settings must not be quoted.
I just put the driver(s) on the classpath when I start the server:
classpath=.:/opt/h2/bin/h2.jar:/opt/derby/lib/derby.jar:...
server=org.h2.tools.Server
java -cp ${classpath} ${server} -tcp -web ... &
Alternatively, this is one of the rare times you might add a JAR to one of the java.ext.dirs. You can see what's available on your platform:
System.out.println(System.getProperty("java.ext.dirs"));

Resources