git url:https://github.com/jonathanIckovich/realtyKing.git
im trying to change my thymleaf prefix to the assigned value
I followed this tutorial on how to merge react with thyme leaf
URL:https://dev.to/arpan_banerjee7/run-react-frontend-and-springboot-backend-on-the-same-port-and-package-them-as-a-single-artifact-14pa
up to the controller part everything worked fine now this happens. please note if you want to run it for privacy reasons in application i * some passwords. just replace with your account for gmail and mysql if you want.
application.properties
##for crud application
# DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
spring.datasource.url=jdbc:mysql://localhost:3306/realtyking?useSSL=false&serverTimezone=UTC&useLegacyDatetimeCode=false
spring.datasource.username=root
spring.datasource.password=********
## dont know what this one does
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
# Hibernate
# The SQL dialect makes Hibernate generate better SQL for the chosen database
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect
# Hibernate ddl auto (create, create-drop, validate, update)
spring.jpa.hibernate.ddl-auto = update
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type=TRACE
##for log in
spring.jpa.show-sql=true
spring.thymeleaf.prefix=file:C:/Users/Jonathan/Documents/realtyKing/realtyKing/target/classes/static/
spring.thymeleaf.suffix: .html
spring.thymeleaf.cache= false
## Spring view resolver set up
spring.mvc.view.prefix="/WEB-INF/view/"
spring.mvc.view.suffix=.jsp
## for session management
spring.session.store-type=jdbc
server.servlet.session.timeout=10800s
spring.session.jdbc.initialize-schema=always
##for error file pointer
spring.messages.basename=classpath:/message.properties
##spring thymleaf email set up
#gmail
spring.mail.default-encoding=UTF-8
spring.mail.host=smtp.gmail.com
spring.mail.username=realtyking66#gmail.com
spring.mail.password=********
spring.mail.port=587
spring.mail.protocol=smtp
spring.mail.test-connection=false
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true
##for geolocation
spring.jpa.database-platform=org.hibernate.spatial.dialect.postgis.PostgisDialect
On my own Magento 2 custom module, I want to install a custom database table. This is the InstallSchema class code:
<?php
namespace MyVendor\MyModule\Setup;
use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
class InstallSchema implements InstallSchemaInterface
{
/**
* #inheritdoc
*/
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
$table = $setup->getConnection()
->newTable($setup->getTable('my_table'))
->addColumn(
'greeting_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
null,
['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true],
'Greeting ID'
)
->addColumn(
'message',
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
255,
['nullable' => false, 'default' => ''],
'Message'
)->setComment("Greeting Message table");
$setup->getConnection()->createTable($table);
$setup->endSetup();
}
}
But the install method is not being executed.
Attached an xdebug session with breakpoints inside the function, never called.
Removed the module line in setup_module database table and re-run bin/magento setup:upgrade
Set the developer mode, disable cache, run a setup:di:compile, still fails.
Any ideas?
I've also tried to use UpdateSchema changing the module version, no luck.
I'm running Magento 2 on a Ubuntu Server virtual box. Permissions on folders are set correctly.
#wildchild great to get it working with another solution. In your question, you did not mention if you are using 2.2.* or 2.3.*, you just stated Magento 2.
I had the same issue after moved from one server to another and upgrading from 2.2 to 2.3 my custom module stop working, the PHP script not creating the table in the database.
I later found out that Magento has changed the music now you have to use declarative schema structure
The Module_Vendor/Module_Name/etc/db_schema.xml file declares a module’s database structure.
See the sample below and you should read more here
Create a table
The following example creates the declarative_table table with four columns. The id_column column is the primary key.
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<table name="declarative_table">
<column xsi:type="int" name="id_column" padding="10" unsigned="true" nullable="false" comment="Entity Id"/>
<column xsi:type="int" name="severity" padding="10" unsigned="true" nullable="false" comment="Severity code"/>
<column xsi:type="varchar" name="title" nullable="false" length="255" comment="Title"/>
<column xsi:type="timestamp" name="time_occurred" padding="10" comment="Time of event"/>
<constraint xsi:type="primary" referenceId="PRIMARY">
<column name="id_column"/>
</constraint>
</table>
</schema>
Then run these command // ubuntu
php bin/magento setup:upgrade && php bin/magento cache:flush && php bin/magento cache:clean
In my case the package name was wrong. After replacing by right package name issue is fixed.
namespace Package_Name\Module_Name\Setup;
Please declare and add dependencies in InstallSchema file as given below:-
namespace <Your_Package>\<Your_Module>\Setup;
use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
use Magento\Framework\Setup\ModuleContextInterface;
Then clear the cache and remove data from generated folder and remove module entry from setup_module.
Make sure that you have defined correct setup version in your module.xml file
Found the solution. It was the module name in the module.xml file. The setup:upgrade installer search for the InstallSchema in a case-sensitive folder path, so if you declare the module as
my_module
it will search on MyVendor/my/module/Setup folder.
I resolve it by replacing the name with:
MyModule
So the installer will search correctly on MyVendor/MyModule/Setup folder.
I found the problem with the "old-way", by placing log messages on the Install.php file on the Magento setup folder.
I've created a datasource in Karaf 4 (ServiceMix 7) that works from the karaf console - I can list tables, execute queries and so on.
My issue is when I try to use it from my Camel route.
Excerpt from my blueprint:
...
<reference filter="(osgi.jndi.service.name=jdbc/erp)" id="erpDataSource" interface="javax.sql.DataSource"/>
...
<to id="erpSelectQuery" uri="jdbc:erpDataSource"/>
...
It finds my dataSource but the blueprint can't start due to:
"java.lang.IllegalArgumentException: connectionFactory must be specified"
My datasource was created using:
jdbc:ds-create -dbName erp -dt DataSource -dn mysql -u erp -dc com.mysql.jdbc.Driver -p pre jdbc/erp
I'm at loss here
I have never done it via the jdbc command syntax I followed the guides from the Ops4J Wiki On Datasource creation which I like for one reason alone, this method creates a simple text file that can be administered by not just a Java developer, i.e. it is easier to modify and troubleshoot.
For the sake of not subjecting my answer to link rot I will just outline the procedure here.
Create a datasource configuration file(simple text file) in /servicemixhome/etc with the following naming convention org.ops4j.datasource-give_your_datasource_a_name.cfg .
In the config file configure the appropriate settings an example of mine looks like this:
osgi.jdbc.driver.class = com.mysql.jdbc.Driver
databaseName=dhData
user=foo
url=jdbc:mysql://192.199.199.199:3306/dhData
password=somepassword
dataSourceName=myDSName
Make sure you installed the ops4j required features:
feature:install pax-jdbc-mysql pax-jdbc-config
Now list the datasources using the following syntax:
karaf#root()> service:list javax.sql.DataSource
This will echo something like the list below back.
[javax.sql.DataSource]
----------------------
osgi.jdbc.driver.class = com.mysql.jdbc.Driver
databaseName=dhData
user=foo
url=jdbc:mysql://192.199.199.199:3306/dhData
password=somepassword
dataSourceName=myDSName
Provided by :
OPS4J Pax JDBC Config (216)
At this point you can reference the datasource usign an osgi filter in the blueprint.xml with the following syntax:
<reference filter="(&(objectClass=javax.sql.DataSource)(dataSourceName=myDSName ))" id="myData" interface="javax.sql.DataSource"/>
Then to reference this as property of a bean for example you could do the following:
<bean class="foo.bar" id="ImsCbrEventsBean">
<property name="dataSource" ref="myData"/>
</bean>
Keep in mind this creates a singular connection to a database and you should really create a connection pool.
This can be done by installing the pax-jdbc-pool-dbcp2 feature or any of the other connection pools but use only one at a time, then modifying the datasource config file to carry appropriate information like the example below:
osgi.jdbc.driver.name = mysql
databaseName=dhData
user=foo
url=jdbc:mysql://192.199.199.199:3306/dhData
password=somepassword
dataSourceName=myDSName
jdbc.pool.maxTotal=32
jdbc.pool.blockWhenExhausted=true
jdbc.pool.lifo=false
jdbc.pool.maxIdle=24
jdbc.pool.maxWaitMillis=5000
jdbc.pool.minEvictableIdleTimeMillis=1800000
jdbc.pool.minIdle=16
jdbc.pool.numTestsPerEvictionRun=3
jdbc.pool.softMinEvictableIdleTimeMillis=-1
jdbc.pool.testOnBorrow=true
jdbc.pool.testOnCreate=true
jdbc.pool.testOnReturn=true
jdbc.pool.testWhileIdle=true
jdbc.pool.timeBetweenEvictionRunsMillis=3600000
Using Cake version 3.4.5 :
1) I've wrote a plugin :
/plugins/Accounting/
2) then, to create the pot file from the view files I run :
bin/cake i18n extract --plugin Accounting
3) this generates /plugins/Accounting/src/Locale/default.pot
But the translated text does not appear.
My locale is es_AR, and I've tried to copy the file as :
/plugins/Accounting/src/Locale/accounting.pot
or
/plugins/Accounting/src/Locale/es_AR/default.pot
or
/plugins/Accounting/src/Locale/es_AR/accounting.pot
Also tried to save the files as accounting.po, but nothing happens
But still not text is translated from the plugin views (it does work for the app's views).
I've found it !!!
The problem was the file / directory permissions.
By default, cake i18n extract --plugin MyPlugin makes this :
creates the src/Locale/ directory inside the plugin structure
creates the template translation file default.pot instead of
my_plugin.pot
all these creations are made with mode 750 being
the owner the linux user currently logged in ( not www-data )
So in order to make it work :
change the permissions of the Locale structure to 755
rename default.pot to my_plugin.po
use __d( 'my_plugin', 'Text to be translated' )
I am trying to use the Media Plugin (http://www.ohloh.net/p/cakephp-media)
I placed the media folder contents in app/plugins/media
then in bootstrap.php in the app/config/ folder added the following code.
Configure::load('media.core');
Now when i run any controller and any action am getting the following error.
Configure::load() - no variable $config found in core.php [CORE\cake\libs\configure.php, line 266]
I am using Cakephp 1.3.7
loading config files with cakes Configure::load() has a requirement that the configs be in a variable called $config
eg
<?php
$config['Meh'] = array('foo' => 'bar');
?>